1 /* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
11 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
12 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
13 * Copyright (c) 2001-2004, The GROMACS development team,
14 * check out http://www.gromacs.org for more information.
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version 2
19 * of the License, or (at your option) any later version.
21 * If you want to redistribute modifications, please consider that
22 * scientific software is very special. Version control is crucial -
23 * bugs must be traceable. We will be happy to consider code for
24 * inclusion in the official distribution, but derived work must not
25 * be called official GROMACS. Details are found in the README & COPYING
26 * files - if they are missing, get the official version at www.gromacs.org.
28 * To help us fund GROMACS development, we humbly ask that you cite
29 * the papers on the package - you can find them in the top README file.
31 * For more info, check our website at http://www.gromacs.org
34 * GROningen Mixture of Alchemy and Childrens' Stories
42 #include "gmx_fatal.h"
49 /* The source code in this file should be thread-safe.
50 Please keep it that way. */
52 /* This number should be increased whenever the file format changes! */
53 static const int enx_version = 5;
55 const char *enx_block_id_name[] = {
56 "Averaged orientation restraints",
57 "Instantaneous orientation restraints",
58 "Orientation restraint order tensor(s)",
59 "Distance restraints",
66 /* Stuff for reading pre 4.1 energy files */
68 bool bOldFileOpen; /* Is this an open old file? */
69 bool bReadFirstStep; /* Did we read the first step? */
70 int first_step; /* First step in the energy file */
71 int step_prev; /* Previous step */
72 int nsum_prev; /* Previous step sum length */
73 t_energy *ener_prev; /* Previous energy sums */
84 static void enxsubblock_init(t_enxsubblock *sb)
88 sb->type=xdr_datatype_double;
90 sb->type=xdr_datatype_float;
106 static void enxsubblock_free(t_enxsubblock *sb)
142 for(i=0;i<sb->sval_alloc;i++)
155 /* allocate the appropriate amount of memory for the given type and nr */
156 static void enxsubblock_alloc(t_enxsubblock *sb)
158 /* allocate the appropriate amount of memory */
161 case xdr_datatype_float:
162 if (sb->nr > sb->fval_alloc)
164 srenew(sb->fval, sb->nr);
165 sb->fval_alloc=sb->nr;
168 case xdr_datatype_double:
169 if (sb->nr > sb->dval_alloc)
171 srenew(sb->dval, sb->nr);
172 sb->dval_alloc=sb->nr;
175 case xdr_datatype_int:
176 if (sb->nr > sb->ival_alloc)
178 srenew(sb->ival, sb->nr);
179 sb->ival_alloc=sb->nr;
182 case xdr_datatype_large_int:
183 if (sb->nr > sb->lval_alloc)
185 srenew(sb->lval, sb->nr);
186 sb->lval_alloc=sb->nr;
189 case xdr_datatype_char:
190 if (sb->nr > sb->cval_alloc)
192 srenew(sb->cval, sb->nr);
193 sb->cval_alloc=sb->nr;
196 case xdr_datatype_string:
197 if (sb->nr > sb->sval_alloc)
201 srenew(sb->sval, sb->nr);
202 for(i=sb->sval_alloc;i<sb->nr;i++)
206 sb->sval_alloc=sb->nr;
210 gmx_incons("Unknown block type");
214 static void enxblock_init(t_enxblock *eb)
222 static void enxblock_free(t_enxblock *eb)
224 if (eb->nsub_alloc>0)
227 for(i=0;i<eb->nsub_alloc;i++)
229 enxsubblock_free(&(eb->sub[i]));
237 void init_enxframe(t_enxframe *fr)
253 void free_enxframe(t_enxframe *fr)
261 for(b=0; b<fr->nblock_alloc; b++)
263 enxblock_free(&(fr->block[b]));
268 void add_blocks_enxframe(t_enxframe *fr, int n)
271 if (n > fr->nblock_alloc)
275 srenew(fr->block, n);
276 for(b=fr->nblock_alloc;b<fr->nblock;b++)
278 enxblock_init(&(fr->block[b]));
284 t_enxblock *find_block_id_enxframe(t_enxframe *ef, int id, t_enxblock *prev)
291 starti=(prev - ef->block) + 1;
293 for(i=starti; i<ef->nblock; i++)
295 if (ef->block[i].id == id)
296 return &(ef->block[i]);
301 void add_subblocks_enxblock(t_enxblock *eb, int n)
304 if (eb->nsub > eb->nsub_alloc)
309 for(b=eb->nsub_alloc; b<n; b++)
311 enxsubblock_init(&(eb->sub[b]));
318 static void edr_strings(XDR *xdr,bool bRead,int file_version,
319 int n,gmx_enxnm_t **nms)
344 if(!xdr_string(xdr,&(nm->name),STRLEN))
346 gmx_file("Cannot write energy names to file; maybe you are out of quota?");
348 if (file_version >= 2)
350 if(!xdr_string(xdr,&(nm->unit),STRLEN))
352 gmx_file("Cannot write energy names to file; maybe you are out of quota?");
357 nm->unit = strdup("kJ/mol");
362 static void gen_units(int n,char ***units)
369 (*units)[i] = strdup("kJ/mol");
373 void do_enxnms(ener_file_t ef,int *nre,gmx_enxnm_t **nms)
377 bool bRead = gmx_fio_getread(ef->fio);
381 gmx_fio_checktype(ef->fio);
383 xdr = gmx_fio_getxdr(ef->fio);
385 if (!xdr_int(xdr,&magic))
389 gmx_file("Cannot write energy names to file; maybe you are out of quota?");
396 /* Assume this is an old edr format */
399 ef->eo.bOldFileOpen = TRUE;
400 ef->eo.bReadFirstStep = FALSE;
401 srenew(ef->eo.ener_prev,*nre);
405 ef->eo.bOldFileOpen=FALSE;
409 gmx_fatal(FARGS,"Energy names magic number mismatch, this is not a GROMACS edr file");
411 file_version = enx_version;
412 xdr_int(xdr,&file_version);
413 if (file_version > enx_version)
415 gmx_fatal(FARGS,"reading tpx file (%s) version %d with version %d program",gmx_fio_getname(ef->fio),file_version,enx_version);
419 if (file_version != enx_version)
421 fprintf(stderr,"Note: enx file_version %d, software version %d\n",
422 file_version,enx_version);
425 edr_strings(xdr,bRead,file_version,*nre,nms);
428 static bool do_eheader(ener_file_t ef,int *file_version,t_enxframe *fr,
429 int nre_test,bool *bWrongPrecision,bool *bOK)
433 int b,i,zero=0,dum=0;
434 bool bRead = gmx_fio_getread(ef->fio);
439 xdr_datatype dtreal=xdr_datatype_float;
441 xdr_datatype dtreal=xdr_datatype_double;
446 *bWrongPrecision = FALSE;
450 /* The original energy frame started with a real,
451 * so we have to use a real for compatibility.
452 * This is VERY DIRTY code, since do_eheader can be called
453 * with the wrong precision set and then we could read r > -1e10,
454 * while actually the intention was r < -1e10.
455 * When nre_test >= 0, do_eheader should therefore terminate
456 * before the number of i/o calls starts depending on what has been read
457 * (which is the case for for instance the block sizes for variable
458 * number of blocks, where this number is read before).
461 if (!gmx_fio_do_real(ef->fio, r))
467 /* Assume we are reading an old format */
470 if (!gmx_fio_do_int(ef->fio, dum)) *bOK = FALSE;
475 if (!gmx_fio_do_int(ef->fio, magic)) *bOK = FALSE;
476 if (magic != -7777777)
478 gmx_fatal(FARGS,"Energy header magic number mismatch, this is not a GROMACS edr file");
480 *file_version = enx_version;
481 if (!gmx_fio_do_int(ef->fio, *file_version)) *bOK = FALSE;
482 if (*bOK && *file_version > enx_version)
484 gmx_fatal(FARGS,"reading tpx file (%s) version %d with version %d program",gmx_fio_getname(ef->fio),file_version,enx_version);
486 if (!gmx_fio_do_double(ef->fio, fr->t)) *bOK = FALSE;
487 if (!gmx_fio_do_gmx_large_int(ef->fio, fr->step)) *bOK = FALSE;
488 if (!bRead && fr->nsum == 1) {
489 /* Do not store sums of length 1,
490 * since this does not add information.
492 if (!gmx_fio_do_int(ef->fio, zero)) *bOK = FALSE;
494 if (!gmx_fio_do_int(ef->fio, fr->nsum)) *bOK = FALSE;
496 if (*file_version >= 3)
498 if (!gmx_fio_do_gmx_large_int(ef->fio, fr->nsteps)) *bOK = FALSE;
502 fr->nsteps = max(1,fr->nsum);
504 if (*file_version >= 5)
506 if (!gmx_fio_do_double(ef->fio, fr->dt)) *bOK = FALSE;
513 if (!gmx_fio_do_int(ef->fio, fr->nre)) *bOK = FALSE;
514 if (*file_version < 4)
516 if (!gmx_fio_do_int(ef->fio, ndisre)) *bOK = FALSE;
520 /* now reserved for possible future use */
521 if (!gmx_fio_do_int(ef->fio, dum)) *bOK = FALSE;
524 if (!gmx_fio_do_int(ef->fio, fr->nblock)) *bOK = FALSE;
528 if (*file_version >= 4)
529 gmx_incons("Distance restraint blocks in old style in new style file");
534 /* Frames could have nre=0, so we can not rely only on the fr->nre check */
535 if (bRead && nre_test >= 0 &&
536 ((fr->nre > 0 && fr->nre != nre_test) ||
537 fr->nre < 0 || ndisre < 0 || fr->nblock < 0))
539 *bWrongPrecision = TRUE;
544 add_blocks_enxframe(fr, fr->nblock);
549 /* sub[0] is the instantaneous data, sub[1] is time averaged */
550 add_subblocks_enxblock(&(fr->block[0]), 2);
551 fr->block[0].id=enxDISRE;
552 fr->block[0].sub[0].nr=ndisre;
553 fr->block[0].sub[1].nr=ndisre;
554 fr->block[0].sub[0].type=dtreal;
555 fr->block[0].sub[1].type=dtreal;
559 /* read block header info */
560 for(b=startb; b<fr->nblock; b++)
564 /* blocks in old version files always have 1 subblock that
565 consists of reals. */
570 add_subblocks_enxblock(&(fr->block[b]), 1);
574 if (fr->block[b].nsub != 1)
575 gmx_incons("Writing an old version .edr file with too many subblocks");
576 if (fr->block[b].sub[0].type != dtreal)
578 gmx_incons("Writing an old version .edr file the wrong subblock type");
581 nrint = fr->block[b].sub[0].nr;
583 if (!gmx_fio_do_int(ef->fio, nrint))
587 fr->block[b].id = b - startb;
588 fr->block[b].sub[0].nr = nrint;
589 fr->block[b].sub[0].type = dtreal;
594 /* in the new version files, the block header only contains
595 the ID and the number of subblocks */
596 int nsub=fr->block[b].nsub;
597 *bOK = *bOK && gmx_fio_do_int(ef->fio, fr->block[b].id);
598 *bOK = *bOK && gmx_fio_do_int(ef->fio, nsub);
600 fr->block[b].nsub=nsub;
602 add_subblocks_enxblock(&(fr->block[b]), nsub);
604 /* read/write type & size for each subblock */
607 t_enxsubblock *sub=&(fr->block[b].sub[i]); /* shortcut */
608 int typenr=sub->type;
610 *bOK=*bOK && gmx_fio_do_int(ef->fio, typenr);
611 *bOK=*bOK && gmx_fio_do_int(ef->fio, sub->nr);
613 sub->type = (xdr_datatype)typenr;
617 if (!gmx_fio_do_int(ef->fio, fr->e_size)) *bOK = FALSE;
619 /* now reserved for possible future use */
620 if (!gmx_fio_do_int(ef->fio, dum)) *bOK = FALSE;
622 /* Do a dummy int to keep the format compatible with the old code */
623 if (!gmx_fio_do_int(ef->fio, dum)) *bOK = FALSE;
625 if (*bOK && *file_version == 1 && nre_test < 0)
628 if (fp >= ener_old_nalloc)
630 gmx_incons("Problem with reading old format energy files");
634 if (!ef->eo.bReadFirstStep)
636 ef->eo.bReadFirstStep = TRUE;
637 ef->eo.first_step = fr->step;
638 ef->eo.step_prev = fr->step;
639 ef->eo.nsum_prev = 0;
642 fr->nsum = fr->step - ef->eo.first_step + 1;
643 fr->nsteps = fr->step - ef->eo.step_prev;
650 void free_enxnms(int n,gmx_enxnm_t *nms)
663 void close_enx(ener_file_t ef)
665 if(gmx_fio_close(ef->fio) != 0)
667 gmx_file("Cannot close energy file; it might be corrupt, or maybe you are out of quota?");
671 static bool empty_file(const char *fn)
678 fp = gmx_fio_fopen(fn,"r");
679 ret = fread(&dum,sizeof(dum),1,fp);
687 ener_file_t open_enx(const char *fn,const char *mode)
690 gmx_enxnm_t *nms=NULL;
693 bool bWrongPrecision,bDum=TRUE;
694 struct ener_file *ef;
699 ef->fio=gmx_fio_open(fn,mode);
700 gmx_fio_checktype(ef->fio);
701 gmx_fio_setprecision(ef->fio,FALSE);
702 do_enxnms(ef,&nre,&nms);
704 do_eheader(ef,&file_version,fr,nre,&bWrongPrecision,&bDum);
707 gmx_file("Cannot read energy file header. Corrupt file?");
710 /* Now check whether this file is in single precision */
711 if (!bWrongPrecision &&
712 ((fr->e_size && (fr->nre == nre) &&
713 (nre*4*(long int)sizeof(float) == fr->e_size)) ) )
715 fprintf(stderr,"Opened %s as single precision energy file\n",fn);
716 free_enxnms(nre,nms);
720 gmx_fio_rewind(ef->fio);
721 gmx_fio_checktype(ef->fio);
722 gmx_fio_setprecision(ef->fio,TRUE);
723 do_enxnms(ef,&nre,&nms);
724 do_eheader(ef,&file_version,fr,nre,&bWrongPrecision,&bDum);
727 gmx_file("Cannot write energy file header; maybe you are out of quota?");
730 if (((fr->e_size && (fr->nre == nre) &&
731 (nre*4*(long int)sizeof(double) == fr->e_size)) ))
732 fprintf(stderr,"Opened %s as double precision energy file\n",
736 gmx_fatal(FARGS,"File %s is empty",fn);
738 gmx_fatal(FARGS,"Energy file %s not recognized, maybe different CPU?",
741 free_enxnms(nre,nms);
745 gmx_fio_rewind(ef->fio);
748 ef->fio = gmx_fio_open(fn,mode);
755 t_fileio *enx_file_pointer(const ener_file_t ef)
760 static void convert_full_sums(ener_old_t *ener_old,t_enxframe *fr)
764 double esum_all,eav_all;
770 for(i=0; i<fr->nre; i++)
772 if (fr->ener[i].e != 0) ne++;
773 if (fr->ener[i].esum != 0) ns++;
775 if (ne > 0 && ns == 0)
777 /* We do not have all energy sums */
782 /* Convert old full simulation sums to sums between energy frames */
783 nstep_all = fr->step - ener_old->first_step + 1;
784 if (fr->nsum > 1 && fr->nsum == nstep_all && ener_old->nsum_prev > 0)
786 /* Set the new sum length: the frame step difference */
787 fr->nsum = fr->step - ener_old->step_prev;
788 for(i=0; i<fr->nre; i++)
790 esum_all = fr->ener[i].esum;
791 eav_all = fr->ener[i].eav;
792 fr->ener[i].esum = esum_all - ener_old->ener_prev[i].esum;
793 fr->ener[i].eav = eav_all - ener_old->ener_prev[i].eav
794 - dsqr(ener_old->ener_prev[i].esum/(nstep_all - fr->nsum)
795 - esum_all/nstep_all)*
796 (nstep_all - fr->nsum)*nstep_all/(double)fr->nsum;
797 ener_old->ener_prev[i].esum = esum_all;
798 ener_old->ener_prev[i].eav = eav_all;
800 ener_old->nsum_prev = nstep_all;
802 else if (fr->nsum > 0)
804 if (fr->nsum != nstep_all)
806 fprintf(stderr,"\nWARNING: something is wrong with the energy sums, will not use exact averages\n");
807 ener_old->nsum_prev = 0;
811 ener_old->nsum_prev = nstep_all;
813 /* Copy all sums to ener_prev */
814 for(i=0; i<fr->nre; i++)
816 ener_old->ener_prev[i].esum = fr->ener[i].esum;
817 ener_old->ener_prev[i].eav = fr->ener[i].eav;
821 ener_old->step_prev = fr->step;
824 bool do_enx(ener_file_t ef,t_enxframe *fr)
828 bool bRead,bOK,bOK1,bSane;
834 bRead = gmx_fio_getread(ef->fio);
837 fr->e_size = fr->nre*sizeof(fr->ener[0].e)*4;
838 /*d_size = fr->ndisre*(sizeof(real)*2);*/
840 gmx_fio_checktype(ef->fio);
842 if (!do_eheader(ef,&file_version,fr,-1,NULL,&bOK))
846 fprintf(stderr,"\rLast energy frame read %d time %8.3f ",
847 ef->framenr-1,ef->frametime);
851 "\nWARNING: Incomplete energy frame: nr %d time %8.3f\n",
857 gmx_file("Cannot write energy file header; maybe you are out of quota?");
863 if ((ef->framenr < 20 || ef->framenr % 10 == 0) &&
864 (ef->framenr < 200 || ef->framenr % 100 == 0) &&
865 (ef->framenr < 2000 || ef->framenr % 1000 == 0))
867 fprintf(stderr,"\rReading energy frame %6d time %8.3f ",
871 ef->frametime = fr->t;
873 /* Check sanity of this header */
874 bSane = fr->nre > 0 ;
875 for(b=0; b<fr->nblock; b++)
877 bSane = bSane || (fr->block[b].nsub > 0);
879 if (!((fr->step >= 0) && bSane))
881 fprintf(stderr,"\nWARNING: there may be something wrong with energy file %s\n",
882 gmx_fio_getname(ef->fio));
883 fprintf(stderr,"Found: step=%s, nre=%d, nblock=%d, time=%g.\n"
884 "Trying to skip frame expect a crash though\n",
885 gmx_step_str(fr->step,buf),fr->nre,fr->nblock,fr->t);
887 if (bRead && fr->nre > fr->e_alloc)
889 srenew(fr->ener,fr->nre);
890 for(i=fr->e_alloc; (i<fr->nre); i++)
894 fr->ener[i].esum = 0;
896 fr->e_alloc = fr->nre;
899 for(i=0; i<fr->nre; i++)
901 bOK = bOK && gmx_fio_do_real(ef->fio, fr->ener[i].e);
903 /* Do not store sums of length 1,
904 * since this does not add information.
906 if (file_version == 1 ||
907 (bRead && fr->nsum > 0) || fr->nsum > 1)
909 tmp1 = fr->ener[i].eav;
910 bOK = bOK && gmx_fio_do_real(ef->fio, tmp1);
912 fr->ener[i].eav = tmp1;
914 /* This is to save only in single precision (unless compiled in DP) */
915 tmp2 = fr->ener[i].esum;
916 bOK = bOK && gmx_fio_do_real(ef->fio, tmp2);
918 fr->ener[i].esum = tmp2;
920 if (file_version == 1)
922 /* Old, unused real */
924 bOK = bOK && gmx_fio_do_real(ef->fio, rdum);
929 /* Here we can not check for file_version==1, since one could have
930 * continued an old format simulation with a new one with mdrun -append.
932 if (bRead && ef->eo.bOldFileOpen)
934 /* Convert old full simulation sums to sums between energy frames */
935 convert_full_sums(&(ef->eo),fr);
937 /* read the blocks */
938 for(b=0; b<fr->nblock; b++)
940 /* now read the subblocks. */
941 int nsub=fr->block[b].nsub; /* shortcut */
946 t_enxsubblock *sub=&(fr->block[b].sub[i]); /* shortcut */
950 enxsubblock_alloc(sub);
953 /* read/write data */
957 case xdr_datatype_float:
958 bOK1=gmx_fio_ndo_float(ef->fio, sub->fval, sub->nr);
960 case xdr_datatype_double:
961 bOK1=gmx_fio_ndo_double(ef->fio, sub->dval, sub->nr);
963 case xdr_datatype_int:
964 bOK1=gmx_fio_ndo_int(ef->fio, sub->ival, sub->nr);
966 case xdr_datatype_large_int:
967 bOK1=gmx_fio_ndo_gmx_large_int(ef->fio, sub->lval, sub->nr);
969 case xdr_datatype_char:
970 bOK1=gmx_fio_ndo_uchar(ef->fio, sub->cval, sub->nr);
972 case xdr_datatype_string:
973 bOK1=gmx_fio_ndo_string(ef->fio, sub->sval, sub->nr);
976 gmx_incons("Reading unknown block type");
984 if( gmx_fio_flush(ef->fio) != 0)
986 gmx_file("Cannot write energy file; maybe you are out of quota?");
994 fprintf(stderr,"\nLast energy frame read %d",
996 fprintf(stderr,"\nWARNING: Incomplete energy frame: nr %d time %8.3f\n",
1001 gmx_fatal(FARGS,"could not write energies");
1009 static real find_energy(const char *name, int nre, gmx_enxnm_t *enm,
1014 for(i=0; i<nre; i++)
1016 if (strcmp(enm[i].name,name) == 0)
1018 return fr->ener[i].e;
1022 gmx_fatal(FARGS,"Could not find energy term named '%s'",name);
1028 void get_enx_state(const char *fn, real t, gmx_groups_t *groups, t_inputrec *ir,
1031 /* Should match the names in mdebin.c */
1032 static const char *boxvel_nm[] = {
1033 "Box-Vel-XX", "Box-Vel-YY", "Box-Vel-ZZ",
1034 "Box-Vel-YX", "Box-Vel-ZX", "Box-Vel-ZY"
1037 static const char *pcouplmu_nm[] = {
1038 "Pcoupl-Mu-XX", "Pcoupl-Mu-YY", "Pcoupl-Mu-ZZ",
1039 "Pcoupl-Mu-YX", "Pcoupl-Mu-ZX", "Pcoupl-Mu-ZY"
1041 static const char *baro_nm[] = {
1046 int ind0[] = { XX,YY,ZZ,YY,ZZ,ZZ };
1047 int ind1[] = { XX,YY,ZZ,XX,XX,YY };
1048 int nre,nfr,i,j,ni,npcoupl;
1051 gmx_enxnm_t *enm=NULL;
1055 in = open_enx(fn,"r");
1056 do_enxnms(in,&nre,&enm);
1059 while ((nfr==0 || fr->t != t) && do_enx(in,fr)) {
1063 fprintf(stderr,"\n");
1065 if (nfr == 0 || fr->t != t)
1066 gmx_fatal(FARGS,"Could not find frame with time %f in '%s'",t,fn);
1068 npcoupl = TRICLINIC(ir->compress) ? 6 : 3;
1069 if (ir->epc == epcPARRINELLORAHMAN) {
1070 clear_mat(state->boxv);
1071 for(i=0; i<npcoupl; i++) {
1072 state->boxv[ind0[i]][ind1[i]] =
1073 find_energy(boxvel_nm[i],nre,enm,fr);
1075 fprintf(stderr,"\nREAD %d BOX VELOCITIES FROM %s\n\n",npcoupl,fn);
1078 if (ir->etc == etcNOSEHOOVER)
1080 for(i=0; i<state->ngtc; i++) {
1081 ni = groups->grps[egcTC].nm_ind[i];
1082 bufi = *(groups->grpname[ni]);
1083 for(j=0; (j<state->nhchainlength); j++)
1085 sprintf(buf,"Xi-%d-%s",j,bufi);
1086 state->nosehoover_xi[i] = find_energy(buf,nre,enm,fr);
1087 sprintf(buf,"vXi-%d-%s",j,bufi);
1088 state->nosehoover_vxi[i] = find_energy(buf,nre,enm,fr);
1092 fprintf(stderr,"\nREAD %d NOSE-HOOVER Xi chains FROM %s\n\n",state->ngtc,fn);
1094 if (IR_NPT_TROTTER(ir))
1096 for(i=0; i<state->nnhpres; i++) {
1097 bufi = baro_nm[0]; /* All barostat DOF's together for now */
1098 for(j=0; (j<state->nhchainlength); j++)
1100 sprintf(buf,"Xi-%d-%s",j,bufi);
1101 state->nhpres_xi[i] = find_energy(buf,nre,enm,fr);
1102 sprintf(buf,"vXi-%d-%s",j,bufi);
1103 state->nhpres_vxi[i] = find_energy(buf,nre,enm,fr);
1106 fprintf(stderr,"\nREAD %d NOSE-HOOVER BAROSTAT Xi chains FROM %s\n\n",state->nnhpres,fn);
1110 free_enxnms(nre,enm);