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
void get_structure(t_atoms *atoms,const char *IndexFile,
const char *StructureFile,struct edix *edx,int nfit,
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;
{
atom_id *igro; /*index corresponding to target or origin structure*/
int ngro;
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);
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*/
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[])
}
int main(int argc,char *argv[])
int nvec1,*eignr1=NULL;
rvec *xav1,**eigvec1=NULL;
t_atoms *atoms=NULL;
int nvec1,*eignr1=NULL;
rvec *xav1,**eigvec1=NULL;
t_atoms *atoms=NULL;
+ int nav; /* Number of atoms in the average structure */
char *grpname;
const char *indexfile;
int i;
atom_id *index,*ifit;
char *grpname;
const char *indexfile;
int i;
atom_id *index,*ifit;
+ 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 */
int ev_class; /* parameter _class i.e. evMON, evRADFIX etc. */
int nvecs;
real *eigval1=NULL; /* in V3.3 this is parameter of read_eigenvectors */
EigvecFile=opt2fn("-f",NFILE,fnm);
/*read eigenvectors from eigvec.trr*/
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),
&xref1,&edi_params.fitmas,&xav1,&edi_params.pcamas,&nvec1,&eignr1,&eigvec1,&eigval1);
bTop=read_tps_conf(ftp2fn(efTPS,NFILE,fnm),
- 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 */
get_index(atoms,indexfile,1,&i,&index,&grpname); /*if indexfile != NULL parameter 'atoms' is ignored */
gmx_fatal(FARGS,"you selected a group with %d elements instead of %d",
gmx_fatal(FARGS,"you selected a group with %d elements instead of %d",
/*number of system atoms */
edi_params.nini=atoms->nr;
/*store reference and average structure in edi_params*/
/*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 */
/* Store target positions in edi_params */
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");
}
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);
/* Store origin positions */
if (opt2bSet("-ori",NFILE,fnm))
{
/* 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);