From 5087c3884f51738b231389b9706a39cb551dbc17 Mon Sep 17 00:00:00 2001 From: Berk Hess Date: Mon, 23 Aug 2010 15:55:00 +0200 Subject: [PATCH] removed the pdb2gmx -cwd option and updated the pdb2gmx description --- include/pdb2top.h | 2 +- include/resall.h | 6 ++--- src/kernel/fflibutil.c | 4 +-- src/kernel/fflibutil.h | 5 ++-- src/kernel/g_x2top.c | 5 +--- src/kernel/g_x2top.h | 2 +- src/kernel/gen_vsite.c | 4 +-- src/kernel/gen_vsite.h | 2 +- src/kernel/genhydro.c | 8 +++--- src/kernel/h_db.c | 4 +-- src/kernel/h_db.h | 2 +- src/kernel/nm2type.c | 4 +-- src/kernel/pdb2gmx.c | 70 +++++++++++++++++++++++--------------------------- src/kernel/pdb2top.c | 4 +-- src/kernel/resall.c | 4 +-- src/kernel/ter_db.c | 4 +-- src/kernel/ter_db.h | 2 +- src/kernel/xlate.c | 4 +-- src/kernel/xlate.h | 2 +- 19 files changed, 64 insertions(+), 74 deletions(-) diff --git a/include/pdb2top.h b/include/pdb2top.h index 52463c6b9e..9cacc63c3c 100644 --- a/include/pdb2top.h +++ b/include/pdb2top.h @@ -109,7 +109,7 @@ void pdb2top(FILE *top_file, char *posre_fn, char *molname, int nterpairs, t_hackblock **ntdb, t_hackblock **ctdb, int *rn, int *rc, bool bAllowMissing, bool bVsites, bool bVsiteAromatics, - const char *ff, const char *ffdir, bool bAddCWD, + const char *ff, const char *ffdir, real mHmult, int nssbonds, t_ssbond ssbonds[], real long_bond_dist, real short_bond_dist, diff --git a/include/resall.h b/include/resall.h index fe535640b6..4349551b52 100644 --- a/include/resall.h +++ b/include/resall.h @@ -48,12 +48,12 @@ extern "C" { t_restp *search_rtp(const char *key,int nrtp,t_restp rtp[]); /* Search for an entry in the rtp database */ -gpp_atomtype_t read_atype(const char *ffdir,bool bAddCWD,t_symtab *tab); +gpp_atomtype_t read_atype(const char *ffdir,t_symtab *tab); /* read atom type database(s) */ void read_resall(char *resdb, int *nrtp,t_restp **rtp, - gpp_atomtype_t atype, t_symtab *tab, - bool bAllowOverrideRTP); + gpp_atomtype_t atype, t_symtab *tab, + bool bAllowOverrideRTP); /* read rtp database, append to the existing database */ void print_resall(FILE *out, int nrtp, t_restp rtp[], diff --git a/src/kernel/fflibutil.c b/src/kernel/fflibutil.c index c2dfa6fa93..8dc743f8c2 100644 --- a/src/kernel/fflibutil.c +++ b/src/kernel/fflibutil.c @@ -288,12 +288,12 @@ static int low_fflib_search_file_end(const char *ffdir, return n; } -int fflib_search_file_end(const char *ffdir,bool bAddCWD, +int fflib_search_file_end(const char *ffdir, const char *file_end, bool bFatalError, char ***filenames) { - return low_fflib_search_file_end(ffdir,bAddCWD,file_end,bFatalError, + return low_fflib_search_file_end(ffdir,FALSE,file_end,bFatalError, filenames,NULL); } diff --git a/src/kernel/fflibutil.h b/src/kernel/fflibutil.h index 51b396b5a9..7190e65ad7 100644 --- a/src/kernel/fflibutil.h +++ b/src/kernel/fflibutil.h @@ -62,13 +62,12 @@ extern void fflib_filename_base(const char *filename,char *filebase,int maxlen); * base should be at least of size maxlen. */ -extern int fflib_search_file_end(const char *ffdir,bool bAddCWD, +extern int fflib_search_file_end(const char *ffdir, const char *file_end, bool bFatalError, char ***filenames); /* Search for files ending on file_end in the force field directory fflib. - * fflib should be in the GROMACS lib.path or, when bAddCWD is set, - * in the current working directory. + * fflib should be in the GROMACS lib.path. * Return the number of files and the file names in filenames. */ diff --git a/src/kernel/g_x2top.c b/src/kernel/g_x2top.c index a6904dde4d..40232eb44f 100644 --- a/src/kernel/g_x2top.c +++ b/src/kernel/g_x2top.c @@ -422,7 +422,6 @@ int main(int argc, char *argv[]) { efRTP, "-r", "out", ffOPTWR } }; #define NFILE asize(fnm) - static bool bAddCWD = FALSE; static real scale = 1.1, kb = 4e5,kt = 400,kp = 5; static int nexcl = 3; static bool bRemoveDih = FALSE; @@ -434,8 +433,6 @@ int main(int argc, char *argv[]) t_pargs pa[] = { { "-ff", FALSE, etSTR, {&ff}, "Force field for your simulation. Type \"select\" for interactive selection." }, - { "-cwd", FALSE, etBOOL, {&bAddCWD}, - "Also read force field files from the current working directory" }, { "-v", FALSE, etBOOL, {&bVerbose}, "Generate verbose output in the top file." }, { "-nexcl", FALSE, etINT, {&nexcl}, @@ -503,7 +500,7 @@ int main(int argc, char *argv[]) read_stx_conf(opt2fn("-f",NFILE,fnm),title,atoms,x,NULL,&epbc,box); sprintf(n2t,"%s",ffdir); - nm2t = rd_nm2type(n2t,bAddCWD,&nnm); + nm2t = rd_nm2type(n2t,&nnm); if (nnm == 0) gmx_fatal(FARGS,"No or incorrect atomname2type.n2t file found (looking for %s)", n2t); diff --git a/src/kernel/g_x2top.h b/src/kernel/g_x2top.h index 52ccfca831..79cd43421d 100644 --- a/src/kernel/g_x2top.h +++ b/src/kernel/g_x2top.h @@ -47,7 +47,7 @@ typedef struct { double *blen; } t_nm2type; -extern t_nm2type *rd_nm2type(const char *ffdir,bool bAddCWD,int *nnm); +extern t_nm2type *rd_nm2type(const char *ffdir,int *nnm); /* Read the name 2 type database. nnm is the number of entries * ff is the force field. */ diff --git a/src/kernel/gen_vsite.c b/src/kernel/gen_vsite.c index ae23e27f21..6fa85aed3c 100644 --- a/src/kernel/gen_vsite.c +++ b/src/kernel/gen_vsite.c @@ -1332,7 +1332,7 @@ void do_vsites(int nrtp, t_restp rtp[], gpp_atomtype_t atype, t_atoms *at, t_symtab *symtab, rvec *x[], t_params plist[], int *vsite_type[], int *cgnr[], real mHmult, bool bVsiteAromatics, - const char *ffdir,bool bAddCWD) + const char *ffdir) { #define MAXATOMSPERRESIDUE 16 int i,j,k,m,i0,ni0,whatres,resind,add_shift,ftype,nvsite,nadd; @@ -1409,7 +1409,7 @@ void do_vsites(int nrtp, t_restp rtp[], gpp_atomtype_t atype, fprintf(debug,"# # # VSITES # # #\n"); } - ndb = fflib_search_file_end(ffdir,bAddCWD,".vsd",FALSE,&db); + ndb = fflib_search_file_end(ffdir,".vsd",FALSE,&db); nvsiteconf = 0; vsiteconflist = NULL; nvsitetop = 0; diff --git a/src/kernel/gen_vsite.h b/src/kernel/gen_vsite.h index 853067713b..c5e11ba8d2 100644 --- a/src/kernel/gen_vsite.h +++ b/src/kernel/gen_vsite.h @@ -47,7 +47,7 @@ extern void do_vsites(int nrtp, t_restp rtp[], gpp_atomtype_t atype, t_atoms *at, t_symtab *symtab, rvec *x[], t_params plist[], int *dummy_type[], int *cgnr[], real mHmult, bool bVSiteAromatics, - const char *ffdir,bool bAddCWD); + const char *ffdir); extern void do_h_mass(t_params *psb, int vsite_type[], t_atoms *at, real mHmult, bool bDeuterate); diff --git a/src/kernel/genhydro.c b/src/kernel/genhydro.c index eb0ff7d8f2..54b0586d75 100644 --- a/src/kernel/genhydro.c +++ b/src/kernel/genhydro.c @@ -640,13 +640,13 @@ int protonate(t_atoms **atomsptr,rvec **xptr,t_protonate *protdata) /* set forcefield to use: */ strcpy(protdata->FF,"ffgmx2"); /* get the databases: */ - protdata->nah=read_h_db(protdata->FF,FALSE,&protdata->ah); + protdata->nah = read_h_db(protdata->FF,&protdata->ah); open_symtab(&protdata->tab); - protdata->atype=read_atype(protdata->FF,FALSE,&protdata->tab); - nntdb = read_ter_db(protdata->FF,FALSE,'n',&protdata->ntdb,protdata->atype); + protdata->atype = read_atype(protdata->FF,&protdata->tab); + nntdb = read_ter_db(protdata->FF,'n',&protdata->ntdb,protdata->atype); if (nntdb < 1) gmx_fatal(FARGS,"no n-terminus db"); - nctdb = read_ter_db(protdata->FF,FALSE,'c',&protdata->ctdb,protdata->atype); + nctdb = read_ter_db(protdata->FF,'c',&protdata->ctdb,protdata->atype); if (nctdb < 1) gmx_fatal(FARGS,"no c-terminus db"); diff --git a/src/kernel/h_db.c b/src/kernel/h_db.c index f202bab9fd..26dae3625b 100644 --- a/src/kernel/h_db.c +++ b/src/kernel/h_db.c @@ -190,7 +190,7 @@ static void read_h_db_file(const char *hfn,int *nahptr,t_hackblock **ah) *ah = aah; } -int read_h_db(const char *ffdir,bool bAddCWD,t_hackblock **ah) +int read_h_db(const char *ffdir,t_hackblock **ah) { int nhdbf,f; char **hdbf; @@ -200,7 +200,7 @@ int read_h_db(const char *ffdir,bool bAddCWD,t_hackblock **ah) /* Read the hydrogen database file(s). * Do not generate an error when no files are found. */ - nhdbf = fflib_search_file_end(ffdir,bAddCWD,".hdb",FALSE,&hdbf); + nhdbf = fflib_search_file_end(ffdir,".hdb",FALSE,&hdbf); nah = 0; *ah = NULL; for(f=0; f.ff.", - "Note that pdb2gmx will also look for a [TT]forcefield.itp[tt] file", - "in such subdirectories in the current working directory.", + "pdb2gmx will search for force fields by looking for", + "a [TT]forcefield.itp[tt] file in subdirectories [TT].ff[tt]", + "of the current working directory and of the Gomracs library directory", + "as inferred from the path of the binary or the [TT]GMXLIB[tt] environment", + "variable.", + "By default the forcefield selection is interactive,", + "but you can use the [TT]-ff[tt] option to specify one of the short names", + "in the list on the command line instead. In that case pdb2gmx just looks", + "for the corresponding [TT].ff[tt] directory.", + "[PAR]", "After choosing a force field, all files will be read only from", - "the corresponding directory, unless the [TT]-cwd[tt] option is used.", + "the corresponding force field directory.", + "If you want to modify or add a residue types, you can copy the force", + "field directory from the Gromacs library directory to your current", + "working directory. If you want to add new protein residue types,", + "you will need to modify residuetypes.dat in the libary directory", + "or copy the whole library directory to a local directory and set", + "the environment variable [TT]GMXLIB[tt] to the name of that directory.", "Check chapter 5 of the manual for more information about file formats.", - "By default the forcefield selection is interactive,", - "but you can use the [TT]-ff[tt] option to specify", - "one of the short names above on the command line instead. In that", - "case pdb2gmx just looks for the corresponding file.[PAR]", + "[PAR]", "Note that a pdb file is nothing more than a file format, and it", "need not necessarily contain a protein structure. Every kind of", @@ -1054,7 +1052,7 @@ int main(int argc, char *argv[]) /* Command line arguments must be static */ - static bool bNewRTP=FALSE,bAddCWD=FALSE,bAllowOverrideRTP=FALSE; + static bool bNewRTP=FALSE; static bool bInter=FALSE, bCysMan=FALSE; static bool bLysMan=FALSE, bAspMan=FALSE, bGluMan=FALSE, bHisMan=FALSE; static bool bGlnMan=FALSE, bArgMan=FALSE; @@ -1072,10 +1070,6 @@ int main(int argc, char *argv[]) t_pargs pa[] = { { "-newrtp", FALSE, etBOOL, {&bNewRTP}, "HIDDENWrite the residue database in new format to 'new.rtp'"}, - { "-cwd", FALSE, etBOOL, {&bAddCWD}, - "Also read force field files from the current working directory" }, - { "-rtpo", FALSE, etBOOL, {&bAllowOverrideRTP}, - "Allow an entry in a local rtp file to override a library rtp entry"}, { "-lb", FALSE, etREAL, {&long_bond_dist}, "HIDDENLong bond warning distance" }, { "-sb", FALSE, etREAL, {&short_bond_dist}, @@ -1203,7 +1197,7 @@ int main(int argc, char *argv[]) gmx_residuetype_init(&rt); /* Read residue renaming database(s), if present */ - nrrn = fflib_search_file_end(ffdir,bAddCWD,".r2b",FALSE,&rrn); + nrrn = fflib_search_file_end(ffdir,".r2b",FALSE,&rrn); nrtprename = 0; rtprename = NULL; @@ -1439,15 +1433,15 @@ int main(int argc, char *argv[]) check_occupancy(&pdba_all,opt2fn("-f",NFILE,fnm),bVerbose); /* Read atomtypes... */ - atype = read_atype(ffdir,bAddCWD,&symtab); + atype = read_atype(ffdir,&symtab); /* read residue database */ printf("Reading residue database... (%s)\n",forcefield); - nrtpf = fflib_search_file_end(ffdir,bAddCWD,".rtp",TRUE,&rtpf); + nrtpf = fflib_search_file_end(ffdir,".rtp",TRUE,&rtpf); nrtp = 0; restp = NULL; for(i=0; interpairs,cc->ntdb,cc->ctdb,cc->r_start,cc->r_end,bAllowMissing, - bVsites,bVsiteAromatics,forcefield,ffdir,bAddCWD, + bVsites,bVsiteAromatics,forcefield,ffdir, mHmult,nssbonds,ssbonds, long_bond_dist,short_bond_dist,bDeuterate,bChargeGroups,bCmap, bRenumRes,bRTPresname); diff --git a/src/kernel/pdb2top.c b/src/kernel/pdb2top.c index 57e70be808..97b9dbdcfe 100644 --- a/src/kernel/pdb2top.c +++ b/src/kernel/pdb2top.c @@ -1290,7 +1290,7 @@ void pdb2top(FILE *top_file, char *posre_fn, char *molname, int nterpairs,t_hackblock **ntdb, t_hackblock **ctdb, int *rn, int *rc, bool bAllowMissing, bool bVsites, bool bVsiteAromatics, - const char *ff, const char *ffdir, bool bAddCWD, + const char *ff, const char *ffdir, real mHmult, int nssbonds, t_ssbond *ssbonds, real long_bond_dist, real short_bond_dist, @@ -1346,7 +1346,7 @@ void pdb2top(FILE *top_file, char *posre_fn, char *molname, /* determine which atoms will be vsites and add dummy masses also renumber atom numbers in plist[0..F_NRE]! */ do_vsites(nrtp, rtp, atype, atoms, tab, x, plist, - &vsite_type, &cgnr, mHmult, bVsiteAromatics, ffdir, bAddCWD); + &vsite_type, &cgnr, mHmult, bVsiteAromatics, ffdir); } /* Make Angles and Dihedrals */ diff --git a/src/kernel/resall.c b/src/kernel/resall.c index 6d7d74e946..96c7d3144c 100644 --- a/src/kernel/resall.c +++ b/src/kernel/resall.c @@ -50,7 +50,7 @@ #include "pgutil.h" #include "fflibutil.h" -gpp_atomtype_t read_atype(const char *ffdir,bool bAddCWD,t_symtab *tab) +gpp_atomtype_t read_atype(const char *ffdir,t_symtab *tab) { int nfile,f; char **file; @@ -62,7 +62,7 @@ gpp_atomtype_t read_atype(const char *ffdir,bool bAddCWD,t_symtab *tab) t_atom *a; t_param *nb; - nfile = fflib_search_file_end(ffdir,bAddCWD,".atp",TRUE,&file); + nfile = fflib_search_file_end(ffdir,".atp",TRUE,&file); at = init_atomtype(); snew(a,1); snew(nb,1); diff --git a/src/kernel/ter_db.c b/src/kernel/ter_db.c index 19cfff8cd1..a31924633e 100644 --- a/src/kernel/ter_db.c +++ b/src/kernel/ter_db.c @@ -313,7 +313,7 @@ static void read_ter_db_file(char *fn, *tbptr = tb; } -int read_ter_db(const char *ffdir,bool bAddCWD,char ter, +int read_ter_db(const char *ffdir,char ter, t_hackblock **tbptr,gpp_atomtype_t atype) { char ext[STRLEN]; @@ -326,7 +326,7 @@ int read_ter_db(const char *ffdir,bool bAddCWD,char ter, /* Search for termini database files. * Do not generate an error when none are found. */ - ntdbf = fflib_search_file_end(ffdir,bAddCWD,ext,FALSE,&tdbf); + ntdbf = fflib_search_file_end(ffdir,ext,FALSE,&tdbf); ntb = 0; *tbptr = NULL; for(f=0; f