Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

SimParameters.C

Go to the documentation of this file.
00001 
00007 /*****************************************************************************
00008  * $Source: /home/cvs/namd/cvsroot/namd2/src/SimParameters.C,v $
00009  * $Author: jim $
00010  * $Date: 2008/08/12 19:20:03 $
00011  * $Revision: 1.1258 $
00012  *****************************************************************************/
00013 
00020 #include "InfoStream.h"
00021 #include "ComputeNonbondedUtil.h"
00022 #include "ConfigList.h"
00023 #include "SimParameters.h"
00024 #include "ParseOptions.h"
00025 #include "structures.h"
00026 #include "Communicate.h"
00027 #include "MStream.h"
00028 #include <stdio.h>
00029 #include <time.h>
00030 #ifdef NAMD_FFTW
00031 #ifdef NAMD_FFTW_NO_TYPE_PREFIX
00032 #include <fftw.h>
00033 #include <rfftw.h>
00034 #else
00035 #include <sfftw.h>
00036 #include <srfftw.h>
00037 #endif
00038 #endif
00039 #if defined(WIN32) && !defined(__CYGWIN__)
00040 #include <direct.h>
00041 #define CHDIR _chdir
00042 #define PATHSEP '\\'
00043 #define PATHSEPSTR "\\"
00044 #else
00045 #include <unistd.h>
00046 #define CHDIR chdir
00047 #define PATHSEP '/'
00048 #define PATHSEPSTR "/"
00049 #endif
00050 #include <fstream>
00051 using namespace std;
00052 
00053 #ifdef WIN32
00054 extern "C" {
00055   double erfc(double);
00056 }
00057 #endif
00058 
00059 #include "strlib.h"    //  For strcasecmp and strncasecmp
00060 
00061 //#define DEBUGM
00062 #include "Debug.h"
00063 
00064 #define XXXBIGREAL 1.0e32
00065 
00066 /************************************************************************/
00067 /*                  */
00068 /*      FUNCTION initialize_config_data      */
00069 /*                  */
00070 /*  This function is used by the master process to populate the     */
00071 /*   simulation parameters from a ConfigList object that is passed to   */
00072 /*   it.  Each parameter is checked to make sure that it has a value    */
00073 /*   that makes sense, and that it doesn't conflict with any other      */
00074 /*   values that have been given.          */
00075 /*                  */
00076 /************************************************************************/
00077 
00078 void SimParameters::initialize_config_data(ConfigList *config, char *&cwd)
00079 
00080 {
00081 
00082    ParseOptions opts;   //  Object to check consistency of config file
00083 
00084    config_parser(opts);
00085 
00087    if (!opts.check_consistancy()) 
00088    {
00089       NAMD_die("Internal error in configuration file parser");
00090    }
00091 
00092    // Now, feed the object with the actual configuration options through the
00093    // ParseOptions file and make sure everything is OK
00094    if (!opts.set(*config)) 
00095    {
00096       NAMD_die("ERROR(S) IN THE CONFIGURATION FILE");
00097    }
00098 
00100 
00101    check_config(opts,config,cwd);
00102 
00103    print_config(opts,config,cwd);
00104 
00105 }
00106 
00107 /************************************************************************/
00108 /*                                                                      */
00109 /*      FUNCTION scriptSet                                              */
00110 /*                                                                      */
00111 /************************************************************************/
00112 
00113 int atobool(const char *s) {
00114   return ( (! strncasecmp(s,"yes",8)) ||
00115            (! strncasecmp(s,"on",8)) || 
00116            (! strncasecmp(s,"true",8)) );
00117 };
00118                          
00119 void SimParameters::scriptSet(const char *param, const char *value) {
00120 
00121 #define MAX_SCRIPT_PARAM_SIZE 128
00122 #define SCRIPT_PARSE_BOOL(NAME,VAR) { if ( ! strncasecmp(param,(NAME),MAX_SCRIPT_PARAM_SIZE) ) { (VAR) = atobool(value); return; } }
00123 #define SCRIPT_PARSE_INT(NAME,VAR) { if ( ! strncasecmp(param,(NAME),MAX_SCRIPT_PARAM_SIZE) ) { (VAR) = atoi(value); return; } }
00124 #define SCRIPT_PARSE_FLOAT(NAME,VAR) { if ( ! strncasecmp(param,(NAME),MAX_SCRIPT_PARAM_SIZE) ) { (VAR) = atof(value); return; } }
00125 #define SCRIPT_PARSE_MOD_FLOAT(NAME,VAR,MOD) { if ( ! strncasecmp(param,(NAME),MAX_SCRIPT_PARAM_SIZE) ) { (VAR) = atof(value) MOD; return; } }
00126 #define SCRIPT_PARSE_VECTOR(NAME,VAR) { if ( ! strncasecmp(param,(NAME),MAX_SCRIPT_PARAM_SIZE) ) { (VAR).set(value); return; } }
00127 #define SCRIPT_PARSE_STRING(NAME,VAR) { if ( ! strncasecmp(param,(NAME),MAX_SCRIPT_PARAM_SIZE) ) { strcpy(VAR,value); return; } }
00128 
00129   SCRIPT_PARSE_FLOAT("scriptArg1",scriptArg1)
00130   SCRIPT_PARSE_FLOAT("scriptArg2",scriptArg2)
00131   SCRIPT_PARSE_FLOAT("scriptArg3",scriptArg3)
00132   SCRIPT_PARSE_FLOAT("scriptArg4",scriptArg4)
00133   SCRIPT_PARSE_FLOAT("scriptArg5",scriptArg5)
00134   SCRIPT_PARSE_INT("numsteps",N)
00135   SCRIPT_PARSE_INT("firsttimestep",firstTimestep)
00136   SCRIPT_PARSE_FLOAT("reassignTemp",reassignTemp)
00137   SCRIPT_PARSE_FLOAT("rescaleTemp",rescaleTemp)
00138   // SCRIPT_PARSE_BOOL("Langevin",langevinOn)
00139   SCRIPT_PARSE_FLOAT("langevinTemp",langevinTemp)
00140   SCRIPT_PARSE_FLOAT("initialTemp",initialTemp)
00141   SCRIPT_PARSE_BOOL("useGroupPressure",useGroupPressure)
00142   SCRIPT_PARSE_BOOL("useFlexibleCell",useFlexibleCell)
00143   SCRIPT_PARSE_BOOL("useConstantArea",useConstantArea)
00144   SCRIPT_PARSE_BOOL("useConstantRatio",useConstantRatio)
00145   SCRIPT_PARSE_BOOL("LangevinPiston",langevinPistonOn)
00146   SCRIPT_PARSE_MOD_FLOAT("LangevinPistonTarget",
00147                         langevinPistonTarget,/PRESSUREFACTOR)
00148   SCRIPT_PARSE_FLOAT("LangevinPistonPeriod",langevinPistonPeriod)
00149   SCRIPT_PARSE_FLOAT("LangevinPistonDecay",langevinPistonDecay)
00150   SCRIPT_PARSE_FLOAT("LangevinPistonTemp",langevinPistonTemp)
00151   SCRIPT_PARSE_MOD_FLOAT("SurfaceTensionTarget",
00152                         surfaceTensionTarget,*(100.0/PRESSUREFACTOR))
00153   SCRIPT_PARSE_BOOL("BerendsenPressure",berendsenPressureOn)
00154   SCRIPT_PARSE_MOD_FLOAT("BerendsenPressureTarget",
00155                         berendsenPressureTarget,/PRESSUREFACTOR)
00156   SCRIPT_PARSE_MOD_FLOAT("BerendsenPressureCompressibility",
00157                         berendsenPressureCompressibility,*PRESSUREFACTOR)
00158   SCRIPT_PARSE_FLOAT("BerendsenPressureRelaxationTime",
00159                                 berendsenPressureRelaxationTime)
00160   SCRIPT_PARSE_FLOAT("constraintScaling",constraintScaling)
00161   SCRIPT_PARSE_FLOAT("consForceScaling",consForceScaling)
00162   SCRIPT_PARSE_STRING("outputname",outputFilename)
00163   SCRIPT_PARSE_STRING("tclBCArgs",tclBCArgs)
00164   SCRIPT_PARSE_VECTOR("eField",eField)
00165   SCRIPT_PARSE_FLOAT("eFieldFreq",eFieldFreq)
00166   SCRIPT_PARSE_FLOAT("eFieldPhase",eFieldPhase) 
00167   SCRIPT_PARSE_VECTOR("stirAxis",stirAxis)
00168   SCRIPT_PARSE_VECTOR("stirPivot",stirPivot)
00169   /* BEGIN gf */
00170   SCRIPT_PARSE_VECTOR("gridforcescale",gridforceScale)
00171   SCRIPT_PARSE_VECTOR("gridforcevoff",gridforceVOffset)
00172   /* END gf */
00173 
00174   if ( ! strncasecmp(param,"fixedatoms",MAX_SCRIPT_PARAM_SIZE) ) {
00175     if ( ! fixedAtomsOn )
00176       NAMD_die("FixedAtoms may not be enabled in a script.");
00177     if ( ! fixedAtomsForces )
00178       NAMD_die("To use fixedAtoms in script first use fixedAtomsForces yes.");
00179     fixedAtomsOn = atobool(value);
00180     return;
00181   }
00182 
00183 //Modifications for alchemical fep
00184 //SD & CC, CNRS - LCTN, Nancy
00185   SCRIPT_PARSE_INT("fepEquilSteps",fepEquilSteps)
00186 
00187   if ( ! strncasecmp(param,"lambda",MAX_SCRIPT_PARAM_SIZE) ) {
00188     lambda = atof(value);
00189     ComputeNonbondedUtil::select();
00190     return;
00191   }
00192 
00193   if ( ! strncasecmp(param,"lambda2",MAX_SCRIPT_PARAM_SIZE) ) {
00194     lambda2 = atof(value);
00195     ComputeNonbondedUtil::select();
00196     return;
00197   }
00198 //fepe
00199 
00200   if ( ! strncasecmp(param,"tiLambda",MAX_SCRIPT_PARAM_SIZE) ) {
00201     lambda = atof(value);
00202     ComputeNonbondedUtil::select();
00203     return;
00204   }
00205 
00206   if ( ! strncasecmp(param,"nonbondedScaling",MAX_SCRIPT_PARAM_SIZE) ) {
00207     nonbondedScaling = atof(value);
00208     ComputeNonbondedUtil::select();
00209     return;
00210   }
00211   if ( ! strncasecmp(param,"commOnly",MAX_SCRIPT_PARAM_SIZE) ) {
00212     commOnly = atobool(value);
00213     ComputeNonbondedUtil::select();
00214     return;
00215   }
00216 
00217   char *error = new char[2 * MAX_SCRIPT_PARAM_SIZE + 100];
00218   sprintf(error,"Setting parameter %s from script failed!\n",param);
00219   NAMD_die(error);
00220 
00221 }
00222 
00223 /************************************************************************/
00224 /*                                                                      */
00225 /*      FUNCTION config_parser                                          */
00226 /*                                                                      */
00227 /************************************************************************/
00228                          
00229 void SimParameters::config_parser(ParseOptions &opts) {
00230 
00231    //  Set all variable to fallback default values.  This is not really
00232    //  necessary, as we give default values when we set up the ParseOptions
00233    //  object, but it helps the debuggers figure out we've initialized the
00234    //  variables.
00235    HydrogenBonds = FALSE;
00236    useAntecedent = TRUE;
00237    aaAngleExp = 2;
00238    haAngleExp = 4;
00239    distAttExp = 4;
00240    distRepExp = 6;
00241    dhaCutoffAngle = 100.0;
00242    dhaOnAngle = 60.0;
00243    dhaOffAngle = 80.0;
00244    daCutoffDist = 7.5;
00245    daOnDist = 5.5;
00246    daOffDist = 6.5;
00247 
00248    config_parser_basic(opts);
00249    config_parser_fileio(opts);
00250    config_parser_fullelect(opts);
00251    config_parser_methods(opts);
00252    config_parser_constraints(opts);
00253    /* BEGIN gf */
00254    config_parser_gridforce(opts);
00255    /* END gf */
00256    config_parser_movdrag(opts);
00257    config_parser_rotdrag(opts);
00258    config_parser_constorque(opts);
00259    config_parser_boundary(opts);
00260    config_parser_misc(opts);
00261 
00262 }
00263 
00264 void SimParameters::config_parser_basic(ParseOptions &opts) {
00265    
00266    //  So first we set up the ParseOptions objects so that it will check
00267    //  all of the logical rules that the configuration file must follow.
00268 
00270    opts.require("main", "timestep", "size of the timestep, in fs",
00271     &dt, 1.0);
00272    opts.range("timestep", NOT_NEGATIVE);
00273    opts.units("timestep", N_FSEC);
00274 
00275    opts.optional("main", "numsteps", "number of timesteps to perform",
00276     &N,0);
00277    opts.range("numsteps", NOT_NEGATIVE);
00278 
00279    opts.optional("main", "stepspercycle",
00280       "Number of steps between atom migrations", 
00281       &stepsPerCycle, 20);
00282    opts.range("stepspercycle", POSITIVE);
00283 
00284    opts.require("main", "cutoff", "local electrostatic and Vdw distance", 
00285       &cutoff);
00286    opts.range("cutoff", POSITIVE);
00287    opts.units("cutoff", N_ANGSTROM);
00288    
00289    opts.optional("main", "nonbondedScaling", "nonbonded scaling factor",
00290      &nonbondedScaling, 1.0);
00291    opts.range("nonbondedScaling", NOT_NEGATIVE);
00292 
00293    opts.optional("main", "limitDist", "limit nonbonded below this distance",
00294      &limitDist, 0.0);
00295    opts.range("limitDist", NOT_NEGATIVE);
00296 
00297    opts.require("main", "exclude", "Electrostatic exclusion policy",
00298     PARSE_STRING);
00299 
00300    opts.optional("exclude", "1-4scaling", "1-4 electrostatic scaling factor",
00301      &scale14, 1.0);
00302    opts.range("1-4scaling", POSITIVE);
00303 
00304    opts.optionalB("main", "switching",
00305      "Should a smoothing function be used?", &switchingActive, TRUE);
00306    
00307    opts.optional("switching", "switchdist",
00308      "Distance for switching function activation",
00309      &switchingDist);
00310    opts.range("switchdist", POSITIVE);
00311    opts.units("switchdist", N_ANGSTROM);
00312 
00313    opts.optional("main", "pairlistdist",  "Pairlist inclusion distance",
00314      &pairlistDist);
00315    opts.range("pairlistdist", POSITIVE);
00316    opts.units("pairlistdist", N_ANGSTROM);
00317 
00318    opts.optional("main", "pairlistMinProcs",  "Min procs for pairlists",
00319      &pairlistMinProcs,1);
00320    opts.range("pairlistMinProcs", POSITIVE);
00321 
00322    opts.optional("main", "pairlistsPerCycle",  "regenerate x times per cycle",
00323      &pairlistsPerCycle,2);
00324    opts.range("pairlistsPerCycle", POSITIVE);
00325 
00326    opts.optional("main", "outputPairlists", "how often to print warnings",
00327      &outputPairlists, 0);
00328    opts.range("outputPairlists", NOT_NEGATIVE);
00329 
00330    opts.optional("main", "pairlistShrink",  "tol *= (1 - x) on regeneration",
00331      &pairlistShrink,0.01);
00332    opts.range("pairlistShrink", NOT_NEGATIVE);
00333 
00334    opts.optional("main", "pairlistGrow",  "tol *= (1 + x) on trigger",
00335      &pairlistGrow, 0.01);
00336    opts.range("pairlistGrow", NOT_NEGATIVE);
00337 
00338    opts.optional("main", "pairlistTrigger",  "trigger is atom > (1 - x) * tol",
00339      &pairlistTrigger, 0.3);
00340    opts.range("pairlistTrigger", NOT_NEGATIVE);
00341 
00342    opts.optional("main", "temperature", "initial temperature",
00343      &initialTemp);
00344    opts.range("temperature", NOT_NEGATIVE);
00345    opts.units("temperature", N_KELVIN);
00346 
00347    opts.optionalB("main", "COMmotion", "allow initial center of mass movement",
00348       &comMove, FALSE);
00349 
00350    opts.optionalB("main", "zeroMomentum", "constrain center of mass",
00351       &zeroMomentum, FALSE);
00352    opts.optionalB("zeroMomentum", "zeroMomentumAlt", "constrain center of mass",
00353       &zeroMomentumAlt, FALSE);
00354 
00355    opts.optionalB("main", "wrapWater", "wrap waters around periodic boundaries on output",
00356       &wrapWater, FALSE);
00357    opts.optionalB("main", "wrapAll", "wrap all clusters around periodic boundaries on output",
00358       &wrapAll, FALSE);
00359    opts.optionalB("main", "wrapNearest", "wrap to nearest image to cell origin",
00360       &wrapNearest, FALSE);
00361 
00362    opts.optional("main", "dielectric", "dielectric constant",
00363      &dielectric, 1.0);
00364    opts.range("dielectric", POSITIVE); // Hmmm, dielectric < 1 ...
00365 
00366    opts.optional("main", "margin", "Patch width margin", &margin, XXXBIGREAL);
00367    opts.range("margin", NOT_NEGATIVE);
00368    opts.units("margin", N_ANGSTROM);
00369 
00370    opts.optional("main", "seed", "Initial random number seed", &randomSeed);
00371    opts.range("seed", POSITIVE);
00372 
00373    opts.optional("main", "outputEnergies", "How often to print energies in timesteps",
00374      &outputEnergies, 1);
00375    opts.range("outputEnergies", POSITIVE);
00376      
00377    opts.optional("main", "outputMomenta", "How often to print linear and angular momenta in timesteps",
00378      &outputMomenta, 0);
00379    opts.range("outputMomenta", NOT_NEGATIVE);
00380      
00381    opts.optional("main", "outputTiming", "How often to print timing data in timesteps",
00382      &outputTiming);
00383    opts.range("outputTiming", NOT_NEGATIVE);
00384      
00385    opts.optional("main", "outputPressure", "How often to print pressure data in timesteps",
00386      &outputPressure, 0);
00387    opts.range("outputPressure", NOT_NEGATIVE);
00388      
00389    opts.optionalB("main", "mergeCrossterms", "merge crossterm energy with dihedral when printing?",
00390       &mergeCrossterms, TRUE);
00391 
00392    opts.optional("main", "MTSAlgorithm", "Multiple timestep algorithm",
00393     PARSE_STRING);
00394 
00395    opts.optional("main", "longSplitting", "Long range force splitting option",
00396     PARSE_STRING);
00397 
00398    opts.optional("main", "splitPatch", "Atom into patch splitting option",
00399     PARSE_STRING);
00400    opts.optional("main", "hgroupCutoff", "Hydrogen margin", &hgroupCutoff, 2.5);
00401 
00402    opts.optional("main", "extendedSystem",
00403     "Initial configuration of extended system variables and periodic cell",
00404     PARSE_STRING);
00405 
00406    opts.optional("main", "cellBasisVector1", "Basis vector for periodic cell",
00407     &cellBasisVector1);
00408    opts.optional("main", "cellBasisVector2", "Basis vector for periodic cell",
00409     &cellBasisVector2);
00410    opts.optional("main", "cellBasisVector3", "Basis vector for periodic cell",
00411     &cellBasisVector3);
00412    opts.optional("main", "cellOrigin", "Fixed center of periodic cell",
00413     &cellOrigin);
00414 
00415    opts.optionalB("main", "molly", "Rigid bonds to hydrogen",&mollyOn,FALSE);
00416    opts.optional("main", "mollyTolerance", "Error tolerance for MOLLY",
00417                  &mollyTol, 0.00001);
00418    opts.optional("main", "mollyIterations", 
00419                  "Max number of iterations for MOLLY", &mollyIter, 100);
00420 
00421    opts.optional("main", "rigidBonds", "Rigid bonds to hydrogen",PARSE_STRING);
00422    opts.optional("main", "rigidTolerance", 
00423                  "Error tolerance for rigid bonds to hydrogen",
00424                  &rigidTol, 1.0e-8);
00425    opts.optional("main", "rigidIterations", 
00426                  "Max number of SHAKE iterations for rigid bonds to hydrogen",
00427                  &rigidIter, 100);
00428    opts.optionalB("main", "rigidDieOnError", 
00429                  "Die if rigidTolerance is not achieved after rigidIterations",
00430                  &rigidDie, TRUE);
00431    opts.optionalB("main", "useSettle",
00432                   "Use the SETTLE algorithm for rigid waters",
00433                  &useSettle, TRUE);
00434 
00435    opts.optional("main", "nonbondedFreq", "Nonbonded evaluation frequency",
00436     &nonbondedFrequency, 1);
00437    opts.range("nonbondedFreq", POSITIVE);
00438 
00439    opts.optionalB("main", "outputPatchDetails", "print number of atoms in each patch",
00440       &outputPatchDetails, FALSE);
00441    opts.optional("main", "waterModel", "Water model to use", PARSE_STRING);
00442 }
00443 
00444 void SimParameters::config_parser_fileio(ParseOptions &opts) {
00445    
00447 
00448    opts.optional("main", "cwd", "current working directory", PARSE_STRING);
00449 
00450 // In order to include AMBER options, "coordinates", "structure"
00451 // and "parameters" are now optional, not required. The presence
00452 // of them will be checked later in check_config()
00453 
00454 //   opts.require("main", "coordinates", "initial PDB coordinate file",
00455 //    PARSE_STRING);
00456    opts.optional("main", "coordinates", "initial PDB coordinate file",
00457     PARSE_STRING);
00458 
00459    opts.optional("main", "velocities",
00460      "initial velocities, given as a PDB file", PARSE_STRING);
00461    opts.optional("main", "binvelocities",
00462      "initial velocities, given as a binary restart", PARSE_STRING);
00463    opts.optional("main", "bincoordinates",
00464      "initial coordinates in a binary restart file", PARSE_STRING);
00465 
00466 //   opts.require("main", "structure", "initial PSF structure file",
00467 //    PARSE_STRING);
00468    opts.optional("main", "structure", "initial PSF structure file",
00469     PARSE_STRING);
00470 
00471 //   opts.require("main", "parameters",
00472 //"CHARMm 19 or CHARMm 22 compatable force field file (multiple "
00473 //"inputs allowed)", PARSE_MULTIPLES);
00474    opts.optional("main", "parameters",
00475 "CHARMm 19 or CHARMm 22 compatable force field file (multiple "
00476 "inputs allowed)", PARSE_MULTIPLES);
00477 
00478 
00479    //****** BEGIN CHARMM/XPLOR type changes
00481    opts.optionalB("parameters", "paraTypeXplor", "Parameter file in Xplor format?", &paraTypeXplorOn, FALSE);
00482    opts.optionalB("parameters", "paraTypeCharmm", "Parameter file in Charmm format?", &paraTypeCharmmOn, FALSE); 
00483    //****** END CHARMM/XPLOR type changes
00484    
00485    opts.require("main", "outputname",
00486     "prefix for the final PDB position and velocity filenames", 
00487     outputFilename);
00488 
00489    opts.optional("main", "auxFile", "Filename for data stream output",
00490      auxFilename);
00491 
00492    opts.optional("main", "DCDfreq", "Frequency of DCD trajectory output, in "
00493     "timesteps", &dcdFrequency, 0);
00494    opts.range("DCDfreq", NOT_NEGATIVE);
00495    opts.optional("DCDfreq", "DCDfile", "DCD trajectory output file name",
00496      dcdFilename);
00497    opts.optionalB("DCDfreq", "DCDunitcell", "Store unit cell in dcd timesteps?",
00498        &dcdUnitCell);
00499 
00500    opts.optional("main", "velDCDfreq", "Frequency of velocity "
00501     "DCD output, in timesteps", &velDcdFrequency, 0);
00502    opts.range("velDCDfreq", NOT_NEGATIVE);
00503    opts.optional("velDCDfreq", "velDCDfile", "velocity DCD output file name",
00504      velDcdFilename);
00505    
00506    opts.optional("main", "XSTfreq", "Frequency of XST trajectory output, in "
00507     "timesteps", &xstFrequency, 0);
00508    opts.range("XSTfreq", NOT_NEGATIVE);
00509    opts.optional("XSTfreq", "XSTfile", "Extended sytem trajectory output "
00510     "file name", xstFilename);
00511 
00512    opts.optional("main", "restartfreq", "Frequency of restart file "
00513     "generation", &restartFrequency, 0);
00514    opts.range("restartfreq", NOT_NEGATIVE);
00515    opts.optional("restartfreq", "restartname", "Prefix for the position and "
00516      "velocity PDB files used for restarting", restartFilename);
00517    opts.optionalB("restartfreq", "restartsave", "Save restart files with "
00518      "unique filenames rather than overwriting", &restartSave, FALSE);
00519 
00520    opts.optionalB("restartfreq", "binaryrestart", "Specify use of binary restart files ", 
00521        &binaryRestart, TRUE);
00522 
00523    opts.optionalB("outputname", "binaryoutput", "Specify use of binary output files ", 
00524        &binaryOutput, TRUE);
00525 
00526    opts.optionalB("main", "amber", "Is it AMBER force field?",
00527        &amberOn, FALSE);
00528    opts.optionalB("amber", "readexclusions", "Read exclusions from parm file?",
00529        &readExclusions, TRUE);
00530    opts.require("amber", "scnb", "1-4 VDW interactions are divided by scnb",
00531        &vdwscale14, 2.0);
00532    opts.require("amber", "parmfile", "AMBER parm file", PARSE_STRING);
00533    opts.optional("amber", "ambercoor", "AMBER coordinate file", PARSE_STRING);
00534 
00535 //Modifications for alchemical fep
00536 //SD & CC, CNRS - LCTN, Nancy
00537 // begin fep output options    
00538    opts.optional("fep", "fepoutfreq", "Frequency of FEP energy output in "
00539      "timesteps", &fepOutFreq, 5);
00540    opts.range("fepoutfreq", NOT_NEGATIVE);
00541    opts.optional("fepoutfreq", "fepoutfile", "FEP energy output filename",
00542      fepOutFile);
00543 // end fep output options
00544 //fepe
00545 
00546    opts.optional("thermInt", "tioutfreq", "Frequency of TI energy output in "
00547      "timesteps", &tiOutFreq, 5);
00548    opts.range("tioutfreq", NOT_NEGATIVE);
00549    opts.optional("tioutfreq", "tioutfile", "TI energy output filename",
00550      tiOutFile);
00551 
00552 
00553    /* GROMACS options */
00554    opts.optionalB("main", "gromacs", "Use GROMACS-like force field?",
00555        &gromacsOn, FALSE);
00556    opts.require("gromacs", "grotopfile", "GROMACS topology file",
00557                 PARSE_STRING);
00558    opts.optional("gromacs", "grocoorfile","GROMACS coordinate file",
00559                  PARSE_STRING);
00560 
00561   // OPLS options
00562    opts.optionalB("main", "vdwGeometricSigma",
00563        "Use geometric mean to combine L-J sigmas, as for OPLS",
00564        &vdwGeometricSigma, FALSE);
00565 }
00566 
00567 
00568 void SimParameters::config_parser_fullelect(ParseOptions &opts) {
00569    
00571 #ifdef DPMTA
00572    DebugM(1,"DPMTA setup start\n");
00573    //  PMTA is included, so really get these values
00574    opts.optionalB("main", "FMA", "Should FMA be used?", &FMAOn, FALSE);
00575    opts.optional("FMA", "FMALevels", "Tree levels to use in FMA", &FMALevels,
00576      5);
00577    opts.range("FMALevels", POSITIVE);
00578    opts.optional("FMA", "FMAMp", "Number of FMA multipoles", &FMAMp, 8);
00579    opts.range("FMAMp", POSITIVE);
00580    opts.optionalB("FMA", "FMAFFT", "Use FFT enhancement in FMA?", &FMAFFTOn, TRUE);
00581    opts.optional("FMAFFT", "FMAFFTBlock", "FFT blocking factor",
00582     &FMAFFTBlock, 4);
00583    opts.range("FMAFFTBlock", POSITIVE);
00584    DebugM(1,"DPMTA setup end\n");
00585 #else
00586    //  PMTA is NOT included.  So just set all the values to 0.
00587    FMAOn = FALSE;
00588    FMALevels = 0;
00589    FMAMp = 0;
00590    FMAFFTOn = FALSE;
00591    FMAFFTBlock = 0;
00592 #endif
00593 
00594    opts.optional("main", "fullElectFrequency",
00595       "Number of steps between full electrostatic executions", 
00596       &fullElectFrequency);
00597    opts.range("fullElectFrequency", POSITIVE);
00598 
00599    //  USE OF THIS PARAMETER DISCOURAGED
00600    opts.optional("main", "fmaFrequency",
00601       "Number of steps between full electrostatic executions", 
00602       &fmaFrequency);
00603    opts.range("fmaFrequency", POSITIVE);
00604 
00605    opts.optional("main", "fmaTheta",
00606       "FMA theta parameter value", 
00607       &fmaTheta,0.715);
00608    opts.range("fmaTheta", POSITIVE);
00609 
00610    opts.optionalB("main", "FullDirect", "Should direct calculations of full electrostatics be performed?",
00611       &fullDirectOn, FALSE);
00612 
00613 
00615 
00616    opts.optionalB("main", "PME", "Use particle mesh Ewald for electrostatics?",
00617         &PMEOn, FALSE);
00618    opts.optional("PME", "PMETolerance", "PME direct space tolerance",
00619         &PMETolerance, 1.e-6);
00620    opts.optional("PME", "PMEInterpOrder", "PME interpolation order",
00621         &PMEInterpOrder, 4);  // cubic interpolation is default
00622    opts.optional("PME", "PMEGridSizeX", "PME grid in x dimension",
00623         &PMEGridSizeX, 0);
00624    opts.optional("PME", "PMEGridSizeY", "PME grid in y dimension",
00625         &PMEGridSizeY, 0);
00626    opts.optional("PME", "PMEGridSizeZ", "PME grid in z dimension",
00627         &PMEGridSizeZ, 0);
00628    opts.optional("PME", "PMEGridSpacing", "Maximum PME grid spacing (Angstroms)",
00629         &PMEGridSpacing, 0.);
00630    opts.range("PMEGridSpacing", NOT_NEGATIVE);
00631    opts.optional("PME", "PMEProcessors",
00632         "PME FFT and reciprocal sum processor count", &PMEProcessors, 0);
00633    opts.optional("PME", "PMEMinSlices",
00634         "minimum thickness of PME reciprocal sum slab", &PMEMinSlices, 2);
00635    opts.range("PMEMinSlices", NOT_NEGATIVE);
00636    opts.optional("PME", "PMEPencils",
00637         "PME FFT and reciprocal sum pencil grid size", &PMEPencils, -1);
00638    opts.optional("PME", "PMEMinPoints",
00639         "minimum points per PME reciprocal sum pencil", &PMEMinPoints, 10000);
00640    opts.range("PMEMinPoints", NOT_NEGATIVE);
00641    opts.optionalB("main", "PMEBarrier", "Use barrier in PME?",
00642         &PMEBarrier, FALSE);
00643 
00644 #ifdef DPME
00645    opts.optionalB("PME", "useDPME", "Use old DPME code?", &useDPME, FALSE);
00646 #else
00647    useDPME = 0;
00648 #endif
00649 
00650    opts.optionalB("main", "FFTWEstimate", "Use estimates to optimize FFTW?",
00651         &FFTWEstimate, FALSE);
00652    opts.optionalB("main", "FFTWUseWisdom", "Read/save wisdom file for FFTW?",
00653         &FFTWUseWisdom, TRUE);
00654    opts.optional("FFTWUseWisdom", "FFTWWisdomFile", "File for FFTW wisdom",
00655         FFTWWisdomFile);
00656 
00657 }
00658 
00659 void SimParameters::config_parser_methods(ParseOptions &opts) {
00660    
00662    opts.optionalB("main", "minimization", "Should minimization be performed?",
00663       &minimizeCGOn, FALSE);
00664    opts.optional("main", "minTinyStep", "very first minimization steps",
00665       &minTinyStep, 1.0e-6);
00666    opts.range("minTinyStep", POSITIVE);
00667    opts.optional("main", "minBabyStep", "initial minimization steps",
00668       &minBabyStep, 1.0e-2);
00669    opts.range("minBabyStep", POSITIVE);
00670    opts.optional("main", "minLineGoal", "line minimization gradient reduction",
00671       &minLineGoal, 1.0e-4);
00672    opts.range("minLineGoal", POSITIVE);
00673 
00674    opts.optionalB("main", "velocityQuenching",
00675       "Should old-style minimization be performed?", &minimizeOn, FALSE);
00676 
00677    opts.optional("main", "maximumMove", "Maximum atom movement per step", &maximumMove, 0.0);
00678    opts.range("maximumMove", NOT_NEGATIVE);
00679    opts.units("maximumMove", N_ANGSTROM);
00680 
00681    opts.optionalB("main", "Langevin", "Should Langevin dynamics be performed?",
00682       &langevinOn, FALSE);
00683    opts.require("Langevin", "langevinTemp", "Temperature for heat bath in Langevin "
00684      "dynamics", &langevinTemp);
00685    opts.range("langevinTemp", NOT_NEGATIVE);
00686    opts.units("langevinTemp", N_KELVIN);
00687    opts.optional("Langevin", "langevinDamping", "Damping coefficient (1/ps)",
00688       &langevinDamping);
00689    opts.range("langevinDamping", POSITIVE);
00690    opts.optionalB("Langevin", "langevinHydrogen", "Should Langevin dynamics be applied to hydrogen atoms?",
00691       &langevinHydrogen);
00692    opts.optional("Langevin", "langevinFile", "PDB file with temperature "
00693      "coupling terms (B(i)) (default is the PDB input file)",
00694      PARSE_STRING);
00695    opts.optional("Langevin", "langevinCol", "Column in the langevinFile "
00696      "containing the temperature coupling term B(i);\n"
00697      "default is 'O'", PARSE_STRING);
00698 
00699 //Modifications for alchemical fep
00700 //SD & CC, CNRS - LCTN, Nancy
00701 //  alchemical fep options
00702    opts.optionalB("main", "fep", "Is chemical fep being performed?",
00703      &fepOn, FALSE);
00704    opts.require("fep", "lambda", "Coupling parameter value", &lambda);
00705    opts.require("fep", "lambda2", "Coupling comparison value", &lambda2);
00706    opts.optional("fep", "fepFile", "PDB file with perturbation flags "
00707      "default is the input PDB file", PARSE_STRING); 
00708    opts.optional("fep", "fepCol", "Column in the fepFile with the "
00709      "perturbation flag", PARSE_STRING);
00710    opts.optional("fep", "fepEquilSteps", "Equilibration steps, before "
00711      "data collection in the fep window", &fepEquilSteps, 0);
00712    opts.range("fepEquilSteps", NOT_NEGATIVE);
00713    opts.optional("fep", "fepVdwShiftCoeff", "Coeff used for generating"
00714      "the altered FEP vDW interactions", &fepVdwShiftCoeff, 5.);
00715    opts.range("fepVdwShiftCoeff", NOT_NEGATIVE);
00716    
00717    opts.optional("fep", "fepElecLambdaStart", "Lambda at which to start"
00718       "electrostatics scaling", &fepElecLambdaStart, 0.5); 
00719    opts.range("fepElecLambdaStart", NOT_NEGATIVE);
00720    
00721    opts.optional("fep", "fepVdwLambdaEnd", "Lambda at which to end"
00722       "Vdw scaling", &fepVdwLambdaEnd, 0.5); 
00723    opts.range("fepVdwLambdaEnd", NOT_NEGATIVE);  
00724 // end FEP options
00725 //fepe
00726 
00727 // Modifications for TI
00728 // lots of duplication of FEP, we'd be better off without all this but 
00729 // keeping it in place for now for compatibility
00730    opts.optionalB("main", "thermInt", "Perform thermodynamic integration?",
00731      &thermInt, FALSE);
00732    opts.require("thermInt", "tilambda", "Coupling parameter value", &tiLambda);
00733    opts.optional("thermInt", "tiFile", "PDB file with perturbation flags "
00734      "default is the input PDB file", PARSE_STRING); 
00735    opts.optional("thermInt", "tiCol", "Column in the tiFile with the "
00736      "perturbation flag", PARSE_STRING);
00737    opts.optional("thermInt", "tiEquilSteps", "Equilibration steps, before "
00738      "data collection at each tiLambda value", &tiEquilSteps, 0);
00739    opts.range("tiEquilSteps", NOT_NEGATIVE);
00740    opts.optional("thermInt", "tiVdwShiftCoeff", "Coeff used for generating"
00741      "the altered alchemical vDW interactions", &tiVdwShiftCoeff, 5.);
00742    opts.range("tiVdwShiftCoeff", NOT_NEGATIVE);
00743    
00744    opts.optional("thermInt", "tiElecLambdaStart", "Lambda at which to start"
00745       "electrostatics scaling", &tiElecLambdaStart, 0.5); 
00746    opts.range("tiElecLambdaStart", NOT_NEGATIVE);
00747    
00748    opts.optional("thermInt", "tiVdwLambdaEnd", "Lambda at which to end"
00749       "Vdw scaling", &tiVdwLambdaEnd, 0.5); 
00750    opts.range("tiVdwLambdaEnd", NOT_NEGATIVE);  
00751 // end TI options
00752 
00753    opts.optionalB("main", "decouple", "Enable alchemical decoupling?",
00754      &decouple, FALSE);
00755 
00756    opts.optionalB("main", "les", "Is locally enhanced sampling enabled?",
00757      &lesOn, FALSE);
00758    opts.require("les", "lesFactor", "Local enhancement factor", &lesFactor);
00759    opts.optional("les", "lesFile", "PDB file with enhancement flags "
00760      "default is the input PDB file", PARSE_STRING); 
00761    opts.optional("les", "lesCol", "Column in the lesFile with the "
00762      "enhancement flag", PARSE_STRING);
00763    opts.optionalB("les", "lesReduceTemp", "Reduce enhanced atom temperature?",
00764      &lesReduceTemp, FALSE);
00765    opts.optionalB("les", "lesReduceMass", "Reduce enhanced atom mass?",
00766      &lesReduceMass, FALSE);
00767 
00768    // Pair interaction calculations
00769     opts.optionalB("main", "pairInteraction", 
00770         "Are pair interactions calculated?", &pairInteractionOn, FALSE);
00771     opts.optional("pairInteraction", "pairInteractionFile", 
00772         "PDB files with interaction flags " "default is the input PDB file", 
00773         PARSE_STRING);
00774     opts.optional("pairInteraction", "pairInteractionCol", 
00775         "Column in the pairInteractionFile with the interaction flags",
00776         PARSE_STRING);
00777     opts.require("pairInteraction", "pairInteractionGroup1",
00778         "Flag for interaction group 1", &pairInteractionGroup1);
00779     opts.optional("pairInteraction", "pairInteractionGroup2",
00780         "Flag for interaction group 2", &pairInteractionGroup2, -1);
00781     opts.optionalB("pairInteraction", "pairInteractionSelf",
00782         "Compute only within-group interactions?", &pairInteractionSelf, 
00783         FALSE);
00784    // Options for CG simulations
00785    opts.optionalB("main", "cosAngles", "Are some angles cosine-based?", &cosAngles, FALSE);
00786 
00787 
00788    //  Dihedral angle dynamics
00789    opts.optionalB("main", "globalTest", "Should global integration (for development) be used?",
00790     &globalOn, FALSE);
00791    opts.optionalB("main", "dihedral", "Should dihedral angle dynamics be performed?",
00792     &dihedralOn, FALSE);
00793    COLDOn = FALSE;
00794    opts.optionalB("dihedral", "COLD", "Should overdamped Langevin dynamics be performed?",
00795     &COLDOn, FALSE);
00796    opts.require("COLD", "COLDTemp", "Temperature for heat bath in COLD",
00797     &COLDTemp);
00798    opts.range("COLDTemp", NOT_NEGATIVE);
00799    opts.units("COLDTemp", N_KELVIN);
00800    opts.require("COLD", "COLDRate", "Damping rate for COLD",
00801     &COLDRate, 3000.0);
00802    opts.range("COLDRate", NOT_NEGATIVE);
00803 
00804    //  Get the parameters for temperature coupling
00805    opts.optionalB("main", "tcouple", 
00806       "Should temperature coupling be performed?",
00807       &tCoupleOn, FALSE);
00808    opts.require("tcouple", "tCoupleTemp", 
00809     "Temperature for temperature coupling", &tCoupleTemp);
00810    opts.range("tCoupleTemp", NOT_NEGATIVE);
00811    opts.units("tCoupleTemp", N_KELVIN);
00812    opts.optional("tCouple", "tCoupleFile", "PDB file with temperature "
00813      "coupling terms (B(i)) (default is the PDB input file)",
00814      PARSE_STRING);
00815    opts.optional("tCouple", "tCoupleCol", "Column in the tCoupleFile "
00816      "containing the temperature coupling term B(i);\n"
00817      "default is 'O'", PARSE_STRING);
00818 
00819    opts.optional("main", "rescaleFreq", "Number of steps between "
00820     "velocity rescaling", &rescaleFreq);
00821    opts.range("rescaleFreq", POSITIVE);
00822    opts.optional("main", "rescaleTemp", "Target temperature for velocity rescaling",
00823     &rescaleTemp);
00824    opts.range("rescaleTemp", NOT_NEGATIVE);
00825    opts.units("rescaleTemp", N_KELVIN);
00826 
00827    opts.optional("main", "reassignFreq", "Number of steps between "
00828     "velocity reassignment", &reassignFreq);
00829    opts.range("reassignFreq", POSITIVE);
00830    opts.optional("main", "reassignTemp", "Target temperature for velocity reassignment",
00831     &reassignTemp);
00832    opts.range("reassignTemp", NOT_NEGATIVE);
00833    opts.units("reassignTemp", N_KELVIN);
00834    opts.optional("main", "reassignIncr", "Temperature increment for velocity reassignment",
00835     &reassignIncr);
00836    opts.units("reassignIncr", N_KELVIN);
00837    opts.optional("main", "reassignHold", "Final holding temperature for velocity reassignment",
00838     &reassignHold);
00839    opts.range("reassignHold", NOT_NEGATIVE);
00840    opts.units("reassignHold", N_KELVIN);
00841 
00843    opts.optionalB("main", "useGroupPressure", 
00844       "Use group rather than atomic quantities for pressure control?",
00845       &useGroupPressure, FALSE);
00846 
00848    opts.optionalB("main", "useFlexibleCell",
00849       "Use anisotropic cell fluctuation for pressure control?",
00850       &useFlexibleCell, FALSE);
00851 
00853    opts.optionalB("main", "useConstantRatio",
00854       "Use constant X-Y ratio for pressure control?",
00855       &useConstantRatio, FALSE);
00856 
00858    opts.optionalB("main", "useConstantArea",
00859       "Use constant area for pressure control?",
00860       &useConstantArea, FALSE);
00861 
00863    opts.optionalB("main", "excludeFromPressure",
00864         "Should some atoms be excluded from pressure rescaling?",
00865         &excludeFromPressure, FALSE);
00866    opts.optional("excludeFromPressure", "excludeFromPressureFile",
00867         "PDB file for atoms to be excluded from pressure",
00868         PARSE_STRING);
00869    opts.optional("excludeFromPressure", "excludeFromPressureCol", 
00870         "Column in the excludeFromPressureFile"
00871         "containing the flags (nonzero means excluded);\n"
00872         "default is 'O'", PARSE_STRING);
00873 
00875    opts.optionalB("main", "BerendsenPressure", 
00876       "Should Berendsen pressure bath coupling be performed?",
00877       &berendsenPressureOn, FALSE);
00878    opts.require("BerendsenPressure", "BerendsenPressureTarget",
00879     "Target pressure for pressure coupling",
00880     &berendsenPressureTarget);
00881    // opts.units("BerendsenPressureTarget",);
00882    opts.require("BerendsenPressure", "BerendsenPressureCompressibility",
00883     "Isothermal compressibility for pressure coupling",
00884     &berendsenPressureCompressibility);
00885    // opts.units("BerendsenPressureCompressibility",);
00886    opts.require("BerendsenPressure", "BerendsenPressureRelaxationTime",
00887     "Relaxation time for pressure coupling",
00888     &berendsenPressureRelaxationTime);
00889    opts.range("BerendsenPressureRelaxationTime", POSITIVE);
00890    opts.units("BerendsenPressureRelaxationTime", N_FSEC);
00891    opts.optional("BerendsenPressure", "BerendsenPressureFreq",
00892     "Number of steps between volume rescaling",
00893     &berendsenPressureFreq, 1);
00894    opts.range("BerendsenPressureFreq", POSITIVE);
00895 
00897    opts.optionalB("main", "LangevinPiston",
00898       "Should Langevin piston pressure control be used?",
00899       &langevinPistonOn, FALSE);
00900    opts.require("LangevinPiston", "LangevinPistonTarget",
00901       "Target pressure for pressure control",
00902       &langevinPistonTarget);
00903    opts.require("LangevinPiston", "LangevinPistonPeriod",
00904       "Oscillation period for pressure control",
00905       &langevinPistonPeriod);
00906    opts.range("LangevinPistonPeriod", POSITIVE);
00907    opts.units("LangevinPistonPeriod", N_FSEC);
00908    opts.require("LangevinPiston", "LangevinPistonDecay",
00909       "Decay time for pressure control",
00910       &langevinPistonDecay);
00911    opts.range("LangevinPistonDecay", POSITIVE);
00912    opts.units("LangevinPistonDecay", N_FSEC);
00913    opts.require("LangevinPiston", "LangevinPistonTemp",
00914       "Temperature for pressure control piston",
00915       &langevinPistonTemp);
00916    opts.range("LangevinPistonTemp", POSITIVE);
00917    opts.units("LangevinPistonTemp", N_KELVIN);
00918    opts.optional("LangevinPiston", "StrainRate",
00919       "Initial strain rate for pressure control (x y z)",
00920       &strainRate);
00921 
00923    opts.optional("main", "SurfaceTensionTarget",
00924       "Surface tension in the x-y plane",
00925       &surfaceTensionTarget, 0);
00926 
00928    opts.optionalB("main", "pressureprofile", "Compute pressure profile?",
00929      &pressureProfileOn, FALSE);
00930    opts.require("pressureprofile", "pressureprofileslabs", 
00931      "Number of pressure profile slabs", &pressureProfileSlabs, 10);
00932    opts.optional("pressureprofile", "pressureprofilefreq",
00933      "How often to store profile data", &pressureProfileFreq, 1);
00934    opts.optional("pressureprofile", "pressureProfileAtomTypes", 
00935      "Number of pressure profile atom types", &pressureProfileAtomTypes, 1);
00936    opts.range("pressureProfileAtomTypes", POSITIVE);
00937    opts.optional("pressureProfile", "pressureProfileAtomTypesFile", 
00938         "PDB files with pressure profile atom types" "default is the input PDB file", 
00939         PARSE_STRING);
00940    opts.optional("pressureProfile", "pressureProfileAtomTypesCol", 
00941         "Column in the pressureProfileAtomTypesFile with the atom types ",
00942         PARSE_STRING);
00943    opts.optionalB("pressureProfile", "pressureProfileEwald", 
00944        "Compute Ewald contribution to pressure profile",
00945        &pressureProfileEwaldOn, FALSE);
00946    opts.optional("pressureProfile", "pressureProfileEwaldX",
00947        "Ewald grid size X", &pressureProfileEwaldX, 10);
00948    opts.range("pressureProfileEwaldX", POSITIVE);
00949    opts.optional("pressureProfile", "pressureProfileEwaldY",
00950        "Ewald grid size Y", &pressureProfileEwaldY, 10);
00951    opts.range("pressureProfileEwaldY", POSITIVE);
00952    opts.optional("pressureProfile", "pressureProfileEwaldZ",
00953        "Ewald grid size Z", &pressureProfileEwaldZ, 10);
00954    opts.range("pressureProfileEwaldZ", POSITIVE);
00955 }
00956 
00957 void SimParameters::config_parser_constraints(ParseOptions &opts) {
00958    
00960    opts.optionalB("main", "fixedatoms", "Are there fixed atoms?",
00961     &fixedAtomsOn, FALSE);
00962    opts.optionalB("fixedatoms", "fixedAtomsForces",
00963      "Calculate forces between fixed atoms?  (Required to unfix during run.)",
00964      &fixedAtomsForces, FALSE);
00965    opts.optional("fixedatoms", "fixedAtomsFile", "PDB file with flags for "
00966      "fixed atoms (default is the PDB input file)",
00967      PARSE_STRING);
00968    opts.optional("fixedatoms", "fixedAtomsCol", "Column in the fixedAtomsFile "
00969      "containing the flags (nonzero means fixed);\n"
00970      "default is 'O'", PARSE_STRING);
00971 
00973    opts.optionalB("main", "constraints", "Are harmonic constraints active?",
00974      &constraintsOn, FALSE);
00975    opts.require("constraints", "consexp", "Exponent for harmonic potential",
00976     &constraintExp, 2);
00977    opts.range("consexp", POSITIVE);
00978    opts.require("constraints", "consref", "PDB file containing reference "
00979     "positions",
00980     PARSE_STRING);
00981    opts.require("constraints", "conskfile", "PDB file containing force "
00982     "constaints in one of the columns", PARSE_STRING);
00983    opts.require("constraints", "conskcol", "Column of conskfile to use "
00984     "for the force constants", PARSE_STRING);
00985    opts.require("constraints", "constraintScaling", "constraint scaling factor",
00986      &constraintScaling, 1.0);
00987    opts.range("constraintScaling", NOT_NEGATIVE);
00988 
00989 
00990 
00991    //****** BEGIN selective restraints (X,Y,Z) changes
00992 
00994    opts.optionalB("constraints", "selectConstraints", 
00995    "Restrain only selected Cartesian components of the coordinates?",
00996      &selectConstraintsOn, FALSE);
00997    opts.optionalB("selectConstraints", "selectConstrX",  
00998    "Restrain X components of coordinates ", &constrXOn, FALSE);
00999    opts.optionalB("selectConstraints", "selectConstrY",  
01000    "Restrain Y components of coordinates ", &constrYOn, FALSE);
01001    opts.optionalB("selectConstraints", "selectConstrZ",  
01002    "Restrain Z components of coordinates ", &constrZOn, FALSE);
01003    //****** END selective restraints (X,Y,Z) changes
01004  
01005 
01006    //****** BEGIN moving constraints changes 
01007 
01009    opts.optionalB("constraints", "movingConstraints",
01010       "Are some of the constraints moving?", 
01011       &movingConstraintsOn, FALSE);
01012    opts.require("movingConstraints", "movingConsVel",
01013     "Velocity of the movement, A/timestep", &movingConsVel);
01014    //****** END moving constraints changes 
01015 
01016    // BEGIN rotating constraints changes
01017    opts.optionalB("constraints", "rotConstraints",
01018       "Are the constraints rotating?", 
01019       &rotConstraintsOn, FALSE);
01020    opts.require("rotConstraints", "rotConsAxis",
01021     "Axis of rotation", &rotConsAxis);
01022    opts.require("rotConstraints", "rotConsPivot",
01023     "Pivot point of rotation", 
01024     &rotConsPivot);
01025    opts.require("rotConstraints", "rotConsVel",
01026     "Velocity of rotation, deg/timestep", &rotConsVel);
01027 
01028    // END rotating constraints changes
01029 
01030    // external command forces
01031    opts.optionalB("main", "extForces", "External command forces?",
01032       &extForcesOn, FALSE);
01033    opts.require("extForces", "extForcesCommand",
01034       "External forces command", extForcesCommand);
01035    opts.require("extForces", "extCoordFilename",
01036       "External forces coordinate filename", extCoordFilename);
01037    opts.require("extForces", "extForceFilename",
01038       "External forces force filename", extForceFilename);
01039 
01040    //****** BEGIN SMD constraints changes 
01041 
01042    // SMD constraints
01043    opts.optionalB("main", "SMD",
01044       "Do we use SMD option?", 
01045       &SMDOn, FALSE);
01046    opts.require("SMD", "SMDVel",
01047                 "Velocity of the movement, A/timestep", &SMDVel);
01048    opts.range("SMDVel", NOT_NEGATIVE);
01049    opts.require("SMD", "SMDDir",
01050                 "Direction of movement", &SMDDir);
01051    opts.require("SMD", "SMDk",
01052                 "Elastic constant for SMD", &SMDk);
01053    opts.optional("SMD", "SMDk2",
01054                 "Transverse elastic constant for SMD", &SMDk2, 0);
01055    opts.range("SMDk", NOT_NEGATIVE);
01056    opts.range("SMDk2", NOT_NEGATIVE);
01057    opts.require("SMD", "SMDFile",
01058                 "File for SMD information",
01059                  SMDFile);
01060    opts.optional("SMD", "SMDOutputFreq",
01061                  "Frequency of output",
01062                  &SMDOutputFreq, 1);
01063    opts.range("SMDOutputFreq", POSITIVE);
01064    
01065    //****** END SMD constraints changes 
01066 
01067    // TMD parameters
01068    opts.optionalB("main", "TMD", "Perform Targeted MD?", &TMDOn, FALSE);
01069    opts.require("TMD", "TMDk", "Elastic constant for TMD", &TMDk);
01070    opts.range("TMDk", NOT_NEGATIVE);
01071    opts.require("TMD", "TMDFile", "File for TMD information", TMDFile);
01072    opts.optional("TMD", "TMDOutputFreq", "Frequency of TMD output", 
01073        &TMDOutputFreq, 1);
01074    opts.range("TMDOutputFreq", POSITIVE);
01075    opts.require("TMD", "TMDLastStep", "Last TMD timestep", &TMDLastStep);
01076    opts.range("TMDLastStep", POSITIVE);
01077    opts.optional("TMD", "TMDFirstStep", "First TMD step (default 0)", &TMDFirstStep, 0);
01078    opts.optional("TMD", "TMDInitialRMSD", "Target RMSD at first TMD step (default 0 to use initial coordinates)", &TMDInitialRMSD);
01079    opts.optional("TMD", "TMDFinalRMSD", "Target RMSD at last TMD step (default 0 )", &TMDFinalRMSD, 0);
01080    opts.range("TMDInitialRMSD", NOT_NEGATIVE);
01081 
01082    // End of TMD parameters
01083 
01085    opts.optionalB("main", "tclForces", "Are Tcl global forces active?",
01086      &tclForcesOn, FALSE);
01087    opts.require("tclForces", "tclForcesScript",
01088      "Tcl script for global forces", PARSE_MULTIPLES);
01089 
01091    opts.optionalB("main", "tclBC", "Are Tcl boundary forces active?",
01092      &tclBCOn, FALSE);
01093    opts.require("tclBC", "tclBCScript",
01094      "Tcl script defining calcforces for boundary forces", PARSE_STRING);
01095    tclBCScript = 0;
01096    opts.optional("tclBC", "tclBCArgs", "Extra args for calcforces command",
01097      tclBCArgs);
01098    tclBCArgs[0] = 0;
01099 
01101    opts.optionalB("main", "miscForces", "Are misc global forces active?",
01102      &miscForcesOn, FALSE);
01103    opts.optional("miscForces", "miscForcesScript",
01104      "script for misc forces", PARSE_MULTIPLES);
01105 
01107    opts.optionalB("main", "freeEnergy", "Perform free energy perturbation?",
01108      &freeEnergyOn, FALSE);
01109    opts.require("freeEnergy", "freeEnergyConfig",
01110      "Configuration file for free energy perturbation", PARSE_MULTIPLES);
01111 
01113    opts.optionalB("main", "constantforce", "Apply constant force?",
01114      &consForceOn, FALSE);
01115    opts.optional("constantforce", "consForceFile",
01116        "Configuration file for constant forces", PARSE_STRING);
01117    opts.require("constantforce", "consForceScaling",
01118        "Scaling factor for constant forces", &consForceScaling, 1.0);
01119 }
01120 
01121 
01122 /* BEGIN gf */
01123 void SimParameters::config_parser_gridforce(ParseOptions &opts) {
01125     opts.optionalB("main", "gridforce", "Is Gridforce active?", 
01126                    &gridforceOn, FALSE);
01127     opts.optionalB("gridforce", "gridforcevolts", "Is Gridforce using Volts/eV as units?",
01128                    &gridforceVolts, FALSE);
01129     opts.require("gridforce", "gridforcescale", "Scale factor by which to multiply "
01130                  "grid forces", &gridforceScale);
01131     opts.require("gridforce", "gridforcefile", "PDB file containing force "
01132                  "multipliers in one of the columns", PARSE_STRING);
01133     opts.require("gridforce", "gridforcecol", "Column of gridforcefile to "
01134                  "use for force multiplier", PARSE_STRING);
01135     opts.optional("gridforce", "gridforceqcol", "Column of gridforcefile to "
01136                   "use for charge", PARSE_STRING);
01137     opts.require("gridforce", "gridforcevfile", "Gridforce potential file",
01138                  PARSE_STRING);
01139     opts.optionalB("gridforce", "gridforcecont1", "Use continuous grid "
01140                    "in A1 direction?", &gridforceContA1, FALSE);
01141     opts.optionalB("gridforce", "gridforcecont2", "Use continuous grid "
01142                    "in A2 direction?", &gridforceContA2, FALSE);
01143     opts.optionalB("gridforce", "gridforcecont3", "Use continuous grid "
01144                    "in A3 direction?", &gridforceContA3, FALSE);
01145     opts.optional("gridforce", "gridforcevoff", "Gridforce potential offsets",
01146                   &gridforceVOffset);
01147 }
01148 /* END gf */
01149 
01150 
01151 
01152 void SimParameters::config_parser_movdrag(ParseOptions &opts) {
01154    opts.optionalB("main", "movDragOn", "Do we apply moving drag?",
01155       &movDragOn, FALSE);
01156    opts.require("movDragOn", "movDragFile",
01157       "Main moving drag PDB file", movDragFile);
01158    opts.require("movDragOn", "movDragCol",
01159       "Main moving drag PDB column", PARSE_STRING);
01160    opts.require("movDragOn", "movDragGlobVel",
01161       "Global moving drag velocity (A/step)", &movDragGlobVel);
01162    opts.require("movDragOn", "movDragVelFile",
01163       "Moving drag linear velocity file", movDragVelFile);
01164 }
01165 
01166 void SimParameters::config_parser_rotdrag(ParseOptions &opts) {
01168    opts.optionalB("main", "rotDragOn", "Do we apply rotating drag?",
01169       &rotDragOn, FALSE);
01170    opts.require("rotDragOn", "rotDragFile",
01171       "Main rotating drag PDB file", rotDragFile);
01172    opts.require("rotDragOn", "rotDragCol",
01173       "Main rotating drag PDB column", PARSE_STRING);
01174    opts.require("rotDragOn", "rotDragAxisFile",
01175       "Rotating drag axis file", rotDragAxisFile);
01176    opts.require("rotDragOn", "rotDragPivotFile",
01177       "Rotating drag pivot point file", rotDragPivotFile);
01178    opts.require("rotDragOn", "rotDragGlobVel",
01179       "Global rotating drag angular velocity (deg/step)", &rotDragGlobVel);
01180    opts.require("rotDragOn", "rotDragVelFile",
01181       "Rotating drag angular velocity file", rotDragVelFile);
01182    opts.require("rotDragOn", "rotDragVelCol",
01183       "Rotating drag angular velocity column", PARSE_STRING);
01184 }
01185 
01186 void SimParameters::config_parser_constorque(ParseOptions &opts) {
01188    opts.optionalB("main", "consTorqueOn", "Do we apply \"constant\" torque?",
01189       &consTorqueOn, FALSE);
01190    opts.require("consTorqueOn", "consTorqueFile",
01191       "Main \"constant\" torque PDB file", consTorqueFile);
01192    opts.require("consTorqueOn", "consTorqueCol",
01193       "Main \"constant\" torque PDB column", PARSE_STRING);
01194    opts.require("consTorqueOn", "consTorqueAxisFile",
01195       "\"Constant\" torque axis file", consTorqueAxisFile);
01196    opts.require("consTorqueOn", "consTorquePivotFile",
01197       "\"Constant\" torque pivot point file", consTorquePivotFile);
01198    opts.require("consTorqueOn", "consTorqueGlobVal",
01199       "Global \"constant\" torque value (Kcal/(mol*A^2))", &consTorqueGlobVal);
01200    opts.require("consTorqueOn", "consTorqueValFile",
01201       "\"constant\" torque factors file", consTorqueValFile);
01202    opts.require("consTorqueOn", "consTorqueValCol",
01203       "\"constant\" torque factors column", PARSE_STRING);
01204 }
01205 
01206 void SimParameters::config_parser_boundary(ParseOptions &opts) {
01207     
01209    opts.optionalB("main", "sphericalBC", "Are spherical boundary counditions "
01210       "active?", &sphericalBCOn, FALSE);
01211    opts.require("sphericalBC", "sphericalBCCenter",
01212      "Center of spherical boundaries", &sphericalCenter);
01213    opts.require("sphericalBC", "sphericalBCr1", "Radius for first sphere "
01214      "potential", &sphericalBCr1);
01215    opts.range("sphericalBCr1", POSITIVE);
01216    opts.units("sphe