From: Carsten Kutzner Date: Mon, 6 Aug 2012 12:26:53 +0000 (+0200) Subject: Added comment in get_structure about which structures are included X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=6087e2515afbd4f81d9bb37a474830bb9f51451d;p=alexxy%2Fgromacs.git Added comment in get_structure about which structures are included This patch just adds a comment and refactors natoms -> nav to better clarify when we deal with the AVERAGE and when with the REFERENCE (fit) structure. 'natoms' is not a good choice if we are talking about the number of atoms in the average structure only. Change-Id: I7025fb6ea59af0a7bcd7953a25abd09be0dd2979 --- diff --git a/src/tools/make_edi.c b/src/tools/make_edi.c index 409fb4764c..d6f8d94663 100644 --- a/src/tools/make_edi.c +++ b/src/tools/make_edi.c @@ -441,7 +441,7 @@ void filter2edx(struct edix *edx,int nindex, atom_id index[],int ngro, void get_structure(t_atoms *atoms,const char *IndexFile, const char *StructureFile,struct edix *edx,int nfit, - atom_id ifit[],int natoms, atom_id index[]) + atom_id ifit[],int nav, atom_id index[]) { atom_id *igro; /*index corresponding to target or origin structure*/ int ngro; @@ -459,8 +459,10 @@ void get_structure(t_atoms *atoms,const char *IndexFile, gmx_fatal(FARGS,"You selected an index group with %d elements instead of %d",ngro,ntar); init_edx(edx); filter2edx(edx,nfit,ifit,ngro,igro,xtar,StructureFile); + + /* If average and reference/fitting structure differ, append the average structure as well */ if (ifit!=index) /*if fit structure is different append these coordinates, too -- don't mind duplicates*/ - filter2edx(edx,natoms,index,ngro,igro,xtar,StructureFile); + filter2edx(edx,nav,index,ngro,igro,xtar,StructureFile); } int main(int argc,char *argv[]) @@ -634,12 +636,12 @@ int main(int argc,char *argv[]) int nvec1,*eignr1=NULL; rvec *xav1,**eigvec1=NULL; t_atoms *atoms=NULL; - int natoms; + int nav; /* Number of atoms in the average structure */ char *grpname; const char *indexfile; int i; atom_id *index,*ifit; - int nfit; + int nfit; /* Number of atoms in the reference/fit structure */ int ev_class; /* parameter _class i.e. evMON, evRADFIX etc. */ int nvecs; real *eigval1=NULL; /* in V3.3 this is parameter of read_eigenvectors */ @@ -728,7 +730,7 @@ int main(int argc,char *argv[]) EigvecFile=opt2fn("-f",NFILE,fnm); /*read eigenvectors from eigvec.trr*/ - read_eigenvectors(EigvecFile,&natoms,&bFit1, + read_eigenvectors(EigvecFile,&nav,&bFit1, &xref1,&edi_params.fitmas,&xav1,&edi_params.pcamas,&nvec1,&eignr1,&eigvec1,&eigval1); bTop=read_tps_conf(ftp2fn(efTPS,NFILE,fnm), @@ -736,11 +738,11 @@ int main(int argc,char *argv[]) atoms=&top.atoms; - printf("\nSelect an index group of %d elements that corresponds to the eigenvectors\n",natoms); + printf("\nSelect an index group of %d elements that corresponds to the eigenvectors\n",nav); get_index(atoms,indexfile,1,&i,&index,&grpname); /*if indexfile != NULL parameter 'atoms' is ignored */ - if (i!=natoms) { + if (i!=nav) { gmx_fatal(FARGS,"you selected a group with %d elements instead of %d", - i,natoms); + i,nav); } printf("\n"); @@ -766,7 +768,7 @@ int main(int argc,char *argv[]) } else { - nfit=natoms; + nfit=nav; ifit=index; } @@ -802,15 +804,15 @@ int main(int argc,char *argv[]) } } - edi_params.ned=natoms; + edi_params.ned=nav; /*number of system atoms */ edi_params.nini=atoms->nr; /*store reference and average structure in edi_params*/ - make_t_edx(&edi_params.sref,nfit,xref1,ifit); - make_t_edx(&edi_params.sav,natoms,xav1,index); + make_t_edx(&edi_params.sref,nfit,xref1,ifit ); + make_t_edx(&edi_params.sav ,nav ,xav1 ,index); /* Store target positions in edi_params */ @@ -821,7 +823,7 @@ int main(int argc,char *argv[]) fprintf(stderr, "\nNote: Providing a TARGET structure has no effect when using flooding.\n" " You may want to use -ori to define the flooding potential center.\n\n"); } - get_structure(atoms,indexfile,TargetFile,&edi_params.star,nfit,ifit,natoms,index); + get_structure(atoms,indexfile,TargetFile,&edi_params.star,nfit,ifit,nav,index); } else { @@ -831,7 +833,7 @@ int main(int argc,char *argv[]) /* Store origin positions */ if (opt2bSet("-ori",NFILE,fnm)) { - get_structure(atoms,indexfile,OriginFile,&edi_params.sori,nfit,ifit,natoms,index); + get_structure(atoms,indexfile,OriginFile,&edi_params.sori,nfit,ifit,nav,index); } else {