2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5 * Copyright (c) 2001-2004, The GROMACS development team.
6 * Copyright (c) 2013,2014, by the GROMACS development team, led by
7 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
8 * and including many others, as listed in the AUTHORS file in the
9 * top-level source directory and at http://www.gromacs.org.
11 * GROMACS is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public License
13 * as published by the Free Software Foundation; either version 2.1
14 * of the License, or (at your option) any later version.
16 * GROMACS is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with GROMACS; if not, see
23 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
24 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 * If you want to redistribute modifications to GROMACS, please
27 * consider that scientific software is very special. Version
28 * control is crucial - bugs must be traceable. We will be happy to
29 * consider code for inclusion in the official distribution, but
30 * derived work must not be called official GROMACS. Details are found
31 * in the README & COPYING files - if they are missing, get the
32 * official version at http://www.gromacs.org.
34 * To help us fund GROMACS development, we humbly ask that you cite
35 * the research papers on the package. Check out http://www.gromacs.org.
37 /* This file is completely threadsafe - keep it that way! */
42 #include "thread_mpi/threads.h"
44 #include "gromacs/utility/smalloc.h"
46 #include "gromacs/math/vec.h"
50 #include "gromacs/random/random.h"
52 /* The source code in this file should be thread-safe.
53 Please keep it that way. */
57 static gmx_bool bOverAllocDD = FALSE;
58 static tMPI_Thread_mutex_t over_alloc_mutex = TMPI_THREAD_MUTEX_INITIALIZER;
61 void set_over_alloc_dd(gmx_bool set)
63 tMPI_Thread_mutex_lock(&over_alloc_mutex);
64 /* we just make sure that we don't set this at the same time.
65 We don't worry too much about reading this rarely-set variable */
67 tMPI_Thread_mutex_unlock(&over_alloc_mutex);
70 int over_alloc_dd(int n)
74 return OVER_ALLOC_FAC*n + 100;
82 int gmx_int64_to_int(gmx_int64_t step, const char *warn)
88 if (warn != NULL && (step < INT_MIN || step > INT_MAX))
90 fprintf(stderr, "\nWARNING during %s:\n", warn);
91 fprintf(stderr, "step value ");
92 fprintf(stderr, "%"GMX_PRId64, step);
93 fprintf(stderr, " does not fit in int, converted to %d\n\n", i);
99 char *gmx_step_str(gmx_int64_t i, char *buf)
101 sprintf(buf, "%"GMX_PRId64, i);
106 void init_block(t_block *block)
111 block->nalloc_index = 1;
112 snew(block->index, block->nalloc_index);
116 void init_blocka(t_blocka *block)
122 block->nalloc_index = 1;
123 snew(block->index, block->nalloc_index);
129 void init_atom(t_atoms *at)
139 at->atomtypeB = NULL;
143 void init_atomtypes(t_atomtypes *at)
148 at->atomnumber = NULL;
149 at->gb_radius = NULL;
153 void init_groups(gmx_groups_t *groups)
157 groups->ngrpname = 0;
158 groups->grpname = NULL;
159 for (g = 0; (g < egcNR); g++)
161 groups->grps[g].nm_ind = NULL;
162 groups->ngrpnr[g] = 0;
163 groups->grpnr[g] = NULL;
168 void init_mtop(gmx_mtop_t *mtop)
172 mtop->moltype = NULL;
174 mtop->molblock = NULL;
175 mtop->maxres_renum = 0;
177 init_groups(&mtop->groups);
178 init_block(&mtop->mols);
179 open_symtab(&mtop->symtab);
182 void init_top(t_topology *top)
187 init_atom (&(top->atoms));
188 init_atomtypes(&(top->atomtypes));
189 init_block(&top->cgs);
190 init_block(&top->mols);
191 init_blocka(&top->excls);
192 open_symtab(&top->symtab);
195 void init_inputrec(t_inputrec *ir)
197 memset(ir, 0, (size_t)sizeof(*ir));
198 snew(ir->fepvals, 1);
199 snew(ir->expandedvals, 1);
200 snew(ir->simtempvals, 1);
203 void stupid_fill_block(t_block *grp, int natom, gmx_bool bOneIndexGroup)
209 grp->nalloc_index = 2;
210 snew(grp->index, grp->nalloc_index);
212 grp->index[1] = natom;
217 grp->nalloc_index = natom+1;
218 snew(grp->index, grp->nalloc_index);
219 snew(grp->index, natom+1);
220 for (i = 0; (i <= natom); i++)
228 void stupid_fill_blocka(t_blocka *grp, int natom)
232 grp->nalloc_a = natom;
233 snew(grp->a, grp->nalloc_a);
234 for (i = 0; (i < natom); i++)
240 grp->nalloc_index = natom + 1;
241 snew(grp->index, grp->nalloc_index);
242 for (i = 0; (i <= natom); i++)
249 void copy_blocka(const t_blocka *src, t_blocka *dest)
254 dest->nalloc_index = dest->nr + 1;
255 snew(dest->index, dest->nalloc_index);
256 for (i = 0; i < dest->nr+1; i++)
258 dest->index[i] = src->index[i];
260 dest->nra = src->nra;
261 dest->nalloc_a = dest->nra + 1;
262 snew(dest->a, dest->nalloc_a);
263 for (i = 0; i < dest->nra+1; i++)
265 dest->a[i] = src->a[i];
269 void done_block(t_block *block)
273 block->nalloc_index = 0;
276 void done_blocka(t_blocka *block)
284 block->nalloc_index = 0;
288 void done_atom (t_atoms *at)
296 sfree(at->atomtypeB);
303 void done_atomtypes(t_atomtypes *atype)
306 sfree(atype->radius);
308 sfree(atype->surftens);
309 sfree(atype->atomnumber);
310 sfree(atype->gb_radius);
314 void done_moltype(gmx_moltype_t *molt)
318 done_atom(&molt->atoms);
319 done_block(&molt->cgs);
320 done_blocka(&molt->excls);
322 for (f = 0; f < F_NRE; f++)
324 sfree(molt->ilist[f].iatoms);
325 molt->ilist[f].nalloc = 0;
329 void done_molblock(gmx_molblock_t *molb)
331 if (molb->nposres_xA > 0)
333 molb->nposres_xA = 0;
334 sfree(molb->posres_xA);
336 if (molb->nposres_xB > 0)
338 molb->nposres_xB = 0;
339 sfree(molb->posres_xB);
343 void done_mtop(gmx_mtop_t *mtop, gmx_bool bDoneSymtab)
349 done_symtab(&mtop->symtab);
352 sfree(mtop->ffparams.functype);
353 sfree(mtop->ffparams.iparams);
355 for (i = 0; i < mtop->nmoltype; i++)
357 done_moltype(&mtop->moltype[i]);
359 sfree(mtop->moltype);
360 for (i = 0; i < mtop->nmolblock; i++)
362 done_molblock(&mtop->molblock[i]);
364 sfree(mtop->molblock);
365 done_block(&mtop->mols);
368 void done_top(t_topology *top)
372 sfree(top->idef.functype);
373 sfree(top->idef.iparams);
374 for (f = 0; f < F_NRE; ++f)
376 sfree(top->idef.il[f].iatoms);
377 top->idef.il[f].iatoms = NULL;
378 top->idef.il[f].nalloc = 0;
381 done_atom (&(top->atoms));
384 done_atomtypes(&(top->atomtypes));
386 done_symtab(&(top->symtab));
387 done_block(&(top->cgs));
388 done_block(&(top->mols));
389 done_blocka(&(top->excls));
392 static void done_pull_group(t_pull_group *pgrp)
397 sfree(pgrp->ind_loc);
399 sfree(pgrp->weight_loc);
403 static void done_pull(t_pull *pull)
407 for (i = 0; i < pull->ngroup+1; i++)
409 done_pull_group(pull->group);
410 done_pull_group(pull->dyna);
414 void done_inputrec(t_inputrec *ir)
418 for (m = 0; (m < DIM); m++)
426 sfree(ir->ex[m].phi);
434 sfree(ir->et[m].phi);
438 sfree(ir->opts.nrdf);
439 sfree(ir->opts.ref_t);
440 sfree(ir->opts.annealing);
441 sfree(ir->opts.anneal_npoints);
442 sfree(ir->opts.anneal_time);
443 sfree(ir->opts.anneal_temp);
444 sfree(ir->opts.tau_t);
446 sfree(ir->opts.nFreeze);
447 sfree(ir->opts.QMmethod);
448 sfree(ir->opts.QMbasis);
449 sfree(ir->opts.QMcharge);
450 sfree(ir->opts.QMmult);
452 sfree(ir->opts.CASorbitals);
453 sfree(ir->opts.CASelectrons);
454 sfree(ir->opts.SAon);
455 sfree(ir->opts.SAoff);
456 sfree(ir->opts.SAsteps);
457 sfree(ir->opts.bOPT);
467 static void zero_history(history_t *hist)
469 hist->disre_initf = 0;
470 hist->ndisrepairs = 0;
471 hist->disre_rm3tav = NULL;
472 hist->orire_initf = 0;
473 hist->norire_Dtav = 0;
474 hist->orire_Dtav = NULL;
477 static void zero_ekinstate(ekinstate_t *eks)
482 eks->ekinh_old = NULL;
483 eks->ekinscalef_nhc = NULL;
484 eks->ekinscaleh_nhc = NULL;
485 eks->vscale_nhc = NULL;
490 static void init_swapstate(swapstate_t *swapstate)
494 swapstate->eSwapCoords = 0;
495 swapstate->nAverage = 0;
497 /* Ion/water position swapping */
498 for (ic = 0; ic < eCompNR; ic++)
500 for (ii = 0; ii < eIonNR; ii++)
502 swapstate->nat_req[ic][ii] = 0;
503 swapstate->nat_req_p[ic][ii] = NULL;
504 swapstate->inflow_netto[ic][ii] = 0;
505 swapstate->inflow_netto_p[ic][ii] = NULL;
506 swapstate->nat_past[ic][ii] = NULL;
507 swapstate->nat_past_p[ic][ii] = NULL;
508 swapstate->fluxfromAtoB[ic][ii] = 0;
509 swapstate->fluxfromAtoB_p[ic][ii] = NULL;
512 swapstate->fluxleak = NULL;
513 swapstate->nions = 0;
514 swapstate->comp_from = NULL;
515 swapstate->channel_label = NULL;
516 swapstate->bFromCpt = 0;
517 swapstate->nat[eChan0] = 0;
518 swapstate->nat[eChan1] = 0;
519 swapstate->xc_old_whole[eChan0] = NULL;
520 swapstate->xc_old_whole[eChan1] = NULL;
521 swapstate->xc_old_whole_p[eChan0] = NULL;
522 swapstate->xc_old_whole_p[eChan1] = NULL;
525 void init_energyhistory(energyhistory_t * enerhist)
529 enerhist->ener_ave = NULL;
530 enerhist->ener_sum = NULL;
531 enerhist->ener_sum_sim = NULL;
532 enerhist->dht = NULL;
534 enerhist->nsteps = 0;
536 enerhist->nsteps_sim = 0;
537 enerhist->nsum_sim = 0;
539 enerhist->dht = NULL;
542 static void done_delta_h_history(delta_h_history_t *dht)
546 for (i = 0; i < dht->nndh; i++)
554 void done_energyhistory(energyhistory_t * enerhist)
556 sfree(enerhist->ener_ave);
557 sfree(enerhist->ener_sum);
558 sfree(enerhist->ener_sum_sim);
560 if (enerhist->dht != NULL)
562 done_delta_h_history(enerhist->dht);
563 sfree(enerhist->dht);
567 void init_gtc_state(t_state *state, int ngtc, int nnhpres, int nhchainlength)
572 state->nnhpres = nnhpres;
573 state->nhchainlength = nhchainlength;
576 snew(state->nosehoover_xi, state->nhchainlength*state->ngtc);
577 snew(state->nosehoover_vxi, state->nhchainlength*state->ngtc);
578 snew(state->therm_integral, state->ngtc);
579 for (i = 0; i < state->ngtc; i++)
581 for (j = 0; j < state->nhchainlength; j++)
583 state->nosehoover_xi[i*state->nhchainlength + j] = 0.0;
584 state->nosehoover_vxi[i*state->nhchainlength + j] = 0.0;
587 for (i = 0; i < state->ngtc; i++)
589 state->therm_integral[i] = 0.0;
594 state->nosehoover_xi = NULL;
595 state->nosehoover_vxi = NULL;
596 state->therm_integral = NULL;
599 if (state->nnhpres > 0)
601 snew(state->nhpres_xi, state->nhchainlength*nnhpres);
602 snew(state->nhpres_vxi, state->nhchainlength*nnhpres);
603 for (i = 0; i < nnhpres; i++)
605 for (j = 0; j < state->nhchainlength; j++)
607 state->nhpres_xi[i*nhchainlength + j] = 0.0;
608 state->nhpres_vxi[i*nhchainlength + j] = 0.0;
614 state->nhpres_xi = NULL;
615 state->nhpres_vxi = NULL;
620 void init_state(t_state *state, int natoms, int ngtc, int nnhpres, int nhchainlength, int nlambda)
624 state->natoms = natoms;
627 snew(state->lambda, efptNR);
628 for (i = 0; i < efptNR; i++)
630 state->lambda[i] = 0;
633 clear_mat(state->box);
634 clear_mat(state->box_rel);
635 clear_mat(state->boxv);
636 clear_mat(state->pres_prev);
637 clear_mat(state->svir_prev);
638 clear_mat(state->fvir_prev);
639 init_gtc_state(state, ngtc, nnhpres, nhchainlength);
640 state->nalloc = state->natoms;
641 if (state->nalloc > 0)
643 snew(state->x, state->nalloc);
644 snew(state->v, state->nalloc);
653 zero_history(&state->hist);
654 zero_ekinstate(&state->ekinstate);
655 init_energyhistory(&state->enerhist);
656 init_df_history(&state->dfhist, nlambda);
657 init_swapstate(&state->swapstate);
658 state->ddp_count = 0;
659 state->ddp_count_cg_gl = 0;
661 state->cg_gl_nalloc = 0;
664 void done_state(t_state *state)
687 state->cg_gl_nalloc = 0;
690 sfree(state->lambda);
694 sfree(state->nosehoover_xi);
695 sfree(state->nosehoover_vxi);
696 sfree(state->therm_integral);
700 t_state *serial_init_local_state(t_state *state_global)
703 t_state *state_local;
705 snew(state_local, 1);
707 /* Copy all the contents */
708 *state_local = *state_global;
709 snew(state_local->lambda, efptNR);
710 /* local storage for lambda */
711 for (i = 0; i < efptNR; i++)
713 state_local->lambda[i] = state_global->lambda[i];
719 static void do_box_rel(t_inputrec *ir, matrix box_rel, matrix b, gmx_bool bInit)
723 for (d = YY; d <= ZZ; d++)
725 for (d2 = XX; d2 <= (ir->epct == epctSEMIISOTROPIC ? YY : ZZ); d2++)
727 /* We need to check if this box component is deformed
728 * or if deformation of another component might cause
729 * changes in this component due to box corrections.
731 if (ir->deform[d][d2] == 0 &&
732 !(d == ZZ && d2 == XX && ir->deform[d][YY] != 0 &&
733 (b[YY][d2] != 0 || ir->deform[YY][d2] != 0)))
737 box_rel[d][d2] = b[d][d2]/b[XX][XX];
741 b[d][d2] = b[XX][XX]*box_rel[d][d2];
748 void set_box_rel(t_inputrec *ir, t_state *state)
750 /* Make sure the box obeys the restrictions before we fix the ratios */
751 correct_box(NULL, 0, state->box, NULL);
753 clear_mat(state->box_rel);
755 if (PRESERVE_SHAPE(*ir))
757 do_box_rel(ir, state->box_rel, state->box, TRUE);
761 void preserve_box_shape(t_inputrec *ir, matrix box_rel, matrix b)
763 if (PRESERVE_SHAPE(*ir))
765 do_box_rel(ir, box_rel, b, FALSE);
769 void add_t_atoms(t_atoms *atoms, int natom_extra, int nres_extra)
775 srenew(atoms->atomname, atoms->nr+natom_extra);
776 srenew(atoms->atom, atoms->nr+natom_extra);
777 if (NULL != atoms->pdbinfo)
779 srenew(atoms->pdbinfo, atoms->nr+natom_extra);
781 if (NULL != atoms->atomtype)
783 srenew(atoms->atomtype, atoms->nr+natom_extra);
785 if (NULL != atoms->atomtypeB)
787 srenew(atoms->atomtypeB, atoms->nr+natom_extra);
789 for (i = atoms->nr; (i < atoms->nr+natom_extra); i++)
791 atoms->atomname[i] = NULL;
792 memset(&atoms->atom[i], 0, sizeof(atoms->atom[i]));
793 if (NULL != atoms->pdbinfo)
795 memset(&atoms->pdbinfo[i], 0, sizeof(atoms->pdbinfo[i]));
797 if (NULL != atoms->atomtype)
799 atoms->atomtype[i] = NULL;
801 if (NULL != atoms->atomtypeB)
803 atoms->atomtypeB[i] = NULL;
806 atoms->nr += natom_extra;
810 srenew(atoms->resinfo, atoms->nres+nres_extra);
811 for (i = atoms->nres; (i < atoms->nres+nres_extra); i++)
813 memset(&atoms->resinfo[i], 0, sizeof(atoms->resinfo[i]));
815 atoms->nres += nres_extra;
819 void init_t_atoms(t_atoms *atoms, int natoms, gmx_bool bPdbinfo)
823 snew(atoms->atomname, natoms);
824 atoms->atomtype = NULL;
825 atoms->atomtypeB = NULL;
826 snew(atoms->resinfo, natoms);
827 snew(atoms->atom, natoms);
830 snew(atoms->pdbinfo, natoms);
834 atoms->pdbinfo = NULL;
838 t_atoms *copy_t_atoms(t_atoms *src)
844 init_t_atoms(dst, src->nr, (NULL != src->pdbinfo));
846 if (NULL != src->atomname)
848 snew(dst->atomname, src->nr);
850 if (NULL != src->atomtype)
852 snew(dst->atomtype, src->nr);
854 if (NULL != src->atomtypeB)
856 snew(dst->atomtypeB, src->nr);
858 for (i = 0; (i < src->nr); i++)
860 dst->atom[i] = src->atom[i];
861 if (NULL != src->pdbinfo)
863 dst->pdbinfo[i] = src->pdbinfo[i];
865 if (NULL != src->atomname)
867 dst->atomname[i] = src->atomname[i];
869 if (NULL != src->atomtype)
871 dst->atomtype[i] = src->atomtype[i];
873 if (NULL != src->atomtypeB)
875 dst->atomtypeB[i] = src->atomtypeB[i];
878 dst->nres = src->nres;
879 for (i = 0; (i < src->nres); i++)
881 dst->resinfo[i] = src->resinfo[i];
886 void t_atoms_set_resinfo(t_atoms *atoms, int atom_ind, t_symtab *symtab,
887 const char *resname, int resnr, unsigned char ic,
888 int chainnum, char chainid)
892 ri = &atoms->resinfo[atoms->atom[atom_ind].resind];
893 ri->name = put_symtab(symtab, resname);
897 ri->chainnum = chainnum;
898 ri->chainid = chainid;
901 void free_t_atoms(t_atoms *atoms, gmx_bool bFreeNames)
905 if (bFreeNames && atoms->atomname != NULL)
907 for (i = 0; i < atoms->nr; i++)
909 if (atoms->atomname[i] != NULL)
911 sfree(*atoms->atomname[i]);
912 *atoms->atomname[i] = NULL;
916 if (bFreeNames && atoms->resinfo != NULL)
918 for (i = 0; i < atoms->nres; i++)
920 if (atoms->resinfo[i].name != NULL)
922 sfree(*atoms->resinfo[i].name);
923 *atoms->resinfo[i].name = NULL;
927 if (bFreeNames && atoms->atomtype != NULL)
929 for (i = 0; i < atoms->nr; i++)
931 if (atoms->atomtype[i] != NULL)
933 sfree(*atoms->atomtype[i]);
934 *atoms->atomtype[i] = NULL;
938 if (bFreeNames && atoms->atomtypeB != NULL)
940 for (i = 0; i < atoms->nr; i++)
942 if (atoms->atomtypeB[i] != NULL)
944 sfree(*atoms->atomtypeB[i]);
945 *atoms->atomtypeB[i] = NULL;
949 sfree(atoms->atomname);
950 sfree(atoms->atomtype);
951 sfree(atoms->atomtypeB);
952 sfree(atoms->resinfo);
954 sfree(atoms->pdbinfo);
957 atoms->atomname = NULL;
958 atoms->atomtype = NULL;
959 atoms->atomtypeB = NULL;
960 atoms->resinfo = NULL;
962 atoms->pdbinfo = NULL;
965 real max_cutoff(real cutoff1, real cutoff2)
967 if (cutoff1 == 0 || cutoff2 == 0)
973 return max(cutoff1, cutoff2);
977 void init_df_history(df_history_t *dfhist, int nlambda)
981 dfhist->nlambda = nlambda;
983 dfhist->wl_delta = 0;
987 snew(dfhist->sum_weights, dfhist->nlambda);
988 snew(dfhist->sum_dg, dfhist->nlambda);
989 snew(dfhist->sum_minvar, dfhist->nlambda);
990 snew(dfhist->sum_variance, dfhist->nlambda);
991 snew(dfhist->n_at_lam, dfhist->nlambda);
992 snew(dfhist->wl_histo, dfhist->nlambda);
994 /* allocate transition matrices here */
995 snew(dfhist->Tij, dfhist->nlambda);
996 snew(dfhist->Tij_empirical, dfhist->nlambda);
998 /* allocate accumulators for various transition matrix
999 free energy methods here */
1000 snew(dfhist->accum_p, dfhist->nlambda);
1001 snew(dfhist->accum_m, dfhist->nlambda);
1002 snew(dfhist->accum_p2, dfhist->nlambda);
1003 snew(dfhist->accum_m2, dfhist->nlambda);
1005 for (i = 0; i < dfhist->nlambda; i++)
1007 snew(dfhist->Tij[i], dfhist->nlambda);
1008 snew(dfhist->Tij_empirical[i], dfhist->nlambda);
1009 snew((dfhist->accum_p)[i], dfhist->nlambda);
1010 snew((dfhist->accum_m)[i], dfhist->nlambda);
1011 snew((dfhist->accum_p2)[i], dfhist->nlambda);
1012 snew((dfhist->accum_m2)[i], dfhist->nlambda);
1017 extern void copy_df_history(df_history_t *df_dest, df_history_t *df_source)
1021 /* Currently, there should not be any difference in nlambda between the two,
1022 but this is included for completeness for potential later functionality */
1023 df_dest->nlambda = df_source->nlambda;
1024 df_dest->bEquil = df_source->bEquil;
1025 df_dest->wl_delta = df_source->wl_delta;
1027 for (i = 0; i < df_dest->nlambda; i++)
1029 df_dest->sum_weights[i] = df_source->sum_weights[i];
1030 df_dest->sum_dg[i] = df_source->sum_dg[i];
1031 df_dest->sum_minvar[i] = df_source->sum_minvar[i];
1032 df_dest->sum_variance[i] = df_source->sum_variance[i];
1033 df_dest->n_at_lam[i] = df_source->n_at_lam[i];
1034 df_dest->wl_histo[i] = df_source->wl_histo[i];
1037 for (i = 0; i < df_dest->nlambda; i++)
1039 for (j = 0; j < df_dest->nlambda; j++)
1041 df_dest->accum_p[i][j] = df_source->accum_p[i][j];
1042 df_dest->accum_m[i][j] = df_source->accum_m[i][j];
1043 df_dest->accum_p2[i][j] = df_source->accum_p2[i][j];
1044 df_dest->accum_m2[i][j] = df_source->accum_m2[i][j];
1045 df_dest->Tij[i][j] = df_source->Tij[i][j];
1046 df_dest->Tij_empirical[i][j] = df_source->Tij_empirical[i][j];
1051 void done_df_history(df_history_t *dfhist)
1055 if (dfhist->nlambda > 0)
1057 sfree(dfhist->n_at_lam);
1058 sfree(dfhist->wl_histo);
1059 sfree(dfhist->sum_weights);
1060 sfree(dfhist->sum_dg);
1061 sfree(dfhist->sum_minvar);
1062 sfree(dfhist->sum_variance);
1064 for (i = 0; i < dfhist->nlambda; i++)
1066 sfree(dfhist->Tij[i]);
1067 sfree(dfhist->Tij_empirical[i]);
1068 sfree(dfhist->accum_p[i]);
1069 sfree(dfhist->accum_m[i]);
1070 sfree(dfhist->accum_p2[i]);
1071 sfree(dfhist->accum_m2[i]);
1075 dfhist->nlambda = 0;
1076 dfhist->wl_delta = 0;