NAMD
SimParameters.C
Go to the documentation of this file.
1 
7 /*****************************************************************************
8  * $Source: /home/cvs/namd/cvsroot/namd2/src/SimParameters.C,v $
9  * $Author: jim $
10  * $Date: 2017/03/30 20:06:17 $
11  * $Revision: 1.1478 $
12  *****************************************************************************/
13 
20 #include "InfoStream.h"
21 #include "ComputeNonbondedUtil.h"
22 #include "LJTable.h"
23 #include "ComputePme.h"
24 #include "ComputeCUDAMgr.h"
25 #include "ConfigList.h"
26 #include "SimParameters.h"
27 #include "ParseOptions.h"
28 #include "structures.h"
29 #include "Communicate.h"
30 #include "MStream.h"
31 #include "Output.h"
32 #include <stdio.h>
33 #include <time.h>
34 #ifdef NAMD_FFTW
35 #ifdef NAMD_FFTW_3
36 #include <fftw3.h>
37 #else
38 // fftw2 doesn't have these defined
39 #define fftwf_malloc fftw_malloc
40 #define fftwf_free fftw_free
41 #ifdef NAMD_FFTW_NO_TYPE_PREFIX
42 #include <fftw.h>
43 #include <rfftw.h>
44 #else
45 #include <sfftw.h>
46 #include <srfftw.h>
47 #endif
48 #endif
49 #endif
50 #if defined(WIN32) && !defined(__CYGWIN__)
51 #include <direct.h>
52 #define CHDIR _chdir
53 #define MKDIR(X) mkdir(X)
54 #define PATHSEP '\\'
55 #define PATHSEPSTR "\\"
56 #else
57 #include <unistd.h>
58 #define CHDIR chdir
59 #define MKDIR(X) mkdir(X,0777)
60 #define PATHSEP '/'
61 #define PATHSEPSTR "/"
62 #endif
63 #include <fcntl.h>
64 #include <sys/stat.h>
65 #ifdef WIN32
66 #include <io.h>
67 #define access(PATH,MODE) _access(PATH,00)
68 #endif
69 #include <fstream>
70 using namespace std;
71 
72 #ifdef WIN32
73 extern "C" {
74  double erfc(double);
75 }
76 #endif
77 
78 #include "strlib.h" // For strcasecmp and strncasecmp
79 
81 
82 //#ifdef NAMD_CUDA
83 //bool one_cuda_device_per_node();
84 //#endif
85 #include "DeviceCUDA.h"
86 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
87 #ifdef WIN32
88 #define __thread __declspec(thread)
89 #endif
90 extern __thread DeviceCUDA *deviceCUDA;
91 #endif
92 
93 #ifdef NAMD_AVXTILES
94 // For "+notiles" commandline option to disable "Tiles" algorithm (BackEnd.C)
95 extern int avxTilesCommandLineDisable;
96 #endif
97 
98 //#define DEBUGM
99 #include "Debug.h"
100 
101 #define XXXBIGREAL 1.0e32
102 
103 
104 char* SimParameters::getfromparseopts(const char* name, char *outbuf) {
105  if ( parseopts ) return parseopts->getfromptr(name,outbuf);
106  else return 0;
107 }
108 
109 int SimParameters::istrueinparseopts(const char* name) {
110  if ( parseopts ) return parseopts->istruefromptr(name);
111  else return -1;
112 }
113 
114 int SimParameters::issetinparseopts(const char* name) {
115  if ( parseopts ) return parseopts->issetfromptr(name);
116  else return -1;
117 }
118 
119 
120 /************************************************************************/
121 /* */
122 /* FUNCTION initialize_config_data */
123 /* */
124 /* This function is used by the master process to populate the */
125 /* simulation parameters from a ConfigList object that is passed to */
126 /* it. Each parameter is checked to make sure that it has a value */
127 /* that makes sense, and that it doesn't conflict with any other */
128 /* values that have been given. */
129 /* */
130 /************************************************************************/
131 
133 
134 {
135 
136  parseopts = new ParseOptions; // Object to check consistency of config file
137  ParseOptions &opts = *parseopts;
138 
139  config_parser(opts);
140 
142  if (!opts.check_consistency())
143  {
144  NAMD_die("Internal error in configuration file parser");
145  }
146 
147  // Now, feed the object with the actual configuration options through the
148  // ParseOptions file and make sure everything is OK
149  if (!opts.set(*config))
150  {
151  NAMD_die("ERROR(S) IN THE CONFIGURATION FILE");
152  }
153 
155 
156  check_config(opts,config,cwd);
157 
158  print_config(opts,config,cwd);
159 
160 }
161 
162 /************************************************************************/
163 /* */
164 /* FUNCTION scriptSet */
165 /* */
166 /************************************************************************/
167 
168 int atobool(const char *s) {
169  return ( (! strncasecmp(s,"yes",8)) ||
170  (! strncasecmp(s,"on",8)) ||
171  (! strncasecmp(s,"true",8)) );
172 };
173 
174 void SimParameters::scriptSet(const char *param, const char *value) {
175 
176  if ( CkMyRank() ) return;
177 
178 #define MAX_SCRIPT_PARAM_SIZE 128
179 #define SCRIPT_PARSE_BOOL(NAME,VAR) { if ( ! strncasecmp(param,(NAME),MAX_SCRIPT_PARAM_SIZE) ) { (VAR) = atobool(value); return; } }
180 #define SCRIPT_PARSE_INT(NAME,VAR) { if ( ! strncasecmp(param,(NAME),MAX_SCRIPT_PARAM_SIZE) ) { (VAR) = atoi(value); return; } }
181 #define SCRIPT_PARSE_FLOAT(NAME,VAR) { if ( ! strncasecmp(param,(NAME),MAX_SCRIPT_PARAM_SIZE) ) { (VAR) = atof(value); return; } }
182 #define SCRIPT_PARSE_MOD_FLOAT(NAME,VAR,MOD) { if ( ! strncasecmp(param,(NAME),MAX_SCRIPT_PARAM_SIZE) ) { (VAR) = atof(value) MOD; return; } }
183 #define SCRIPT_PARSE_VECTOR(NAME,VAR) { if ( ! strncasecmp(param,(NAME),MAX_SCRIPT_PARAM_SIZE) ) { (VAR).set(value); return; } }
184 #define SCRIPT_PARSE_STRING(NAME,VAR) { if ( ! strncasecmp(param,(NAME),MAX_SCRIPT_PARAM_SIZE) ) { strcpy(VAR,value); return; } }
185 
186  SCRIPT_PARSE_FLOAT("scriptArg1",scriptArg1)
187  SCRIPT_PARSE_FLOAT("scriptArg2",scriptArg2)
188  SCRIPT_PARSE_FLOAT("scriptArg3",scriptArg3)
189  SCRIPT_PARSE_FLOAT("scriptArg4",scriptArg4)
190  SCRIPT_PARSE_FLOAT("scriptArg5",scriptArg5)
191  SCRIPT_PARSE_INT("scriptIntArg1",scriptIntArg1)
192  SCRIPT_PARSE_INT("scriptIntArg2",scriptIntArg2)
193  SCRIPT_PARSE_STRING("scriptStringArg1",scriptStringArg1)
194  SCRIPT_PARSE_STRING("scriptStringArg2",scriptStringArg2)
195  SCRIPT_PARSE_INT("numsteps",N)
196  if ( ! strncasecmp(param,"firsttimestep",MAX_SCRIPT_PARAM_SIZE) ) {
197  N = firstTimestep = atoi(value); return;
198  }
199  SCRIPT_PARSE_FLOAT("reassignTemp",reassignTemp)
200  SCRIPT_PARSE_FLOAT("rescaleTemp",rescaleTemp)
201  SCRIPT_PARSE_BOOL("velocityQuenching",minimizeOn)
202  SCRIPT_PARSE_BOOL("maximumMove",maximumMove)
203  // SCRIPT_PARSE_BOOL("Langevin",langevinOn)
204  if ( ! strncasecmp(param,"Langevin",MAX_SCRIPT_PARAM_SIZE) ) {
205  langevinOn = atobool(value);
206  if ( langevinOn && ! langevinOnAtStartup ) {
207  NAMD_die("Langevin must be enabled at startup to disable and re-enable in script.");
208  }
209  return;
210  }
211  SCRIPT_PARSE_FLOAT("langevinTemp",langevinTemp)
212  SCRIPT_PARSE_BOOL("langevinBAOAB",langevin_useBAOAB) // [!!] Use the BAOAB integrator or not
213  SCRIPT_PARSE_FLOAT("loweAndersenTemp",loweAndersenTemp) // BEGIN LA, END LA
214  SCRIPT_PARSE_BOOL("stochRescale",stochRescaleOn)
215  SCRIPT_PARSE_FLOAT("stochRescaleTemp",stochRescaleTemp)
216  SCRIPT_PARSE_FLOAT("initialTemp",initialTemp)
217  SCRIPT_PARSE_BOOL("useGroupPressure",useGroupPressure)
218  SCRIPT_PARSE_BOOL("useFlexibleCell",useFlexibleCell)
219  SCRIPT_PARSE_BOOL("useConstantArea",useConstantArea)
220  SCRIPT_PARSE_BOOL("fixCellDims",fixCellDims)
221  SCRIPT_PARSE_BOOL("fixCellDimX",fixCellDimX)
222  SCRIPT_PARSE_BOOL("fixCellDimY",fixCellDimY)
223  SCRIPT_PARSE_BOOL("fixCellDimZ",fixCellDimZ)
224  SCRIPT_PARSE_BOOL("useConstantRatio",useConstantRatio)
225  SCRIPT_PARSE_BOOL("LangevinPiston",langevinPistonOn)
226  SCRIPT_PARSE_MOD_FLOAT("LangevinPistonTarget",
227  langevinPistonTarget,/PRESSUREFACTOR)
228  SCRIPT_PARSE_FLOAT("LangevinPistonPeriod",langevinPistonPeriod)
229  SCRIPT_PARSE_FLOAT("LangevinPistonDecay",langevinPistonDecay)
230  SCRIPT_PARSE_FLOAT("LangevinPistonTemp",langevinPistonTemp)
231  SCRIPT_PARSE_MOD_FLOAT("SurfaceTensionTarget",
232  surfaceTensionTarget,*(100.0/PRESSUREFACTOR))
233  SCRIPT_PARSE_BOOL("BerendsenPressure",berendsenPressureOn)
234  SCRIPT_PARSE_MOD_FLOAT("BerendsenPressureTarget",
235  berendsenPressureTarget,/PRESSUREFACTOR)
236  SCRIPT_PARSE_MOD_FLOAT("BerendsenPressureCompressibility",
237  berendsenPressureCompressibility,*PRESSUREFACTOR)
238  SCRIPT_PARSE_FLOAT("BerendsenPressureRelaxationTime",
239  berendsenPressureRelaxationTime)
240  SCRIPT_PARSE_FLOAT("constraintScaling",constraintScaling)
241  SCRIPT_PARSE_FLOAT("consForceScaling",consForceScaling)
242  SCRIPT_PARSE_BOOL("drudeHardWall",drudeHardWallOn)
243  SCRIPT_PARSE_FLOAT("drudeBondConst",drudeBondConst)
244  SCRIPT_PARSE_FLOAT("drudeBondLen",drudeBondLen)
245  SCRIPT_PARSE_STRING("outputname",outputFilename)
246  SCRIPT_PARSE_INT("outputEnergies",outputEnergies)
247  SCRIPT_PARSE_INT("outputEnergiesPrecision",outputEnergiesPrecision)
248  SCRIPT_PARSE_STRING("restartname",restartFilename)
249  SCRIPT_PARSE_INT("DCDfreq",dcdFrequency)
250  if ( ! strncasecmp(param,"DCDfile",MAX_SCRIPT_PARAM_SIZE) ) {
251  close_dcdfile(); // *** implemented in Output.C ***
252  strcpy(dcdFilename,value);
253  return;
254  }
255  if ( ! strncasecmp(param,"velDCDfile",MAX_SCRIPT_PARAM_SIZE) ) {
256  close_veldcdfile(); // *** implemented in Output.C ***
257  strcpy(velDcdFilename,value);
258  return;
259  }
260  SCRIPT_PARSE_STRING("tclBCArgs",tclBCArgs)
261  SCRIPT_PARSE_VECTOR("eField",eField)
262  SCRIPT_PARSE_FLOAT("eFieldFreq",eFieldFreq)
263  SCRIPT_PARSE_FLOAT("eFieldPhase",eFieldPhase)
264  SCRIPT_PARSE_FLOAT("accelMDE",accelMDE)
265  SCRIPT_PARSE_FLOAT("accelMDalpha",accelMDalpha)
266  SCRIPT_PARSE_FLOAT("accelMDTE",accelMDTE)
267  SCRIPT_PARSE_FLOAT("accelMDTalpha",accelMDTalpha)
268  SCRIPT_PARSE_FLOAT("accelMDGSigma0P",accelMDGSigma0P)
269  SCRIPT_PARSE_FLOAT("accelMDGSigma0D",accelMDGSigma0D)
270  SCRIPT_PARSE_STRING("accelMDGRestartFile",accelMDGRestartFile)
271  SCRIPT_PARSE_VECTOR("stirAxis",stirAxis)
272  SCRIPT_PARSE_VECTOR("stirPivot",stirPivot)
273  if ( ! strncasecmp(param,"mgridforcescale",MAX_SCRIPT_PARAM_SIZE) ) {
274  NAMD_die("Can't yet modify mgridforcescale in a script");
275  return;
276  }
277  if ( ! strncasecmp(param,"mgridforcevoff",MAX_SCRIPT_PARAM_SIZE) ) {
278  NAMD_die("Can't yet modify mgridforcevoff in a script");
279  return;
280  }
281 
282  if ( ! strncasecmp(param,"fixedatoms",MAX_SCRIPT_PARAM_SIZE) ) {
283  if ( ! fixedAtomsOn )
284  NAMD_die("FixedAtoms may not be enabled in a script.");
285  if ( ! fixedAtomsForces )
286  NAMD_die("To use fixedAtoms in script first use fixedAtomsForces yes.");
287  fixedAtomsOn = atobool(value);
288  return;
289  }
290 
291 //fepb
292  if ( ! strncasecmp(param,"alch",MAX_SCRIPT_PARAM_SIZE) ) {
293  alchOn = atobool(value);
294  if ( alchOn && ! alchOnAtStartup ) {
295  NAMD_die("Alchemy must be enabled at startup to disable and re-enable in script.");
296  }
297  alchFepOn = alchOn && alchFepOnAtStartup;
298  alchThermIntOn = alchOn && alchThermIntOnAtStartup;
300  if ( PMEOn ) ComputePmeUtil::select();
301  return;
302  }
303  SCRIPT_PARSE_INT("alchEquilSteps",alchEquilSteps)
304 
305  if ( ! strncasecmp(param,"alchLambda",MAX_SCRIPT_PARAM_SIZE) ) {
306  alchLambda = atof(value);
307  if ( alchLambda < 0.0 || 1.0 < alchLambda ) {
308  NAMD_die("Alchemical lambda values should be in the range [0.0, 1.0]\n");
309  }
311  return;
312  }
313 
314  if ( ! strncasecmp(param,"alchLambda2",MAX_SCRIPT_PARAM_SIZE) ) {
315  alchLambda2 = atof(value);
316  if ( alchLambda2 < 0.0 || 1.0 < alchLambda2 ) {
317  NAMD_die("Alchemical lambda values should be in the range [0.0, 1.0]\n");
318  }
320  return;
321  }
322 
323  if ( ! strncasecmp(param,"alchLambdaIDWS",MAX_SCRIPT_PARAM_SIZE) ) {
324  alchLambdaIDWS = atof(value);
325  setupIDWS();
327  return;
328  }
329 
330  if ( ! strncasecmp(param,"alchLambdaFreq",MAX_SCRIPT_PARAM_SIZE) ) {
331  alchLambdaFreq = atoi(value);
332  if ( alchLambdaIDWS >= 0 ) {
333  NAMD_die("alchLambdaIDWS and alchLambdaFreq are not compatible.\n");
334  }
336  return;
337  }
338 //fepe
339 
340  if ( ! strncasecmp(param,"nonbondedScaling",MAX_SCRIPT_PARAM_SIZE) ) {
341  nonbondedScaling = atof(value);
343  return;
344  }
345 
346  if ( ! strncasecmp(param,"commOnly",MAX_SCRIPT_PARAM_SIZE) ) {
347  commOnly = atobool(value);
349  return;
350  }
351 
352  // REST2 - We don't have to make any changes to ComputeNonbondedUtil
353  // other than recalculating the LJTable. Skip doing the other stuff.
354  if ( ! strncasecmp(param,"soluteScalingFactor",MAX_SCRIPT_PARAM_SIZE)) {
355  soluteScalingFactor = atof(value);
356  if (soluteScalingFactor < 0.0) {
357  NAMD_die("Solute scaling factor should be non-negative\n");
358  }
359  soluteScalingFactorCharge = soluteScalingFactor;
360  soluteScalingFactorVdw = soluteScalingFactor;
361  // update LJTable for CPU
363 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
364  // update LJTable for GPU, needs CPU update first
366 #endif
367  return;
368  }
369  if ( ! strncasecmp(param,"soluteScalingFactorVdw",MAX_SCRIPT_PARAM_SIZE)) {
370  soluteScalingFactorVdw = atof(value);
371  if (soluteScalingFactorVdw < 0.0) {
372  NAMD_die("Solute scaling factor for van der Waals "
373  "should be non-negative\n");
374  }
375  // update LJTable for CPU
377 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
378  // update LJTable for GPU, needs CPU update first
380 #endif
381  return;
382  }
383  if ( ! strncasecmp(param,"soluteScalingFactorCharge",MAX_SCRIPT_PARAM_SIZE)) {
384  soluteScalingFactorCharge = atof(value);
385  if (soluteScalingFactorCharge < 0.0) {
386  NAMD_die("Solute scaling factor for electrostatics "
387  "should be non-negative\n");
388  }
389  return;
390  }
391 
392  char *error = new char[2 * MAX_SCRIPT_PARAM_SIZE + 100];
393  sprintf(error,"Setting parameter %s from script failed!\n",param);
394  NAMD_die(error);
395 
396 }
397 
400 }
401 
404 }
405 
406 /************************************************************************/
407 /* */
408 /* FUNCTION config_parser */
409 /* */
410 /************************************************************************/
411 
412 void SimParameters::config_parser(ParseOptions &opts) {
413 
414  // Set all variable to fallback default values. This is not really
415  // necessary, as we give default values when we set up the ParseOptions
416  // object, but it helps the debuggers figure out we've initialized the
417  // variables.
418  HydrogenBonds = FALSE;
419  useAntecedent = TRUE;
420  aaAngleExp = 2;
421  haAngleExp = 4;
422  distAttExp = 4;
423  distRepExp = 6;
424  dhaCutoffAngle = 100.0;
425  dhaOnAngle = 60.0;
426  dhaOffAngle = 80.0;
427  daCutoffDist = 7.5;
428  daOnDist = 5.5;
429  daOffDist = 6.5;
430 
431  config_parser_basic(opts);
432  config_parser_fileio(opts);
433  config_parser_fullelect(opts);
434  config_parser_methods(opts);
435  config_parser_constraints(opts);
436  #ifdef OPENATOM_VERSION
437  config_parser_openatom(opts);
438  #endif // OPENATOM_VERSION
439 
440  config_parser_gridforce(opts);
441  config_parser_mgridforce(opts);
442  config_parser_movdrag(opts);
443  config_parser_rotdrag(opts);
444  config_parser_constorque(opts);
445  config_parser_boundary(opts);
446  config_parser_misc(opts);
447 
448 }
449 
450 void SimParameters::config_parser_basic(ParseOptions &opts) {
451 
452  // So first we set up the ParseOptions objects so that it will check
453  // all of the logical rules that the configuration file must follow.
454 
455  opts.optional("main", "obsolete", "used to flag obsolete options",
456  PARSE_STRING);
457 
459  opts.require("main", "timestep", "size of the timestep, in fs",
460  &dt, 1.0);
461  opts.range("timestep", NOT_NEGATIVE);
462  opts.units("timestep", N_FSEC);
463 
464  opts.optional("main", "numsteps", "number of timesteps to perform",
465  &N,0);
466  opts.range("numsteps", NOT_NEGATIVE);
467 
468  opts.optional("main", "stepspercycle",
469  "Number of steps between atom migrations",
470  &stepsPerCycle, 20);
471  opts.range("stepspercycle", POSITIVE);
472 
473  opts.require("main", "cutoff", "local electrostatic and Vdw distance",
474  &cutoff);
475  opts.range("cutoff", POSITIVE);
476  opts.units("cutoff", N_ANGSTROM);
477 
478  opts.optional("main", "nonbondedScaling", "nonbonded scaling factor",
479  &nonbondedScaling, 1.0);
480  opts.range("nonbondedScaling", NOT_NEGATIVE);
481 
482  opts.optional("main", "limitDist", "limit nonbonded below this distance",
483  &limitDist, 0.0);
484  opts.range("limitDist", NOT_NEGATIVE);
485 
486  opts.require("main", "exclude", "Electrostatic and VDW exclusion policy",
487  PARSE_STRING);
488 
489  opts.optional("exclude", "1-4scaling", "1-4 electrostatic scaling factor",
490  &scale14, 1.0);
491  opts.range("1-4scaling", POSITIVE);
492 
493  opts.optionalB("main", "switching",
494  "Should a smoothing function be used?", &switchingActive, TRUE);
495 
496  opts.optionalB("switching", "vdwForceSwitching",
497  "Use force switching for vdw?", &vdwForceSwitching, FALSE);
498 
499  opts.optional("switching", "switchdist",
500  "Distance for switching function activation",
501  &switchingDist);
502  opts.range("switchdist", POSITIVE);
503  opts.units("switchdist", N_ANGSTROM);
504 
505  opts.optionalB("main", "martiniSwitching",
506  "Use Martini residue-based coarse-grain switching?", &martiniSwitching, FALSE);
507  opts.optionalB("main", "martiniDielAllow",
508  "Allow use of dielectric != 15.0 when using Martini", &martiniDielAllow, FALSE);
509 
510  opts.optional("main", "pairlistdist", "Pairlist inclusion distance",
511  &pairlistDist);
512  opts.range("pairlistdist", POSITIVE);
513  opts.units("pairlistdist", N_ANGSTROM);
514 
515  opts.optional("main", "pairlistMinProcs", "Min procs for pairlists",
516  &pairlistMinProcs,1);
517  opts.range("pairlistMinProcs", POSITIVE);
518 
519  opts.optional("main", "pairlistsPerCycle", "regenerate x times per cycle",
520  &pairlistsPerCycle,2);
521  opts.range("pairlistsPerCycle", POSITIVE);
522 
523  opts.optional("main", "outputPairlists", "how often to print warnings",
524  &outputPairlists, 0);
525  opts.range("outputPairlists", NOT_NEGATIVE);
526 
527  opts.optional("main", "pairlistShrink", "tol *= (1 - x) on regeneration",
528  &pairlistShrink,0.01);
529  opts.range("pairlistShrink", NOT_NEGATIVE);
530 
531  opts.optional("main", "pairlistGrow", "tol *= (1 + x) on trigger",
532  &pairlistGrow, 0.01);
533  opts.range("pairlistGrow", NOT_NEGATIVE);
534 
535  opts.optional("main", "pairlistTrigger", "trigger is atom > (1 - x) * tol",
536  &pairlistTrigger, 0.3);
537  opts.range("pairlistTrigger", NOT_NEGATIVE);
538 
539  opts.optional("main", "temperature", "initial temperature",
540  &initialTemp);
541  opts.range("temperature", NOT_NEGATIVE);
542  opts.units("temperature", N_KELVIN);
543 
544  opts.optionalB("main", "COMmotion", "allow initial center of mass movement",
545  &comMove, FALSE);
546 
547  opts.optionalB("main", "zeroMomentum", "constrain center of mass",
548  &zeroMomentum, FALSE);
549  opts.optionalB("zeroMomentum", "zeroMomentumAlt", "constrain center of mass",
550  &zeroMomentumAlt, FALSE);
551 
552  opts.optionalB("main", "wrapWater", "wrap waters around periodic boundaries on output",
553  &wrapWater, FALSE);
554  opts.optionalB("main", "wrapAll", "wrap all clusters around periodic boundaries on output",
555  &wrapAll, FALSE);
556  opts.optionalB("main", "wrapNearest", "wrap to nearest image to cell origin",
557  &wrapNearest, FALSE);
558 
559  opts.optional("main", "dielectric", "dielectric constant",
560  &dielectric, 1.0);
561  opts.range("dielectric", POSITIVE); // Hmmm, dielectric < 1 ...
562 
563  opts.optional("main", "margin", "Patch width margin", &margin, XXXBIGREAL);
564  opts.range("margin", NOT_NEGATIVE);
565  opts.units("margin", N_ANGSTROM);
566 
567  opts.optional("main", "seed", "Initial random number seed", &randomSeed);
568  opts.range("seed", POSITIVE);
569 
570  opts.optional("main", "outputEnergies", "How often to print energies in timesteps",
571  &outputEnergies, 1);
572  opts.range("outputEnergies", POSITIVE);
573 
574  opts.optional("main", "outputEnergiesPrecision", "Output energy precision",
575  &outputEnergiesPrecision, 4);
576  opts.range("outputEnergiesPrecision", POSITIVE);
577 
578  opts.optional("main", "outputMomenta", "How often to print linear and angular momenta in timesteps",
579  &outputMomenta, 0);
580  opts.range("outputMomenta", NOT_NEGATIVE);
581 
582  opts.optional("main", "outputTiming", "How often to print timing data in timesteps",
583  &outputTiming);
584  opts.range("outputTiming", NOT_NEGATIVE);
585 
586  opts.optional("main", "outputCudaTiming", "How often to print CUDA timing data in timesteps",
587  &outputCudaTiming, 0);
588  opts.range("outputCudaTiming", NOT_NEGATIVE);
589 
590  opts.optional("main", "outputPressure", "How often to print pressure data in timesteps",
591  &outputPressure, 0);
592  opts.range("outputPressure", NOT_NEGATIVE);
593 
594  opts.optionalB("main", "mergeCrossterms", "merge crossterm energy with dihedral when printing?",
595  &mergeCrossterms, TRUE);
596 
597  opts.optional("main", "MTSAlgorithm", "Multiple timestep algorithm",
598  PARSE_STRING);
599 
600  opts.optional("main", "longSplitting", "Long range force splitting option",
601  PARSE_STRING);
602 
603  opts.optionalB("main", "ignoreMass", "Do not use masses to find hydrogen atoms",
604  &ignoreMass, FALSE);
605 
606  opts.optional("main", "splitPatch", "Atom into patch splitting option",
607  PARSE_STRING);
608  opts.optional("main", "hgroupCutoff", "Hydrogen margin", &hgroupCutoff, 2.5);
609 
610  opts.optional("main", "extendedSystem",
611  "Initial configuration of extended system variables and periodic cell",
612  PARSE_STRING);
613 
614  opts.optional("main", "cellBasisVector1", "Basis vector for periodic cell",
615  &cellBasisVector1);
616  opts.optional("main", "cellBasisVector2", "Basis vector for periodic cell",
617  &cellBasisVector2);
618  opts.optional("main", "cellBasisVector3", "Basis vector for periodic cell",
619  &cellBasisVector3);
620  opts.optional("main", "cellOrigin", "Fixed center of periodic cell",
621  &cellOrigin);
622 
623  opts.optionalB("main", "molly", "Rigid bonds to hydrogen",&mollyOn,FALSE);
624  opts.optional("main", "mollyTolerance", "Error tolerance for MOLLY",
625  &mollyTol, 0.00001);
626  opts.optional("main", "mollyIterations",
627  "Max number of iterations for MOLLY", &mollyIter, 100);
628 
629  opts.optional("main", "rigidBonds", "Rigid bonds to hydrogen",PARSE_STRING);
630  opts.optional("main", "rigidTolerance",
631  "Error tolerance for rigid bonds to hydrogen",
632  &rigidTol, 1.0e-8);
633  opts.optional("main", "rigidIterations",
634  "Max number of SHAKE iterations for rigid bonds to hydrogen",
635  &rigidIter, 100);
636  opts.optionalB("main", "rigidDieOnError",
637  "Die if rigidTolerance is not achieved after rigidIterations",
638  &rigidDie, TRUE);
639  opts.optionalB("main", "useSettle",
640  "Use the SETTLE algorithm for rigid waters",
641  &useSettle, TRUE);
642 
643  opts.optional("main", "nonbondedFreq", "Nonbonded evaluation frequency",
644  &nonbondedFrequency, 1);
645  opts.range("nonbondedFreq", POSITIVE);
646 
647  opts.optionalB("main", "outputPatchDetails", "print number of atoms in each patch",
648  &outputPatchDetails, FALSE);
649  opts.optionalB("main", "staticAtomAssignment", "never migrate atoms",
650  &staticAtomAssignment, FALSE);
651  opts.optionalB("main", "replicaUniformPatchGrids", "same patch grid size on all replicas",
652  &replicaUniformPatchGrids, FALSE);
653 #ifndef MEM_OPT_VERSION
654  // in standard (non-mem-opt) version, enable lone pairs by default
655  // for compatibility with recent force fields
656  opts.optionalB("main", "lonePairs", "Enable lone pairs", &lonepairs, TRUE);
657 #else
658  // in mem-opt version, disable lone pairs by default
659  // because they are not supported
660  opts.optionalB("main", "lonePairs", "Enable lone pairs", &lonepairs, FALSE);
661 #endif
662  opts.optional("main", "waterModel", "Water model to use", PARSE_STRING);
663  opts.optionalB("main", "LJcorrection", "Apply analytical tail corrections for energy and virial", &LJcorrection, FALSE);
664 #ifdef TIMER_COLLECTION
665  opts.optional("main", "TimerBinWidth",
666  "Bin width of timer histogram collection in microseconds",
667  &timerBinWidth, 1.0);
668 #endif
669 #if defined(NAMD_NVTX_ENABLED) || defined(NAMD_CMK_TRACE_ENABLED) || defined(NAMD_ROCTX_ENABLED)
670  // default NVTX or Projections profiling is up to the first 1000 patches
671  opts.optional("main", "beginEventPatchID","Beginning patch ID for profiling",
672  &beginEventPatchID, 0);
673  opts.optional("main", "endEventPatchID", "Ending patch ID for profiling",
674  &endEventPatchID, 5000);
675  // default NVTX or Projections profiling is up to the first 1000 time steps
676  opts.optional("main", "beginEventStep", "Beginning time step for profiling",
677  &beginEventStep, 0);
678  opts.optional("main", "endEventStep", "Ending time step for profiling",
679  &endEventStep, 1000);
680 #endif
681 }
682 
683 void SimParameters::config_parser_fileio(ParseOptions &opts) {
684 
686 
687  opts.optional("main", "cwd", "current working directory", PARSE_STRING);
688 
689 // In order to include AMBER options, "coordinates", "structure"
690 // and "parameters" are now optional, not required. The presence
691 // of them will be checked later in check_config()
692 
693 // opts.require("main", "coordinates", "initial PDB coordinate file",
694 // PARSE_STRING);
695  opts.optional("main", "coordinates", "initial PDB coordinate file",
696  PARSE_STRING);
697 
698  opts.optional("main", "velocities",
699  "initial velocities, given as a PDB file", PARSE_STRING);
700  opts.optional("main", "binvelocities",
701  "initial velocities, given as a binary restart", PARSE_STRING);
702  opts.optional("main", "bincoordinates",
703  "initial coordinates in a binary restart file", PARSE_STRING);
704 #ifdef MEM_OPT_VERSION
705  opts.optional("main", "binrefcoords",
706  "reference coordinates in a binary restart file", PARSE_STRING);
707 #endif
708 
709 // opts.require("main", "structure", "initial PSF structure file",
710 // PARSE_STRING);
711  opts.optional("main", "structure", "initial PSF structure file",
712  PARSE_STRING);
713 
714 // opts.require("main", "parameters",
715 //"CHARMm 19 or CHARMm 22 compatable force field file (multiple "
716 //"inputs allowed)", PARSE_MULTIPLES);
717  opts.optional("main", "parameters",
718 "CHARMm 19 or CHARMm 22 compatable force field file (multiple "
719 "inputs allowed)", PARSE_MULTIPLES);
720 
721 
722  //****** BEGIN CHARMM/XPLOR type changes
724  opts.optionalB("parameters", "paraTypeXplor", "Parameter file in Xplor format?", &paraTypeXplorOn, FALSE);
725  opts.optionalB("parameters", "paraTypeCharmm", "Parameter file in Charmm format?", &paraTypeCharmmOn, FALSE);
726  //****** END CHARMM/XPLOR type changes
727 
728  // Ported by JLai -- JE - Go parameters
729  opts.optionalB("main", "GromacsPair", "Separately calculate pair interactions", &goGroPair, FALSE);
730  opts.optionalB("main", "GoForcesOn", "Go forces will be calculated", &goForcesOn, FALSE);
731  opts.require("GoForcesOn", "GoParameters", "Go parameter file", goParameters);
732  opts.require("GoForcesOn", "GoCoordinates", "target coordinates for Go forces", goCoordinates);
733  // Added by JLai -- Go-method parameter -- switches between using the matrix and sparse matrix representations [6.3.11]
734  // opts.optional("GoForcesOn", "GoMethod", "Which type of matrix should be used to store Go contacts?", &goMethod);
735  // Added by JLai -- Go-method parameter [8.2.11]
736  //opts.optional("GoForcesOn", "GoMethod", "Which type of matrix should be used to store Go contacts?", PARSE_STRING);
737  opts.require("GoForcesOn", "GoMethod", "Which type of matrix should be used to store Go contacts?", PARSE_STRING);
738  // End of Port -- JL
739 
740  opts.require("main", "outputname",
741  "prefix for the final PDB position and velocity filenames",
742  outputFilename);
743 
744  opts.optional("main", "auxFile", "Filename for data stream output",
745  auxFilename);
746 
747  opts.optional("main", "numinputprocs", "Number of pes to use for parallel input",
748  &numinputprocs, 0);
749  opts.range("numinputprocs", NOT_NEGATIVE);
750 
751  opts.optional("main", "numoutputprocs", "Number of pes to use for parallel output",
752  &numoutputprocs, 0);
753  opts.range("numoutputprocs", NOT_NEGATIVE);
754  opts.optional("main", "numoutputwriters", "Number of output processors that simultaneously write to an output file",
755  &numoutputwrts, 1);
756  opts.range("numoutputwriters", NOT_NEGATIVE);
757 
758  opts.optional("main", "DCDfreq", "Frequency of DCD trajectory output, in "
759  "timesteps", &dcdFrequency, 0);
760  opts.range("DCDfreq", NOT_NEGATIVE);
761  opts.optional("DCDfreq", "DCDfile", "DCD trajectory output file name",
762  dcdFilename);
763  opts.optionalB("DCDfreq", "DCDunitcell", "Store unit cell in dcd timesteps?",
764  &dcdUnitCell);
765 
766  opts.optional("main", "velDCDfreq", "Frequency of velocity "
767  "DCD output, in timesteps", &velDcdFrequency, 0);
768  opts.range("velDCDfreq", NOT_NEGATIVE);
769  opts.optional("velDCDfreq", "velDCDfile", "velocity DCD output file name",
770  velDcdFilename);
771 
772  opts.optional("main", "forceDCDfreq", "Frequency of force"
773  "DCD output, in timesteps", &forceDcdFrequency, 0);
774  opts.range("forceDCDfreq", NOT_NEGATIVE);
775  opts.optional("forceDCDfreq", "forceDCDfile", "force DCD output file name",
776  forceDcdFilename);
777 
778  opts.optional("main", "XSTfreq", "Frequency of XST trajectory output, in "
779  "timesteps", &xstFrequency, 0);
780  opts.range("XSTfreq", NOT_NEGATIVE);
781  opts.optional("XSTfreq", "XSTfile", "Extended sytem trajectory output "
782  "file name", xstFilename);
783 
784  opts.optional("main", "restartfreq", "Frequency of restart file "
785  "generation", &restartFrequency, 0);
786  opts.range("restartfreq", NOT_NEGATIVE);
787  opts.optional("restartfreq", "restartname", "Prefix for the position and "
788  "velocity PDB files used for restarting", restartFilename);
789  opts.optionalB("restartfreq", "restartsave", "Save restart files with "
790  "unique filenames rather than overwriting", &restartSave, FALSE);
791  opts.optionalB("restartfreq", "restartsavedcd", "Save DCD files with "
792  "unique filenames at each restart", &restartSaveDcd, FALSE);
793 
794  opts.optionalB("restartfreq", "binaryrestart", "Specify use of binary restart files ",
795  &binaryRestart, TRUE);
796 
797  opts.optionalB("outputname", "binaryoutput", "Specify use of binary output files ",
798  &binaryOutput, TRUE);
799 
800  opts.optionalB("main", "amber", "Is it AMBER force field?",
801  &amberOn, FALSE);
802  opts.optionalB("amber", "oldParmReader", "Use the old AMBER parm/parm7 reader?", &oldParmReader, FALSE);
803  opts.optionalB("amber", "readexclusions", "Read exclusions from parm file?",
804  &readExclusions, TRUE);
805  opts.require("amber", "scnb", "1-4 VDW interactions are divided by scnb",
806  &vdwscale14, 2.0);
807  opts.require("amber", "parmfile", "AMBER parm file", PARSE_STRING);
808  opts.optional("amber", "ambercoor", "AMBER coordinate file", PARSE_STRING);
809 
810  /* GROMACS options */
811  opts.optionalB("main", "gromacs", "Use GROMACS-like force field?",
812  &gromacsOn, FALSE);
813  opts.require("gromacs", "grotopfile", "GROMACS topology file",
814  PARSE_STRING);
815  opts.optional("gromacs", "grocoorfile","GROMACS coordinate file",
816  PARSE_STRING);
817 
818  // OPLS options
819  opts.optionalB("main", "vdwGeometricSigma",
820  "Use geometric mean to combine L-J sigmas, as for OPLS",
821  &vdwGeometricSigma, FALSE);
822 
823  // load/store computeMap
824  opts.optional("main", "computeMapFile", "Filename for computeMap",
825  computeMapFilename);
826  opts.optionalB("main", "storeComputeMap", "store computeMap?",
827  &storeComputeMap, FALSE);
828  opts.optionalB("main", "loadComputeMap", "load computeMap?",
829  &loadComputeMap, FALSE);
830 }
831 
832 
833 void SimParameters::config_parser_fullelect(ParseOptions &opts) {
834 
836 #ifdef DPMTA
837  DebugM(1,"DPMTA setup start\n");
838  // PMTA is included, so really get these values
839  opts.optionalB("main", "FMA", "Should FMA be used?", &FMAOn, FALSE);
840  opts.optional("FMA", "FMALevels", "Tree levels to use in FMA", &FMALevels,
841  5);
842  opts.range("FMALevels", POSITIVE);
843  opts.optional("FMA", "FMAMp", "Number of FMA multipoles", &FMAMp, 8);
844  opts.range("FMAMp", POSITIVE);
845  opts.optionalB("FMA", "FMAFFT", "Use FFT enhancement in FMA?", &FMAFFTOn, TRUE);
846  opts.optional("FMAFFT", "FMAFFTBlock", "FFT blocking factor",
847  &FMAFFTBlock, 4);
848  opts.range("FMAFFTBlock", POSITIVE);
849  DebugM(1,"DPMTA setup end\n");
850 #else
851  // PMTA is NOT included. So just set all the values to 0.
852  FMAOn = FALSE;
853  FMALevels = 0;
854  FMAMp = 0;
855  FMAFFTOn = FALSE;
856  FMAFFTBlock = 0;
857 #endif
858 
859  opts.optional("main", "fullElectFrequency",
860  "Number of steps between full electrostatic executions",
861  &fullElectFrequency);
862  opts.range("fullElectFrequency", POSITIVE);
863 
864  // USE OF THIS PARAMETER DISCOURAGED
865  opts.optional("main", "fmaFrequency",
866  "Number of steps between full electrostatic executions",
867  &fmaFrequency);
868  opts.range("fmaFrequency", POSITIVE);
869 
870  opts.optional("main", "fmaTheta",
871  "FMA theta parameter value",
872  &fmaTheta,0.715);
873  opts.range("fmaTheta", POSITIVE);
874 
875  opts.optionalB("main", "FullDirect", "Should direct calculations of full electrostatics be performed?",
876  &fullDirectOn, FALSE);
877 
878 
880 
881  opts.optionalB("main", "MSM",
882  "Use multilevel summation method for electrostatics?",
883  &MSMOn, FALSE);
884  opts.optional("MSM", "MSMQuality", "MSM quality",
885  &MSMQuality, 0);
886  opts.optional("MSM", "MSMApprox", "MSM approximation",
887  &MSMApprox, 0);
888  opts.optional("MSM", "MSMSplit", "MSM splitting",
889  &MSMSplit, 0);
890  opts.optional("MSM", "MSMLevels", "MSM maximum number of levels",
891  &MSMLevels, 0); // set to 0 adapts to as many as needed
892  opts.optional("MSM", "MSMGridSpacing", "MSM grid spacing (Angstroms)",
893  &MSMGridSpacing, 2.5);
894  opts.optional("MSM", "MSMPadding", "MSM padding (Angstroms)",
895  &MSMPadding, 2.5);
896  opts.optional("MSM", "MSMxmin", "MSM x minimum (Angstroms)", &MSMxmin, 0);
897  opts.optional("MSM", "MSMxmax", "MSM x maximum (Angstroms)", &MSMxmax, 0);
898  opts.optional("MSM", "MSMymin", "MSM y minimum (Angstroms)", &MSMymin, 0);
899  opts.optional("MSM", "MSMymax", "MSM y maximum (Angstroms)", &MSMymax, 0);
900  opts.optional("MSM", "MSMzmin", "MSM z minimum (Angstroms)", &MSMzmin, 0);
901  opts.optional("MSM", "MSMzmax", "MSM z maximum (Angstroms)", &MSMzmax, 0);
902  opts.optional("MSM", "MSMBlockSizeX",
903  "MSM grid block size along X direction (for decomposing parallel work)",
904  &MSMBlockSizeX, 8);
905  opts.optional("MSM", "MSMBlockSizeY",
906  "MSM grid block size along Y direction (for decomposing parallel work)",
907  &MSMBlockSizeY, 8);
908  opts.optional("MSM", "MSMBlockSizeZ",
909  "MSM grid block size along Z direction (for decomposing parallel work)",
910  &MSMBlockSizeZ, 8);
911 
912  opts.optionalB("MSM", "MsmSerial",
913  "Use MSM serial version for long-range calculation?",
914  &MsmSerialOn, FALSE);
915 
916 
918 
919  opts.optionalB("main", "FMM",
920  "Use fast multipole method for electrostatics?",
921  &FMMOn, FALSE);
922  opts.optional("FMM", "FMMLevels", "FMM number of levels",
923  &FMMLevels, 0);
924  opts.optional("FMM", "FMMPadding", "FMM padding margin (Angstroms)",
925  &FMMPadding, 0);
926 
927  opts.optionalB("main", "useCUDA2", "Use new CUDA code", &useCUDA2, TRUE);
928 
930 
931  opts.optionalB("main", "PME", "Use particle mesh Ewald for electrostatics?",
932  &PMEOn, FALSE);
933  opts.optional("PME", "PMETolerance", "PME direct space tolerance",
934  &PMETolerance, 1.e-6);
935  opts.optional("PME", "PMEInterpOrder", "PME interpolation order",
936  &PMEInterpOrder, 4); // cubic interpolation is default
937  opts.optional("PME", "PMEGridSizeX", "PME grid in x dimension",
938  &PMEGridSizeX, 0);
939  opts.optional("PME", "PMEGridSizeY", "PME grid in y dimension",
940  &PMEGridSizeY, 0);
941  opts.optional("PME", "PMEGridSizeZ", "PME grid in z dimension",
942  &PMEGridSizeZ, 0);
943  opts.optional("PME", "PMEGridSpacing", "Maximum PME grid spacing (Angstroms)",
944  &PMEGridSpacing, 0.);
945  opts.range("PMEGridSpacing", NOT_NEGATIVE);
946  opts.optional("PME", "PMEProcessors",
947  "PME FFT and reciprocal sum processor count", &PMEProcessors, 0);
948  opts.optional("PME", "PMEMinSlices",
949  "minimum thickness of PME reciprocal sum slab", &PMEMinSlices, 2);
950  opts.range("PMEMinSlices", NOT_NEGATIVE);
951  opts.optional("PME", "PMEPencils",
952  "PME FFT and reciprocal sum pencil grid size", &PMEPencils, -1);
953  opts.optional("PME", "PMEPencilsX",
954  "PME FFT and reciprocal sum pencil grid size X", &PMEPencilsX, 0);
955  opts.optional("PME", "PMEPencilsY",
956  "PME FFT and reciprocal sum pencil grid size Y", &PMEPencilsY, 0);
957  opts.optional("PME", "PMEPencilsZ",
958  "PME FFT and reciprocal sum pencil grid size Z", &PMEPencilsZ, 0);
959  opts.range("PMEPencilsX", NOT_NEGATIVE);
960  opts.range("PMEPencilsY", NOT_NEGATIVE);
961  opts.range("PMEPencilsZ", NOT_NEGATIVE);
962  opts.optional("PME", "PMEPencilsYLayout",
963  "PME FFT and reciprocal sum Y pencil layout strategy", &PMEPencilsYLayout, 0);
964  opts.optional("PME", "PMEPencilsXLayout",
965  "PME FFT and reciprocal sum X pencil layout strategy", &PMEPencilsXLayout, 1);
966  opts.range("PMEPencilsYLayout", NOT_NEGATIVE);
967  opts.range("PMEPencilsXLayout", NOT_NEGATIVE);
968  opts.optional("PME", "PMESendOrder",
969  "PME message ordering control", &PMESendOrder, 0);
970  opts.range("PMESendOrder", NOT_NEGATIVE);
971  opts.optional("PME", "PMEMinPoints",
972  "minimum points per PME reciprocal sum pencil", &PMEMinPoints, 10000);
973  opts.range("PMEMinPoints", NOT_NEGATIVE);
974  opts.optionalB("main", "PMEBarrier", "Use barrier in PME?",
975  &PMEBarrier, FALSE);
976  opts.optionalB("main", "PMEOffload", "Offload PME to accelerator?",
977  &PMEOffload);
978 
979  opts.optionalB("PME", "usePMECUDA", "Use the PME CUDA version", &usePMECUDA, CmiNumPhysicalNodes() < 5);
980 
981 #ifdef DPME
982  opts.optionalB("PME", "useDPME", "Use old DPME code?", &useDPME, FALSE);
983 #else
984  useDPME = 0;
985 #endif
986  opts.optionalB("main", "FFTWPatient", "Use intensive plan creation to optimize FFTW?",
987 #ifdef WIN32
988  &FFTWPatient, TRUE);
989 #else
990  &FFTWPatient, FALSE);
991 #endif
992 
993  opts.optionalB("main", "FFTWEstimate", "Use estimates to optimize FFTW?",
994 #ifdef WIN32
995  &FFTWEstimate, TRUE);
996 #else
997  &FFTWEstimate, FALSE);
998 #endif
999  opts.optionalB("main", "FFTWUseWisdom", "Read/save wisdom file for FFTW?",
1000 #ifdef WIN32
1001  &FFTWUseWisdom, FALSE);
1002 #else
1003  &FFTWUseWisdom, TRUE);
1004 #endif
1005  opts.optional("FFTWUseWisdom", "FFTWWisdomFile", "File for FFTW wisdom",
1006  FFTWWisdomFile);
1007 
1008  opts.optionalB("main", "useAVXTiles",
1009  "Use \"Tiles\" mode for AVX-512 optimized calculations",
1010  &useAVXTiles, TRUE);
1011 }
1012 
1013 void SimParameters::config_parser_methods(ParseOptions &opts) {
1014 
1016  opts.optionalB("main", "minimization", "Should minimization be performed?",
1017  &minimizeCGOn, FALSE);
1018  opts.optionalB("main", "minVerbose", "Print extra minimization diagnostics?",
1019  &minVerbose, FALSE);
1020  opts.optional("main", "minTinyStep", "very first minimization steps",
1021  &minTinyStep, 1.0e-6);
1022  opts.range("minTinyStep", POSITIVE);
1023  opts.optional("main", "minBabyStep", "initial minimization steps",
1024  &minBabyStep, 1.0e-2);
1025  opts.range("minBabyStep", POSITIVE);
1026  opts.optional("main", "minLineGoal", "line minimization gradient reduction",
1027  &minLineGoal, 1.0e-3);
1028  opts.range("minLineGoal", POSITIVE);
1029 
1030  opts.optionalB("main", "velocityQuenching",
1031  "Should old-style minimization be performed?", &minimizeOn, FALSE);
1032 
1033  opts.optional("main", "maximumMove", "Maximum atom movement per step", &maximumMove, 0.0);
1034  opts.range("maximumMove", NOT_NEGATIVE);
1035  opts.units("maximumMove", N_ANGSTROM);
1036 
1037  opts.optionalB("main", "Langevin", "Should Langevin dynamics be performed?",
1038  &langevinOn, FALSE);
1039  opts.require("Langevin", "langevinTemp", "Temperature for heat bath in Langevin "
1040  "dynamics", &langevinTemp);
1041  opts.range("langevinTemp", NOT_NEGATIVE);
1042  opts.units("langevinTemp", N_KELVIN);
1043  opts.optional("Langevin", "langevinDamping", "Damping coefficient (1/ps)",
1044  &langevinDamping);
1045  opts.range("langevinDamping", POSITIVE);
1046  opts.optionalB("Langevin", "langevinHydrogen", "Should Langevin dynamics be applied to hydrogen atoms?",
1047  &langevinHydrogen);
1048  opts.optional("Langevin", "langevinFile", "PDB file with temperature "
1049  "coupling terms (B(i)) (default is the PDB input file)",
1050  PARSE_STRING);
1051  opts.optional("Langevin", "langevinCol", "Column in the langevinFile "
1052  "containing the temperature coupling term B(i);\n"
1053  "default is 'O'", PARSE_STRING);
1054 
1055  // use BAOAB integration instead of BBK
1056  opts.optionalB("Langevin", "langevinBAOAB",
1057  "Should Langevin dynamics be performed using BAOAB integration?",
1058  &langevin_useBAOAB, FALSE);
1059 
1060 // BEGIN LA
1061  opts.optionalB("main", "LoweAndersen", "Should Lowe-Andersen dynamics be performed?",
1062  &loweAndersenOn, FALSE);
1063  opts.require("LoweAndersen", "loweAndersenTemp", "Temperature for heat bath in Lowe-Andersen "
1064  "dynamics", &loweAndersenTemp);
1065  opts.range("loweAndersenTemp", NOT_NEGATIVE);
1066  opts.units("loweAndersenTemp", N_KELVIN);
1067  opts.optional("LoweAndersen", "loweAndersenRate", "Collision rate (1/ps)",
1068  &loweAndersenRate, 50);
1069  opts.range("loweAndersenRate", POSITIVE);
1070  opts.optional("LoweAndersen", "loweAndersenCutoff", "Cutoff radius",
1071  &loweAndersenCutoff, 2.7);
1072  opts.range("loweAndersenCutoff", POSITIVE);
1073  opts.units("loweAndersenCutoff", N_ANGSTROM);
1074 // END LA
1075 
1076 //fepb
1077  opts.optionalB("main", "alch", "Is achemical simulation being performed?",
1078  &alchOn, FALSE);
1079  opts.require("alch", "alchLambda", "Alchemical coupling parameter value",
1080  &alchLambda);
1081  opts.range("alchLambda", NOT_NEGATIVE);
1082 
1083  opts.optionalB("alch", "singleTopology",
1084  "Is single topology used for relative free energy?", &singleTopology, FALSE);
1085 
1086  opts.optionalB("alch", "sdBondScaling",
1087  "Is S-D bonded terms scaling for relative free energy?", &sdScaling, FALSE);
1088 
1089  opts.optional("alch", "alchFile", "PDB file with perturbation flags "
1090  "default is the input PDB file", PARSE_STRING);
1091  opts.optional("alch", "alchCol", "Column in the alchFile with the "
1092  "perturbation flag", PARSE_STRING);
1093 
1094  opts.optional("alch", "unperturbedBondFile", "mini psf file with unperturbed bond info"
1095  " ", PARSE_STRING);
1096  opts.optional("alch", "alchOutFreq", "Frequency of alchemical energy"
1097  "output in timesteps", &alchOutFreq, 5);
1098  opts.range("alchoutfreq", NOT_NEGATIVE);
1099  opts.optional("alch", "alchOutFile", "Alchemical energy output filename",
1100  alchOutFile);
1101 
1102  // soft-core parameters
1103  opts.optional("alch", "alchVdwShiftCoeff", "Coeff used for generating"
1104  "the altered alchemical vDW interactions", &alchVdwShiftCoeff, 5.);
1105  opts.range("alchVdwShiftCoeff", NOT_NEGATIVE);
1106 
1107  opts.optionalB("alch", "alchWCA", "Is WCA decomposition being performed?",
1108  &alchWCAOn, FALSE);
1109 
1110  // scheduling options for different interaction types
1111  opts.optional("alch", "alchElecLambdaStart", "Lambda at which electrostatic"
1112  "scaling of exnihilated particles begins", &alchElecLambdaStart, 0.5);
1113  opts.range("alchElecLambdaStart", NOT_NEGATIVE);
1114 
1115  opts.optional("alch", "alchVdwLambdaEnd", "Lambda at which vdW"
1116  "scaling of exnihilated particles ends", &alchVdwLambdaEnd, 1.0);
1117  opts.range("alchVdwLambdaEnd", NOT_NEGATIVE);
1118 
1119  opts.optional("alch", "alchRepLambdaEnd", "Lambda at which repulsive vdW"
1120  "scaling of exnihilated particles ends and attractive vdW scaling"
1121  "begins", &alchRepLambdaEnd, 0.5);
1122  opts.range("alchRepLambdaEnd", NOT_NEGATIVE);
1123 
1124  opts.optional("alch", "alchBondLambdaEnd", "Lambda at which bonded"
1125  "scaling of exnihilated particles begins", &alchBondLambdaEnd, 0.0);
1126  opts.range("alchBondLambdaEnd", NOT_NEGATIVE);
1127 
1128  opts.optionalB("alch", "alchDecouple", "Enable alchemical decoupling?",
1129  &alchDecouple, FALSE);
1130  opts.optionalB("alch", "alchBondDecouple", "Enable decoupling of purely "
1131  "alchemical bonds?", &alchBondDecouple, FALSE);
1132 
1133  // parameters for alchemical analysis options
1134  opts.optional("alch", "alchType", "Which alchemical method to use?",
1135  PARSE_STRING);
1136  opts.optional("alch", "alchLambda2", "Alchemical coupling comparison value",
1137  &alchLambda2, -1);
1138  opts.optional("alch", "alchLambdaIDWS", "Alchemical coupling comparison value for interleaved double-wide sampling",
1139  &alchLambdaIDWS, -1);
1140  opts.optional("alch", "alchLambdaFreq",
1141  "Frequency of increasing coupling parameter value", &alchLambdaFreq, 0);
1142  opts.range("alchLambdaFreq", NOT_NEGATIVE);
1143  opts.optional("alch", "alchSwitchType", "Switching type flag",
1144  PARSE_STRING);
1145  opts.optional("alch", "alchEquilSteps", "Equilibration steps, before "
1146  "data collection in the alchemical window", &alchEquilSteps, 0);
1147  opts.range("alchEquilSteps", NOT_NEGATIVE);
1148 
1149  opts.optionalB("alch", "alchEnsembleAvg", "Ensemble Average in use?",
1150  &alchEnsembleAvg, TRUE);
1151 //fepe
1152 
1153  opts.optionalB("main", "les", "Is locally enhanced sampling enabled?",
1154  &lesOn, FALSE);
1155  opts.require("les", "lesFactor", "Local enhancement factor", &lesFactor);
1156  opts.optional("les", "lesFile", "PDB file with enhancement flags "
1157  "default is the input PDB file", PARSE_STRING);
1158  opts.optional("les", "lesCol", "Column in the lesFile with the "
1159  "enhancement flag", PARSE_STRING);
1160  opts.optionalB("les", "lesReduceTemp", "Reduce enhanced atom temperature?",
1161  &lesReduceTemp, FALSE);
1162  opts.optionalB("les", "lesReduceMass", "Reduce enhanced atom mass?",
1163  &lesReduceMass, FALSE);
1164 
1165  // REST2 (replica exchange solute tempering) parameters
1166  opts.optionalB("main", "soluteScaling",
1167  "Is replica exchange solute tempering enabled?",
1168  &soluteScalingOn, FALSE);
1169  opts.optional("soluteScaling", "soluteScalingFactor",
1170  "Solute scaling factor",
1171  &soluteScalingFactor, 1.0);
1172  opts.range("soluteScalingFactor", NOT_NEGATIVE);
1173  opts.optional("soluteScaling", "soluteScalingFactorCharge",
1174  "Solute scaling factor for electrostatic interactions",
1175  &soluteScalingFactorCharge);
1176  opts.range("soluteScalingFactorCharge", NOT_NEGATIVE);
1177  opts.optional("soluteScaling", "soluteScalingFactorVdw",
1178  "Solute scaling factor for van der Waals interactions",
1179  &soluteScalingFactorVdw);
1180  opts.range("soluteScalingFactorVdw", NOT_NEGATIVE);
1181  opts.optional("soluteScaling", "soluteScalingFile",
1182  "PDB file with scaling flags; if undefined, defaults to main PDB file",
1183  PARSE_STRING);
1184  opts.optional("soluteScaling", "soluteScalingCol",
1185  "Column in the soluteScalingFile providing the scaling flag",
1186  PARSE_STRING);
1187  opts.optionalB("main", "soluteScalingAll",
1188  "Apply scaling also to bond and angle interactions?",
1189  &soluteScalingAll, FALSE);
1190 
1191  // Drude oscillators
1192  opts.optionalB("main", "drude", "Perform integration of Drude oscillators?",
1193  &drudeOn, FALSE);
1194  opts.require("drude", "drudeTemp", "Temperature for freezing "
1195  "Drude oscillators", &drudeTemp);
1196  opts.range("drudeTemp", NOT_NEGATIVE);
1197  opts.units("drudeTemp", N_KELVIN);
1198  opts.optional("drude", "drudeDamping", "Damping coefficient (1/ps) for "
1199  "Drude oscillators", &drudeDamping);
1200  opts.range("drudeDamping", POSITIVE);
1201  opts.optional("drude", "drudeNbtholeCut", "Nonbonded Thole interactions "
1202  "interaction radius", &drudeNbtholeCut, 5.0);
1203  opts.range("drudeNbtholeCut", POSITIVE);
1204  opts.optionalB("drude", "drudeHardWall", "Apply maximum Drude bond length "
1205  "restriction?", &drudeHardWallOn, TRUE);
1206  opts.optional("drude", "drudeBondLen", "Drude oscillator bond length "
1207  "beyond which to apply restraint", &drudeBondLen, 0.25);
1208  opts.range("drudeBondLen", POSITIVE);
1209  opts.optional("drude", "drudeBondConst", "Drude oscillator restraining "
1210  "force constant", &drudeBondConst, 40000.0);
1211  opts.range("drudeBondConst", POSITIVE);
1212 
1213  // Pair interaction calculations
1214  opts.optionalB("main", "pairInteraction",
1215  "Are pair interactions calculated?", &pairInteractionOn, FALSE);
1216  opts.optional("pairInteraction", "pairInteractionFile",
1217  "PDB files with interaction flags " "default is the input PDB file",
1218  PARSE_STRING);
1219  opts.optional("pairInteraction", "pairInteractionCol",
1220  "Column in the pairInteractionFile with the interaction flags",
1221  PARSE_STRING);
1222  opts.require("pairInteraction", "pairInteractionGroup1",
1223  "Flag for interaction group 1", &pairInteractionGroup1);
1224  opts.optional("pairInteraction", "pairInteractionGroup2",
1225  "Flag for interaction group 2", &pairInteractionGroup2, -1);
1226  opts.optionalB("pairInteraction", "pairInteractionSelf",
1227  "Compute only within-group interactions?", &pairInteractionSelf,
1228  FALSE);
1229  // Options for CG simulations
1230  opts.optionalB("main", "cosAngles", "Are some angles cosine-based?", &cosAngles, FALSE);
1231 
1232 
1233  // Dihedral angle dynamics
1234  opts.optionalB("main", "globalTest", "Should global integration (for development) be used?",
1235  &globalOn, FALSE);
1236  opts.optionalB("main", "dihedral", "Should dihedral angle dynamics be performed?",
1237  &dihedralOn, FALSE);
1238  COLDOn = FALSE;
1239  opts.optionalB("dihedral", "COLD", "Should overdamped Langevin dynamics be performed?",
1240  &COLDOn, FALSE);
1241  opts.require("COLD", "COLDTemp", "Temperature for heat bath in COLD",
1242  &COLDTemp);
1243  opts.range("COLDTemp", NOT_NEGATIVE);
1244  opts.units("COLDTemp", N_KELVIN);
1245  opts.require("COLD", "COLDRate", "Damping rate for COLD",
1246  &COLDRate, 3000.0);
1247  opts.range("COLDRate", NOT_NEGATIVE);
1248 
1249  // Get the parameters for temperature coupling
1250  opts.optionalB("main", "tcouple",
1251  "Should temperature coupling be performed?",
1252  &tCoupleOn, FALSE);
1253  opts.require("tcouple", "tCoupleTemp",
1254  "Temperature for temperature coupling", &tCoupleTemp);
1255  opts.range("tCoupleTemp", NOT_NEGATIVE);
1256  opts.units("tCoupleTemp", N_KELVIN);
1257  opts.optional("tCouple", "tCoupleFile", "PDB file with temperature "
1258  "coupling terms (B(i)) (default is the PDB input file)",
1259  PARSE_STRING);
1260  opts.optional("tCouple", "tCoupleCol", "Column in the tCoupleFile "
1261  "containing the temperature coupling term B(i);\n"
1262  "default is 'O'", PARSE_STRING);
1263 
1264  opts.optionalB("main", "stochRescale",
1265  "Should stochastic velocity rescaling be performed?",
1266  &stochRescaleOn, FALSE);
1267  opts.require("stochRescale", "stochRescaleTemp",
1268  "Temperature for stochastic velocity rescaling",
1269  &stochRescaleTemp);
1270  opts.range("stochRescaleTemp", NOT_NEGATIVE);
1271  opts.units("stochRescaleTemp", N_KELVIN);
1272  opts.require("stochRescale", "stochRescalePeriod",
1273  "Time scale for stochastic velocity rescaling (ps)",
1274  &stochRescalePeriod);
1275  opts.range("stochRescalePeriod", POSITIVE);
1276  opts.optional("stochRescale", "stochRescaleFreq",
1277  "Number of steps between stochastic rescalings",
1278  &stochRescaleFreq);
1279  opts.range("stochRescaleFreq", POSITIVE);
1280  opts.optionalB("stochRescale", "stochRescaleHeat",
1281  "Should heat transfer and work be computed?", &stochRescaleHeat, FALSE);
1282 
1283  opts.optional("main", "rescaleFreq", "Number of steps between "
1284  "velocity rescaling", &rescaleFreq);
1285  opts.range("rescaleFreq", POSITIVE);
1286  opts.optional("main", "rescaleTemp", "Target temperature for velocity rescaling",
1287  &rescaleTemp);
1288  opts.range("rescaleTemp", NOT_NEGATIVE);
1289  opts.units("rescaleTemp", N_KELVIN);
1290 
1291  opts.optional("main", "reassignFreq", "Number of steps between "
1292  "velocity reassignment", &reassignFreq);
1293  opts.range("reassignFreq", POSITIVE);
1294  opts.optional("main", "reassignTemp", "Target temperature for velocity reassignment",
1295  &reassignTemp);
1296  opts.range("reassignTemp", NOT_NEGATIVE);
1297  opts.units("reassignTemp", N_KELVIN);
1298  opts.optional("main", "reassignIncr", "Temperature increment for velocity reassignment",
1299  &reassignIncr);
1300  opts.units("reassignIncr", N_KELVIN);
1301  opts.optional("main", "reassignHold", "Final holding temperature for velocity reassignment",
1302  &reassignHold);
1303  opts.range("reassignHold", NOT_NEGATIVE);
1304  opts.units("reassignHold", N_KELVIN);
1305 
1307  opts.optionalB("main", "useGroupPressure",
1308  "Use group rather than atomic quantities for pressure control?",
1309  &useGroupPressure, FALSE);
1310 
1312  opts.optionalB("main", "useFlexibleCell",
1313  "Use anisotropic cell fluctuation for pressure control?",
1314  &useFlexibleCell, FALSE);
1315 
1316  // Fix specific cell dimensions
1317  opts.optionalB("main", "fixCellDims",
1318  "Fix some cell dimensions?",
1319  &fixCellDims, FALSE);
1320 
1321  opts.optionalB("fixCellDims", "fixCellDimX",
1322  "Fix the X dimension?",
1323  &fixCellDimX, FALSE);
1324  opts.optionalB("fixCellDims", "fixCellDimY",
1325  "Fix the Y dimension?",
1326  &fixCellDimY, FALSE);
1327  opts.optionalB("fixCellDims", "fixCellDimZ",
1328  "Fix the Z dimension?",
1329  &fixCellDimZ, FALSE);
1330 
1332  opts.optionalB("main", "useConstantRatio",
1333  "Use constant X-Y ratio for pressure control?",
1334  &useConstantRatio, FALSE);
1335 
1337  opts.optionalB("main", "useConstantArea",
1338  "Use constant area for pressure control?",
1339  &useConstantArea, FALSE);
1340 
1342  opts.optionalB("main", "excludeFromPressure",
1343  "Should some atoms be excluded from pressure rescaling?",
1344  &excludeFromPressure, FALSE);
1345  opts.optional("excludeFromPressure", "excludeFromPressureFile",
1346  "PDB file for atoms to be excluded from pressure",
1347  PARSE_STRING);
1348  opts.optional("excludeFromPressure", "excludeFromPressureCol",
1349  "Column in the excludeFromPressureFile"
1350  "containing the flags (nonzero means excluded);\n"
1351  "default is 'O'", PARSE_STRING);
1352 
1354  opts.optionalB("main", "BerendsenPressure",
1355  "Should Berendsen pressure bath coupling be performed?",
1356  &berendsenPressureOn, FALSE);
1357  opts.require("BerendsenPressure", "BerendsenPressureTarget",
1358  "Target pressure for pressure coupling",
1359  &berendsenPressureTarget);
1360  // opts.units("BerendsenPressureTarget",);
1361  opts.require("BerendsenPressure", "BerendsenPressureCompressibility",
1362  "Isothermal compressibility for pressure coupling",
1363  &berendsenPressureCompressibility);
1364  // opts.units("BerendsenPressureCompressibility",);
1365  opts.require("BerendsenPressure", "BerendsenPressureRelaxationTime",
1366  "Relaxation time for pressure coupling",
1367  &berendsenPressureRelaxationTime);
1368  opts.range("BerendsenPressureRelaxationTime", POSITIVE);
1369  opts.units("BerendsenPressureRelaxationTime", N_FSEC);
1370  opts.optional("BerendsenPressure", "BerendsenPressureFreq",
1371  "Number of steps between volume rescaling",
1372  &berendsenPressureFreq, 1);
1373  opts.range("BerendsenPressureFreq", POSITIVE);
1374 
1376  opts.optionalB("main", "LangevinPiston",
1377  "Should Langevin piston pressure control be used?",
1378  &langevinPistonOn, FALSE);
1379  opts.optionalB("LangevinPiston", "LangevinPistonBarrier",
1380  "Should Langevin piston barrier be used?",
1381  &langevinPistonBarrier, TRUE);
1382  opts.require("LangevinPiston", "LangevinPistonTarget",
1383  "Target pressure for pressure control",
1384  &langevinPistonTarget);
1385  opts.require("LangevinPiston", "LangevinPistonPeriod",
1386  "Oscillation period for pressure control",
1387  &langevinPistonPeriod);
1388  opts.range("LangevinPistonPeriod", POSITIVE);
1389  opts.units("LangevinPistonPeriod", N_FSEC);
1390  opts.require("LangevinPiston", "LangevinPistonDecay",
1391  "Decay time for pressure control",
1392  &langevinPistonDecay);
1393  opts.range("LangevinPistonDecay", POSITIVE);
1394  opts.units("LangevinPistonDecay", N_FSEC);
1395  opts.require("LangevinPiston", "LangevinPistonTemp",
1396  "Temperature for pressure control piston",
1397  &langevinPistonTemp);
1398  opts.range("LangevinPistonTemp", POSITIVE);
1399  opts.units("LangevinPistonTemp", N_KELVIN);
1400  opts.optional("LangevinPiston", "StrainRate",
1401  "Initial strain rate for pressure control (x y z)",
1402  &strainRate);
1403 
1404  // Multigrator temperature and/or pressure control
1405  opts.optionalB("main", "Multigrator",
1406  "Should multigrator temperature and/or pressure control be used?",
1407  &multigratorOn, FALSE);
1408  opts.require("Multigrator", "MultigratorPressureTarget",
1409  "Target pressure for pressure coupling",
1410  &multigratorPressureTarget);
1411  opts.require("Multigrator", "MultigratorTemperatureTarget",
1412  "Target temperature for temperature coupling",
1413  &multigratorTemperatureTarget);
1414  opts.require("Multigrator", "MultigratorPressureFreq",
1415  "Number of steps between pressure control moves",
1416  &multigratorPressureFreq);
1417  opts.range("MultigratorPressureFreq", POSITIVE);
1418  opts.optional("Multigrator", "MultigratorPressureRelaxationTime",
1419  "Relaxation time for pressure coupling is fs",
1420  &multigratorPressureRelaxationTime, 30000);
1421  opts.range("MultigratorPressureRelaxationTime", POSITIVE);
1422  opts.units("MultigratorPressureRelaxationTime", N_FSEC);
1423  opts.optional("Multigrator", "MultigratorTemperatureRelaxationTime",
1424  "Relaxation time for temperature coupling is fs",
1425  &multigratorTemperatureRelaxationTime, 1000);
1426  opts.range("MultigratorTemperatureRelaxationTime", POSITIVE);
1427  opts.units("MultigratorTemperatureRelaxationTime", N_FSEC);
1428  opts.require("Multigrator", "MultigratorTemperatureFreq",
1429  "Number of steps between temperature control moves",
1430  &multigratorTemperatureFreq);
1431  opts.range("MultigratorTemperatureFreq", POSITIVE);
1432  opts.optional("Multigrator", "MultigratorNoseHooverChainLength",
1433  "Nose-Hoover chain length",
1434  &multigratorNoseHooverChainLength, 4);
1435  opts.range("MultigratorNoseHooverChainLength", POSITIVE);
1436 
1438  opts.optional("main", "SurfaceTensionTarget",
1439  "Surface tension in the x-y plane",
1440  &surfaceTensionTarget, 0);
1441 
1443  opts.optionalB("main", "pressureprofile", "Compute pressure profile?",
1444  &pressureProfileOn, FALSE);
1445  opts.require("pressureprofile", "pressureprofileslabs",
1446  "Number of pressure profile slabs", &pressureProfileSlabs, 10);
1447  opts.optional("pressureprofile", "pressureprofilefreq",
1448  "How often to store profile data", &pressureProfileFreq, 1);
1449  opts.optional("pressureprofile", "pressureProfileAtomTypes",
1450  "Number of pressure profile atom types", &pressureProfileAtomTypes, 1);
1451  opts.range("pressureProfileAtomTypes", POSITIVE);
1452  opts.optional("pressureProfile", "pressureProfileAtomTypesFile",
1453  "PDB files with pressure profile atom types" "default is the input PDB file",
1454  PARSE_STRING);
1455  opts.optional("pressureProfile", "pressureProfileAtomTypesCol",
1456  "Column in the pressureProfileAtomTypesFile with the atom types ",
1457  PARSE_STRING);
1458  opts.optionalB("pressureProfile", "pressureProfileEwald",
1459  "Compute Ewald contribution to pressure profile",
1460  &pressureProfileEwaldOn, FALSE);
1461  opts.optional("pressureProfile", "pressureProfileEwaldX",
1462  "Ewald grid size X", &pressureProfileEwaldX, 10);
1463  opts.range("pressureProfileEwaldX", POSITIVE);
1464  opts.optional("pressureProfile", "pressureProfileEwaldY",
1465  "Ewald grid size Y", &pressureProfileEwaldY, 10);
1466  opts.range("pressureProfileEwaldY", POSITIVE);
1467  opts.optional("pressureProfile", "pressureProfileEwaldZ",
1468  "Ewald grid size Z", &pressureProfileEwaldZ, 10);
1469  opts.range("pressureProfileEwaldZ", POSITIVE);
1470 
1472  opts.optionalB("main", "accelMD", "Perform acclerated MD?", &accelMDOn, FALSE);
1473  opts.optional("accelMD", "accelMDFirstStep", "First accelMD step", &accelMDFirstStep, 0);
1474  opts.range("accelMDFirstStep", NOT_NEGATIVE);
1475  opts.optional("accelMD", "accelMDLastStep", "Last accelMD step", &accelMDLastStep, 0);
1476  opts.range("accelMDLastStep", NOT_NEGATIVE);
1477  opts.optional("accelMD", "accelMDOutFreq", "Frequency of accelMD output", &accelMDOutFreq, 1);
1478  opts.range("accelMDOutFreq", POSITIVE);
1479  opts.optionalB("accelMD", "accelMDdihe", "Apply boost to dihedral potential", &accelMDdihe, TRUE);
1480  opts.optionalB("accelMD", "accelMDDebugOn", "Debugging accelMD", &accelMDDebugOn, FALSE);
1481  opts.optional("accelMD", "accelMDE","E for AMD", &accelMDE);
1482  opts.units("accelMDE", N_KCAL);
1483  opts.optional("accelMD", "accelMDalpha","alpha for AMD", &accelMDalpha);
1484  opts.units("accelMDalpha", N_KCAL);
1485  opts.range("accelMDalpha", POSITIVE);
1486  opts.optionalB("accelMD", "accelMDdual", "Apply dual boost", &accelMDdual, FALSE);
1487  opts.optional("accelMDdual", "accelMDTE","E for total potential under accelMDdual mode", &accelMDTE);
1488  opts.units("accelMDTE", N_KCAL);
1489  opts.optional("accelMDdual", "accelMDTalpha","alpha for total potential under accelMDdual mode", &accelMDTalpha);
1490  opts.units("accelMDTalpha", N_KCAL);
1491  opts.range("accelMDTalpha", POSITIVE);
1492  // GaMD parameters
1493  opts.optionalB("accelMD", "accelMDG", "Perform Gaussian accelMD calculation?", &accelMDG, FALSE);
1494  opts.optional("accelMDG", "accelMDGiE", "Flag to set the mode iE in Gaussian accelMD", &accelMDGiE, 1);
1495  opts.optional("accelMDG", "accelMDGcMDSteps", "Number of cMD steps", &accelMDGcMDSteps, 1000000);
1496  opts.range("accelMDGcMDSteps", NOT_NEGATIVE);
1497  opts.optional("accelMDG", "accelMDGEquiSteps", "Number of equilibration steps after adding boost potential", &accelMDGEquiSteps, 1000000);
1498  opts.range("accelMDGEquiSteps", NOT_NEGATIVE);
1499  opts.require("accelMDG", "accelMDGcMDPrepSteps", "Number of preparation cMD steps", &accelMDGcMDPrepSteps, 200000);
1500  opts.range("accelMDGcMDPrepSteps", NOT_NEGATIVE);
1501  opts.require("accelMDG", "accelMDGEquiPrepSteps", "Number of preparation equilibration steps", &accelMDGEquiPrepSteps, 200000);
1502  opts.range("accelMDGEquiPrepSteps", NOT_NEGATIVE);
1503  opts.optional("accelMDG", "accelMDGStatWindow", "Number of steps to calculate avg and std", &accelMDGStatWindow, -1);
1504  opts.optional("accelMDG", "accelMDGSigma0P", "Upper limit of std of total potential", &accelMDGSigma0P, 6.0);
1505  opts.units("accelMDGSigma0P", N_KCAL);
1506  opts.range("accelMDGSigma0P", NOT_NEGATIVE);
1507  opts.optional("accelMDG", "accelMDGSigma0D", "Upper limit of std of dihedral potential", &accelMDGSigma0D, 6.0);
1508  opts.units("accelMDGSigma0D", N_KCAL);
1509  opts.range("accelMDGSigma0D", NOT_NEGATIVE);
1510  opts.optionalB("accelMDG", "accelMDGRestart", "Flag to set use restart file in Gaussian accelMD", &accelMDGRestart, FALSE);
1511  opts.require("accelMDGRestart", "accelMDGRestartFile", "Restart file name for Gaussian accelMD", accelMDGRestartFile);
1512  opts.optionalB("accelMDG", "accelMDGresetVaftercmd", "Flag to reset potential after accelMDGcMDSteps steps",
1513  &accelMDGresetVaftercmd, FALSE);
1514 
1515  // Adaptive Temperature Sampling (adaptTemp) parameters
1516  opts.optionalB("main", "adaptTempMD", "Perform adaptive temperature sampling", &adaptTempOn, FALSE);
1517  opts.optional("adaptTempMD", "adaptTempFirstStep", "First adaptTemp step", &adaptTempFirstStep, 0);
1518  opts.range("adaptTempFirstStep", NOT_NEGATIVE);
1519  opts.optional("adaptTempMD", "adaptTempLastStep", "Last adaptTemp step", &adaptTempLastStep, 0);
1520  opts.range("adaptTempLastStep", NOT_NEGATIVE);
1521  opts.optional("adaptTempMD", "adaptTempOutFreq", "Frequency of adaptTemp output", &adaptTempOutFreq, 10);
1522  opts.range("adaptTempOutFreq", POSITIVE);
1523  opts.optional("adaptTempMD", "adaptTempFreq", "Frequency of writing average energies to adaptTempOutFile", &adaptTempFreq, 10);
1524  opts.range("adaptTempFreq", POSITIVE);
1525  opts.optionalB("adaptTempMD", "adaptTempDebug", "Print debug output for adaptTemp", &adaptTempDebug, FALSE);
1526  opts.optional("adaptTempMD", "adaptTempTmin","Minimun temperature for adaptTemp", &adaptTempTmin);
1527  opts.units("adaptTempTmin", N_KELVIN);
1528  opts.range("adaptTempTmin", POSITIVE);
1529  opts.optional("adaptTempMD", "adaptTempTmax","Maximum temperature for adaptTemp", &adaptTempTmax);
1530  opts.units("adaptTempTmax", N_KELVIN);
1531  opts.range("adaptTempTmax", POSITIVE);
1532  opts.optional("adaptTempMD", "adaptTempBins","Number of bins to store average energies", &adaptTempBins,0);
1533  opts.range("adaptTempBins", NOT_NEGATIVE);
1534  opts.optional("adaptTempMD", "adaptTempDt", "Integration timestep for Temp. updates", &adaptTempDt, 0.0001);
1535  opts.units("adaptTempDt", N_FSEC);
1536  opts.range("adaptTempDt", NOT_NEGATIVE);
1537  opts.optional("adaptTempMD", "adaptTempAutoDt", "Average temperature update in percent of temperature range", &adaptTempAutoDt, 0.0);
1538  opts.range("adaptTempAutoDt", NOT_NEGATIVE);
1539  opts.optional("adaptTempMD", "adaptTempCgamma", "Adaptive bin averaging constant", &adaptTempCgamma, 0.1);
1540  opts.range("adaptTempCgamma", NOT_NEGATIVE);
1541  opts.optionalB("adaptTempMD","adaptTempLangevin","Send adaptTemp temperature to langevin thermostat",&adaptTempLangevin,TRUE);
1542  opts.optionalB("adaptTempMD","adaptTempRescaling","Send adaptTemp temperature to velocity rescaling thermostat", &adaptTempRescale,TRUE);
1543  opts.optional("adaptTempMD", "adaptTempInFile", "File containing restart information for adaptTemp", adaptTempInFile);
1544  opts.optional("adaptTempMD", "adaptTempRestartFile", "File for writing adaptTemp restart information", adaptTempRestartFile);
1545  opts.require("adaptTempRestartFile","adaptTempRestartFreq", "Frequency of writing restart file", &adaptTempRestartFreq,0);
1546  opts.range("adaptTempRestartFreq",NOT_NEGATIVE);
1547  opts.optionalB("adaptTempMD", "adaptTempRandom", "Randomly assign a temperature if we step out of range", &adaptTempRandom, FALSE);
1548 }
1549 
1550 void SimParameters::config_parser_constraints(ParseOptions &opts) {
1551 
1553  opts.optionalB("main", "fixedatoms", "Are there fixed atoms?",
1554  &fixedAtomsOn, FALSE);
1555  opts.optionalB("fixedatoms", "fixedAtomsForces",
1556  "Calculate forces between fixed atoms? (Required to unfix during run.)",
1557  &fixedAtomsForces, FALSE);
1558  opts.optional("fixedatoms", "fixedAtomsFile", "PDB file with flags for "
1559  "fixed atoms (default is the PDB input file)",
1560  PARSE_STRING);
1561  opts.optional("fixedatoms", "fixedAtomsCol", "Column in the fixedAtomsFile "
1562  "containing the flags (nonzero means fixed);\n"
1563  "default is 'O'", PARSE_STRING);
1564  opts.optional("fixedatoms", "fixedAtomListFile", "the text input file for fixed atoms "
1565  "used for parallel input IO", PARSE_STRING);
1566  opts.optionalB("fixedatoms", "fixedAtomsForceOutput",
1567  "Do we write out forces acting on fixed atoms?",
1568  &fixedAtomsForceOutput, FALSE);
1569 
1571  opts.optionalB("main", "constraints", "Are harmonic constraints active?",
1572  &constraintsOn, FALSE);
1573  opts.require("constraints", "consexp", "Exponent for harmonic potential",
1574  &constraintExp, 2);
1575  opts.range("consexp", POSITIVE);
1576 #ifndef MEM_OPT_VERSION
1577  opts.require("constraints", "consref", "PDB file containing reference "
1578  "positions",
1579  PARSE_STRING);
1580  opts.require("constraints", "conskfile", "PDB file containing force "
1581  "constaints in one of the columns", PARSE_STRING);
1582  opts.require("constraints", "conskcol", "Column of conskfile to use "
1583  "for the force constants", PARSE_STRING);
1584 #else
1585  opts.require("constraints", "consAtomListFile", "the text input file for constrained atoms "
1586  "used for parallel input IO", PARSE_STRING);
1587 #endif
1588  opts.require("constraints", "constraintScaling", "constraint scaling factor",
1589  &constraintScaling, 1.0);
1590  opts.range("constraintScaling", NOT_NEGATIVE);
1591 
1592 
1593 
1594  //****** BEGIN selective restraints (X,Y,Z) changes
1595 
1597  opts.optionalB("constraints", "selectConstraints",
1598  "Restrain only selected Cartesian components of the coordinates?",
1599  &selectConstraintsOn, FALSE);
1600  opts.optionalB("selectConstraints", "selectConstrX",
1601  "Restrain X components of coordinates ", &constrXOn, FALSE);
1602  opts.optionalB("selectConstraints", "selectConstrY",
1603  "Restrain Y components of coordinates ", &constrYOn, FALSE);
1604  opts.optionalB("selectConstraints", "selectConstrZ",
1605  "Restrain Z components of coordinates ", &constrZOn, FALSE);
1606  //****** END selective restraints (X,Y,Z) changes
1607 
1608  // spherical constraints
1609  opts.optionalB("constraints", "sphericalConstraints",
1610  "Restrain only radial spherical component of the coordinates?",
1611  &sphericalConstraintsOn, FALSE);
1612  opts.optional("sphericalConstraints", "sphericalConstrCenter",
1613  "Center of spherical constraints", &sphericalConstrCenter);
1614 
1615  //****** BEGIN moving constraints changes
1616 
1618  opts.optionalB("constraints", "movingConstraints",
1619  "Are some of the constraints moving?",
1620  &movingConstraintsOn, FALSE);
1621  opts.require("movingConstraints", "movingConsVel",
1622  "Velocity of the movement, A/timestep", &movingConsVel);
1623  //****** END moving constraints changes
1624 
1625  // BEGIN rotating constraints changes
1626  opts.optionalB("constraints", "rotConstraints",
1627  "Are the constraints rotating?",
1628  &rotConstraintsOn, FALSE);
1629  opts.require("rotConstraints", "rotConsAxis",
1630  "Axis of rotation", &rotConsAxis);
1631  opts.require("rotConstraints", "rotConsPivot",
1632  "Pivot point of rotation",
1633  &rotConsPivot);
1634  opts.require("rotConstraints", "rotConsVel",
1635  "Velocity of rotation, deg/timestep", &rotConsVel);
1636 
1637  // END rotating constraints changes
1638 
1639  // external command forces
1640  opts.optionalB("main", "extForces", "External command forces?",
1641  &extForcesOn, FALSE);
1642  opts.require("extForces", "extForcesCommand",
1643  "External forces command", extForcesCommand);
1644  opts.require("extForces", "extCoordFilename",
1645  "External forces coordinate filename", extCoordFilename);
1646  opts.require("extForces", "extForceFilename",
1647  "External forces force filename", extForceFilename);
1648 
1649 
1650  // QM/MM forces
1651  opts.optionalB("main", "QMForces", "Apply QM forces?",
1652  &qmForcesOn, FALSE);
1653  opts.require("QMForces", "QMSoftware",
1654  "software whose format will be used for input/output", qmSoftware);
1655  opts.require("QMForces", "QMExecPath",
1656  "path to executable", qmExecPath);
1657  opts.optional("QMForces", "QMChargeMode",
1658  "type of QM atom charges gathered from the QM software", qmChrgModeS);
1659  opts.require("QMForces", "QMColumn",
1660  "column defining QM and MM regions", qmColumn);
1661  opts.require("QMForces", "QMBaseDir",
1662  "base path and name for QM input and output (preferably in memory)", qmBaseDir);
1663  opts.optional("QMForces", "QMConfigLine",
1664  "Configuration line for QM (multiple inputs allowed)", PARSE_MULTIPLES);
1665  opts.optional("QMForces", "QMParamPDB",
1666  "PDB with QM parameters", qmParamPDB);
1667  opts.optional("QMForces", "QMPrepProc",
1668  "initial preparation executable", qmPrepProc);
1669  opts.optional("QMForces", "QMSecProc",
1670  "secondary executable", qmSecProc);
1671  opts.optional("QMForces", "QMCharge",
1672  "charge of the QM group", PARSE_MULTIPLES);
1673  opts.optionalB("QMForces", "QMChargeFromPSF",
1674  "gets charge of the QM group form PSF values", &qmChrgFromPSF, FALSE);
1675  opts.optional("QMForces", "QMMult",
1676  "multiplicity of the QM group", PARSE_MULTIPLES);
1677  opts.optional("QMForces", "QMLinkElement",
1678  "element of link atom", PARSE_MULTIPLES);
1679  opts.optionalB("QMForces", "QMReplaceAll",
1680  "replace all NAMD forces with QM forces", &qmReplaceAll, FALSE);
1681  opts.optional("QMForces", "QMPCStride",
1682  "frequency of selection of point charges", &qmPCSelFreq, 1);
1683  opts.range("QMPCStride", POSITIVE);
1684  opts.optionalB("QMForces", "QMNoPntChrg",
1685  "no point charges will be passed to the QM system(s)", &qmNoPC, FALSE);
1686  opts.optionalB("QMForces", "QMElecEmbed",
1687  "activates electrostatic embedding", &qmElecEmbed, TRUE);
1688  opts.optionalB("QMForces", "QMVdWParams",
1689  "use special VdW parameters for QM atoms", &qmVDW, FALSE);
1690  opts.optional("QMForces", "QMBondColumn",
1691  "column defining QM-MM bomnds", qmBondColumn);
1692  opts.optionalB("QMForces", "QMBondDist",
1693  "values in QMBondColumn defines the distance of new link atom", &qmBondDist, FALSE);
1694  opts.optional("QMForces", "QMBondValueType",
1695  "type of value in bond column: len or ratio", qmBondValueTypeS);
1696  opts.optional("QMForces", "QMBondScheme",
1697  "type of treatment given to QM-MM bonds.", qmBondSchemeS);
1698  opts.optional("QMForces", "QMenergyStride",
1699  "frequency of QM specific energy output (every x steps)", &qmEnergyOutFreq, 1);
1700  opts.optional("QMForces", "QMOutStride",
1701  "frequency of QM specific charge output (every x steps)", &qmOutFreq, 0);
1702  opts.range("QMOutStride", NOT_NEGATIVE);
1703  opts.optional("QMForces", "QMPositionOutStride",
1704  "frequency of QM specific position output (every x steps)", &qmPosOutFreq, 0);
1705  opts.range("QMPositionOutStride", NOT_NEGATIVE);
1706  opts.optional("QMForces", "QMSimsPerNode",
1707  "QM executions per node", &qmSimsPerNode, 1);
1708  opts.range("QMSimsPerNode", POSITIVE);
1709  opts.optionalB("QMForces", "QMSwitching",
1710  "apply switching to point charges.", &qmPCSwitchOn, FALSE);
1711  opts.optional("QMForces", "QMSwitchingType",
1712  "How are charges scaled down to be presented to QM groups.", qmPCSwitchTypeS);
1713  opts.optional("QMForces", "QMPointChargeScheme",
1714  "type of treatment given to the total sum of point charges.", qmPCSchemeS);
1715  opts.optionalB("QMForces", "QMCustomPCSelection",
1716  "custom and fixed selection of point charges per QM group.", &qmCustomPCSel, FALSE);
1717  opts.optional("QMForces", "QMCustomPCFile",
1718  "file with a selection of point charges for a single QM group", PARSE_MULTIPLES);
1719  opts.optionalB("QMForces", "QMLiveSolventSel",
1720  "Continuously update the selection of solvent molecules in QM groups", &qmLSSOn, FALSE);
1721  opts.optional("QMForces", "QMLSSFreq",
1722  "frequency of QM water selection update", &qmLSSFreq, 100);
1723  opts.range("QMLSSFreq", POSITIVE);
1724  opts.optional("QMForces", "QMLSSResname",
1725  "residue name for the solvent molecules (TIP3).", qmLSSResname);
1726  opts.optional("QMForces", "QMLSSMode",
1727  "mode of selection of point solvent molecules", qmLSSModeS);
1728  opts.optional("QMForces", "QMLSSRef",
1729  "for COM mode, defines reference for COM distance calculation", PARSE_MULTIPLES);
1730  opts.optionalB("QMForces", "QMCSMD",
1731  "Do we use Conditional SMD option?", &qmCSMD, FALSE);
1732  opts.optional("QMForces", "QMCSMDFile",
1733  "File for Conditional SMD information",qmCSMDFile);
1734 
1735  //print which bad contacts are being moved downhill
1736  opts.optionalB("main", "printBadContacts", "Print atoms with huge forces?",
1737  &printBadContacts, FALSE);
1738 
1739  /* GBIS generalized born implicit solvent*/
1740 
1741  opts.optionalB("main", "GBIS", "Use GB implicit solvent?",
1742  &GBISOn, FALSE);
1743  opts.optionalB("main", "GBISSer", "Use GB implicit solvent?",
1744  &GBISserOn, FALSE);
1745 
1746  opts.optional("GBIS", "solventDielectric",
1747  "Solvent Dielectric", &solvent_dielectric, 78.5);
1748  opts.optional("GBIS", "intrinsicRadiusOffset",
1749  "Coulomb Radius Offset", &coulomb_radius_offset, 0.09);
1750  opts.optional("GBIS", "ionConcentration",
1751  "Ion Concentration", &ion_concentration, 0.2); //0.2 mol/L
1752  opts.optional("GBIS", "GBISDelta",
1753  "delta from GBOBC", &gbis_delta, 1.0); //0.8 or 1.0
1754  opts.optional("GBIS", "GBISBeta",
1755  "beta from GBOBC", &gbis_beta, 0.8); //0.0 or 0.8
1756  opts.optional("GBIS", "GBISGamma",
1757  "gamma from GBOBC", &gbis_gamma, 4.85);//2.290912 or 4.85
1758  opts.optional("GBIS", "alphaCutoff",
1759  "cutoff for calculating effective born radius", &alpha_cutoff, 15);
1760  opts.optional("GBIS", "alphaMax",
1761  "maximum allowable born radius", &alpha_max, 30);
1762  opts.optional("GBIS", "fsMax",
1763  "maximum screened intrinsic radius", &fsMax, 1.728);
1764 
1765  opts.optionalB("main", "SASA", "Use Linear Combination of Pairwise Overlaps (LCPO) for calculating SASA",
1766  &LCPOOn, FALSE);
1767  opts.optional("SASA", "surfaceTension",
1768  "Surfce Tension for SASA (kcal/mol/Ang^2)", &surface_tension, 0.005);
1769 
1770  //****** BEGIN SMD constraints changes
1771 
1772  // SMD constraints
1773  opts.optionalB("main", "SMD",
1774  "Do we use SMD option?",
1775  &SMDOn, FALSE);
1776  opts.require("SMD", "SMDVel",
1777  "Velocity of the movement, A/timestep", &SMDVel);
1778  opts.range("SMDVel", NOT_NEGATIVE);
1779  opts.require("SMD", "SMDDir",
1780  "Direction of movement", &SMDDir);
1781  opts.require("SMD", "SMDk",
1782  "Elastic constant for SMD", &SMDk);
1783  opts.optional("SMD", "SMDk2",
1784  "Transverse elastic constant for SMD", &SMDk2, 0);
1785  opts.range("SMDk", NOT_NEGATIVE);
1786  opts.range("SMDk2", NOT_NEGATIVE);
1787  opts.require("SMD", "SMDFile",
1788  "File for SMD information",
1789  SMDFile);
1790  opts.optional("SMD", "SMDOutputFreq",
1791  "Frequency of output",
1792  &SMDOutputFreq, 1);
1793  opts.range("SMDOutputFreq", POSITIVE);
1794 
1795  //****** END SMD constraints changes
1796 
1797  //****** BEGIN tabulated energies section
1798  opts.optionalB("main", "tabulatedEnergies", "Do we get energies from a table?", &tabulatedEnergies, FALSE);
1799 // opts.require("tabulatedEnergies", "tableNumTypes","Number of types for energy tabulation", &tableNumTypes);
1800  opts.require("tabulatedEnergies", "tabulatedEnergiesFile", "File containing energy table", tabulatedEnergiesFile);
1801  opts.require("tabulatedEnergies", "tableInterpType", "Cubic or linear interpolation", tableInterpType);
1802 
1803  // TMD parameters
1804  opts.optionalB("main", "TMD", "Perform Targeted MD?", &TMDOn, FALSE);
1805  opts.optional("TMD", "TMDk", "Elastic constant for TMD", &TMDk, 0);
1806  opts.range("TMDk", NOT_NEGATIVE);
1807  opts.require("TMD", "TMDFile", "File for TMD information", TMDFile);
1808  opts.optionalB("TMD", "TMDDiffRMSD", "Restrain Difference between the RMSD from two structures", &TMDDiffRMSD, FALSE);
1809  opts.require("TMDDiffRMSD", "TMDFile2", "Second file for TMD information", TMDFile2);
1810 
1811  opts.optional("TMD", "TMDOutputFreq", "Frequency of TMD output",
1812  &TMDOutputFreq, 1);
1813  opts.range("TMDOutputFreq", POSITIVE);
1814  opts.require("TMD", "TMDLastStep", "Last TMD timestep", &TMDLastStep);
1815  opts.range("TMDLastStep", POSITIVE);
1816  opts.optional("TMD", "TMDFirstStep", "First TMD step (default 0)", &TMDFirstStep, 0);
1817  opts.optional("TMD", "TMDInitialRMSD", "Target RMSD at first TMD step (default -1 to use initial coordinates)", &TMDInitialRMSD);
1818  TMDInitialRMSD = -1;
1819  opts.optional("TMD", "TMDFinalRMSD", "Target RMSD at last TMD step (default 0 )", &TMDFinalRMSD, 0);
1820  opts.range("TMDInitialRMSD", NOT_NEGATIVE);
1821  // End of TMD parameters
1822 
1823  // Symmetry restraint parameters
1824  opts.optionalB("main", "symmetryRestraints", "Enable symmetry restraints?", &symmetryOn, FALSE);
1825  opts.optional("symmetryRestraints", "symmetryk", "Elastic constant for symmetry restraints", &symmetryk, 0);
1826  opts.range("symmetryk", NOT_NEGATIVE);
1827  opts.optional("symmetryRestraints", "symmetrykfile", "PDB file specifying force contants on a per-atom basis", PARSE_MULTIPLES);
1828  opts.optionalB("symmetryRestraints", "symmetryScaleForces", "Scale applied forces over time?", &symmetryScaleForces, FALSE);
1829  opts.require("symmetryRestraints", "symmetryFile", "File for symmetry information", PARSE_MULTIPLES);
1830  opts.optional("symmetryRestraints", "symmetryMatrixFile", "File(s) for transfromation matrices", PARSE_MULTIPLES);
1831  opts.optional("symmetryRestraints", "symmetryLastStep", "Last symmetry timestep", &symmetryLastStep, -1);
1832  opts.optional("symmetryRestraints", "symmetryFirstStep", "First symmetry step (default 0)", &symmetryFirstStep, 0);
1833  opts.optional("symmetryRestraints", "symmetryLastFullStep", "Last full force symmetry timestep (default symmetryLastStep)", &symmetryLastFullStep, symmetryLastStep);
1834  opts.optional("symmetryRestraints", "symmetryFirstFullStep", "First full force symmetry step (default symmetryFirstStep)", &symmetryFirstFullStep, symmetryFirstStep);
1835  //End of symmetry restraint parameters.
1836 
1838  opts.optionalB("main", "tclForces", "Are Tcl global forces active?",
1839  &tclForcesOn, FALSE);
1840  opts.require("tclForces", "tclForcesScript",
1841  "Tcl script for global forces", PARSE_MULTIPLES);
1842 
1844  opts.optionalB("main", "tclBC", "Are Tcl boundary forces active?",
1845  &tclBCOn, FALSE);
1846  opts.require("tclBC", "tclBCScript",
1847  "Tcl script defining calcforces for boundary forces", PARSE_STRING);
1848  tclBCScript = 0;
1849  opts.optional("tclBC", "tclBCArgs", "Extra args for calcforces command",
1850  tclBCArgs);
1851  tclBCArgs[0] = 0;
1852 
1854  opts.optionalB("main", "miscForces", "Are misc global forces active?",
1855  &miscForcesOn, FALSE);
1856  opts.optional("miscForces", "miscForcesScript",
1857  "script for misc forces", PARSE_MULTIPLES);
1858 
1860  opts.optionalB("main", "freeEnergy", "Perform free energy perturbation?",
1861  &freeEnergyOn, FALSE);
1862  opts.require("freeEnergy", "freeEnergyConfig",
1863  "Configuration file for free energy perturbation", PARSE_MULTIPLES);
1864 
1866  opts.optionalB("main", "constantforce", "Apply constant force?",
1867  &consForceOn, FALSE);
1868  opts.optional("constantforce", "consForceFile",
1869  "Configuration file for constant forces", PARSE_STRING);
1870  opts.require("constantforce", "consForceScaling",
1871  "Scaling factor for constant forces", &consForceScaling, 1.0);
1872 
1874  opts.optionalB("main", "colvars", "Is the colvars module enabled?",
1875  &colvarsOn, FALSE);
1876  opts.optional("colvars", "colvarsConfig",
1877  "configuration for the collective variables", PARSE_STRING);
1878  opts.optional("colvars", "colvarsInput",
1879  "input restart file for the collective variables", PARSE_STRING);
1880 
1881 }
1882 
1883 #ifdef OPENATOM_VERSION
1884 void SimParameters::config_parser_openatom(ParseOptions &opts) {
1885  opts.optionalB("main", "openatom", "OpenAtom active?", &openatomOn, FALSE);
1886  opts.require("openatom", "openatomDriverFile", "What config file specifies openatom input parameters", PARSE_STRING);
1887  opts.require("openatom", "openatomPhysicsFile", "What structure file specifies openatom input system", PARSE_STRING);
1888  opts.require("openatom", "openatomPdbFile", "NAMD input file defining QM and MM regions", PARSE_STRING);
1889  opts.optional("openatom", "openatomCol", "Column in the openatomPdb with the QM/MM flag", PARSE_STRING);
1890 }
1891 #endif // OPENATOM_VERSION
1892 
1893 /* BEGIN gf */
1894 void SimParameters::config_parser_mgridforce(ParseOptions &opts) {
1896  opts.optionalB("main", "mgridforce", "Is Multiple gridforce active?",
1897  &mgridforceOn, FALSE);
1898  opts.optional("mgridforce", "mgridforcevolts", "Is Gridforce using Volts/eV as units?",
1899  PARSE_MULTIPLES);
1900  opts.require("mgridforce", "mgridforcescale", "Scale factor by which to multiply "
1901  "grid forces", PARSE_MULTIPLES);
1902  opts.require("mgridforce", "mgridforcefile", "PDB file containing force "
1903  "multipliers in one of the columns", PARSE_MULTIPLES);
1904  opts.require("mgridforce", "mgridforcecol", "Column of gridforcefile to "
1905  "use for force multiplier", PARSE_MULTIPLES);
1906  opts.optional("mgridforce", "mgridforcechargecol", "Column of gridforcefile to "
1907  "use for charge", PARSE_MULTIPLES);
1908  opts.require("mgridforce", "mgridforcepotfile", "Gridforce potential file",
1909  PARSE_MULTIPLES);
1910  opts.optional("mgridforce", "mgridforcecont1", "Use continuous grid "
1911  "in K1 direction?", PARSE_MULTIPLES);
1912  opts.optional("mgridforce", "mgridforcecont2", "Use continuous grid "
1913  "in K2 direction?", PARSE_MULTIPLES);
1914  opts.optional("mgridforce", "mgridforcecont3", "Use continuous grid "
1915  "in K3 direction?", PARSE_MULTIPLES);
1916  opts.optional("mgridforce", "mgridforcevoff", "Gridforce potential offsets",
1917  PARSE_MULTIPLES);
1918  opts.optional("mgridforce", "mgridforcelite", "Use Gridforce Lite?",
1919  PARSE_MULTIPLES);
1920  opts.optional("mgridforce", "mgridforcechecksize", "Check if grid exceeds PBC cell dimensions?", PARSE_MULTIPLES);
1921 }
1922 
1923 void SimParameters::config_parser_gridforce(ParseOptions &opts) {
1925  opts.optionalB("main", "gridforce", "Is Gridforce active?",
1926  &gridforceOn, FALSE);
1927  opts.optionalB("gridforce", "gridforcevolts", "Is Gridforce using Volts/eV as units?",
1928  &gridforceVolts, FALSE);
1929  opts.require("gridforce", "gridforcescale", "Scale factor by which to multiply "
1930  "grid forces", &gridforceScale);
1931  opts.require("gridforce", "gridforcefile", "PDB file containing force "
1932  "multipliers in one of the columns", PARSE_STRING);
1933  opts.require("gridforce", "gridforcecol", "Column of gridforcefile to "
1934  "use for force multiplier", PARSE_STRING);
1935  opts.optional("gridforce", "gridforcechargecol", "Column of gridforcefile to "
1936  "use for charge", PARSE_STRING);
1937  opts.require("gridforce", "gridforcepotfile", "Gridforce potential file",
1938  PARSE_STRING);
1939  opts.optionalB("gridforce", "gridforcecont1", "Use continuous grid "
1940  "in A1 direction?", &gridforceContA1, FALSE);
1941  opts.optionalB("gridforce", "gridforcecont2", "Use continuous grid "
1942  "in A2 direction?", &gridforceContA2, FALSE);
1943  opts.optionalB("gridforce", "gridforcecont3", "Use continuous grid "
1944  "in A3 direction?", &gridforceContA3, FALSE);
1945  opts.optional("gridforce", "gridforcevoff", "Gridforce potential offsets",
1946  &gridforceVOffset);
1947  opts.optionalB("gridforce", "gridforcelite", "Use Gridforce Lite?",
1948  &gridforceLite, FALSE);
1949  opts.optionalB("gridforce", "gridforcechecksize", "Check if grid exceeds PBC cell dimensions?",
1950  &gridforcechecksize, TRUE);
1951 }
1952 /* END gf */
1953 
1954 void SimParameters::config_parser_movdrag(ParseOptions &opts) {
1956  opts.optionalB("main", "movDragOn", "Do we apply moving drag?",
1957  &movDragOn, FALSE);
1958  opts.require("movDragOn", "movDragFile",
1959  "Main moving drag PDB file", movDragFile);
1960  opts.require("movDragOn", "movDragCol",
1961  "Main moving drag PDB column", PARSE_STRING);
1962  opts.require("movDragOn", "movDragGlobVel",
1963  "Global moving drag velocity (A/step)", &movDragGlobVel);
1964  opts.require("movDragOn", "movDragVelFile",
1965  "Moving drag linear velocity file", movDragVelFile);
1966 }
1967 
1968 void SimParameters::config_parser_rotdrag(ParseOptions &opts) {
1970  opts.optionalB("main", "rotDragOn", "Do we apply rotating drag?",
1971  &rotDragOn, FALSE);
1972  opts.require("rotDragOn", "rotDragFile",
1973  "Main rotating drag PDB file", rotDragFile);
1974  opts.require("rotDragOn", "rotDragCol",
1975  "Main rotating drag PDB column", PARSE_STRING);
1976  opts.require("rotDragOn", "rotDragAxisFile",
1977  "Rotating drag axis file", rotDragAxisFile);
1978  opts.require("rotDragOn", "rotDragPivotFile",
1979  "Rotating drag pivot point file", rotDragPivotFile);
1980  opts.require("rotDragOn", "rotDragGlobVel",
1981  "Global rotating drag angular velocity (deg/step)", &rotDragGlobVel);
1982  opts.require("rotDragOn", "rotDragVelFile",
1983  "Rotating drag angular velocity file", rotDragVelFile);
1984  opts.require("rotDragOn", "rotDragVelCol",
1985  "Rotating drag angular velocity column", PARSE_STRING);
1986 }
1987 
1988 void SimParameters::config_parser_constorque(ParseOptions &opts) {
1990  opts.optionalB("main", "consTorqueOn", "Do we apply \"constant\" torque?",
1991  &consTorqueOn, FALSE);
1992  opts.require("consTorqueOn", "consTorqueFile",
1993  "Main \"constant\" torque PDB file", consTorqueFile);
1994  opts.require("consTorqueOn", "consTorqueCol",
1995  "Main \"constant\" torque PDB column", PARSE_STRING);
1996  opts.require("consTorqueOn", "consTorqueAxisFile",
1997  "\"Constant\" torque axis file", consTorqueAxisFile);
1998  opts.require("consTorqueOn", "consTorquePivotFile",
1999  "\"Constant\" torque pivot point file", consTorquePivotFile);
2000  opts.require("consTorqueOn", "consTorqueGlobVal",
2001  "Global \"constant\" torque value (Kcal/(mol*A^2))", &consTorqueGlobVal);
2002  opts.require("consTorqueOn", "consTorqueValFile",
2003  "\"constant\" torque factors file", consTorqueValFile);
2004  opts.require("consTorqueOn", "consTorqueValCol",
2005  "\"constant\" torque factors column", PARSE_STRING);
2006 }
2007 
2008 void SimParameters::config_parser_boundary(ParseOptions &opts) {
2009 
2011  opts.optionalB("main", "sphericalBC", "Are spherical boundary counditions "
2012  "active?", &sphericalBCOn, FALSE);
2013  opts.require("sphericalBC", "sphericalBCCenter",
2014  "Center of spherical boundaries", &sphericalCenter);
2015  opts.require("sphericalBC", "sphericalBCr1", "Radius for first sphere "
2016  "potential", &sphericalBCr1);
2017  opts.range("sphericalBCr1", POSITIVE);
2018  opts.units("sphericalBCr1", N_ANGSTROM);
2019  opts.require("sphericalBC", "sphericalBCk1", "Force constant for first "
2020  "sphere potential (+ is an inward force, - outward)",
2021  &sphericalBCk1);
2022  opts.units("sphericalBCk1", N_KCAL);
2023  opts.optional("sphericalBC", "sphericalBCexp1", "Exponent for first "
2024  "sphere potential", &sphericalBCexp1, 2);
2025  opts.range("sphericalBCexp1", POSITIVE);
2026 
2027  opts.optional("sphericalBCr1", "sphericalBCr2", "Radius for second sphere "
2028  "potential", &sphericalBCr2);
2029  opts.range("sphericalBCr2", POSITIVE);
2030  opts.units("sphericalBCr2", N_ANGSTROM);
2031  opts.require("sphericalBCr2", "sphericalBCk2", "Force constant for second "
2032  "sphere potential (+ is an inward force, - outward)",
2033  &sphericalBCk2);
2034  opts.units("sphericalBCk2", N_KCAL);
2035  opts.optional("sphericalBCr2", "sphericalBCexp2", "Exponent for second "
2036  "sphere potential", &sphericalBCexp2, 2);
2037  opts.range("sphericalBCexp2", POSITIVE);
2038 
2040  opts.optionalB("main", "cylindricalBC", "Are cylindrical boundary counditions "
2041  "active?", &cylindricalBCOn, FALSE);
2042  opts.require("cylindricalBC", "cylindricalBCr1", "Radius for first cylinder "
2043  "potential", &cylindricalBCr1);
2044  opts.range("cylindricalBCr1", POSITIVE);
2045  opts.units("cylindricalBCr1", N_ANGSTROM);
2046  opts.require("cylindricalBC", "cylindricalBCk1", "Force constant for first "
2047  "cylinder potential (+ is an inward force, - outward)",
2048  &cylindricalBCk1);
2049  opts.units("cylindricalBCk1", N_KCAL);
2050  opts.optional("cylindricalBC", "cylindricalBCexp1", "Exponent for first "
2051  "cylinder potential", &cylindricalBCexp1, 2);
2052  opts.range("cylindricalBCexp1", POSITIVE);
2053 
2054 
2055 // additions beyond those already found in spherical parameters JJU
2056  opts.optional("cylindricalBC", "cylindricalBCAxis", "Cylinder axis (defaults to x)",
2057  PARSE_STRING);
2058  opts.require("cylindricalBC", "cylindricalBCCenter",
2059  "Center of cylindrical boundaries", &cylindricalCenter);
2060  opts.require ("cylindricalBC", "cylindricalBCl1", "Length of first cylinder",
2061  &cylindricalBCl1);
2062  opts.range("cylindricalBCl1", POSITIVE);
2063  opts.units("cylindricalBCl1", N_ANGSTROM);
2064  opts.optional ("cylindricalBCl1", "cylindricalBCl2", "Length of second cylinder",
2065  &cylindricalBCl2);
2066  opts.range ("cylindricalBCl2", POSITIVE);
2067  opts.units ("cylindricalBCl2", N_ANGSTROM);
2068 // end additions
2069 
2070  opts.optional("cylindricalBCr1", "cylindricalBCr2", "Radius for second cylinder "
2071  "potential", &cylindricalBCr2);
2072  opts.range("cylindricalBCr2", POSITIVE);
2073  opts.units("cylindricalBCr2", N_ANGSTROM);
2074  opts.require("cylindricalBCr2", "cylindricalBCk2", "Force constant for second "
2075  "cylinder potential (+ is an inward force, - outward)",
2076  &cylindricalBCk2);
2077  opts.units("cylindricalBCk2", N_KCAL);
2078  opts.optional("cylindricalBCr2", "cylindricalBCexp2", "Exponent for second "
2079  "cylinder potential", &cylindricalBCexp2, 2);
2080  opts.range("cylindricalBCexp2", POSITIVE);
2081 
2083  opts.optionalB("main", "eFieldOn", "Should an electric field be applied",
2084  &eFieldOn, FALSE);
2085  opts.optionalB("eFieldOn", "eFieldNormalized", "Is eField vector scaled by cell basis vectors?",
2086  &eFieldNormalized, FALSE);
2087  opts.require("eFieldOn", "eField", "Electric field vector", &eField);
2088  opts.optional("eFieldOn", "eFieldFreq", "Electric field frequency", &eFieldFreq);
2089  opts.optional("eFieldOn", "eFieldPhase", "Electric field phase", &eFieldPhase);
2090 
2092  opts.optionalB("main", "stirOn", "Should stirring torque be applied",
2093  &stirOn, FALSE);
2094  opts.optional("stirOn", "stirFilename", "PDB file with flags for "
2095  "stirred atoms (default is the PDB input file)",
2096  PARSE_STRING);
2097  opts.optional("stirOn", "stirredAtomsCol", "Column in the stirredAtomsFile "
2098  "containing the flags (nonzero means fixed);\n"
2099  "default is 'O'", PARSE_STRING);
2100  opts.require("stirOn", "stirStartingTheta", "Stir starting theta offset", &stirStartingTheta);
2101  opts.require("stirOn", "stirK", "Stir force harmonic spring constant", &stirK);
2102  //should make this optional, compute from firsttimestep * stirVel
2103  opts.require("stirOn", "stirVel", "Stir angular velocity (deg/timestep)", &stirVel);
2104  opts.require("stirOn", "stirAxis", "Stir axis (direction vector)", &stirAxis);
2105  opts.require("stirOn", "stirPivot", "Stir pivot point (coordinate)", &stirPivot);
2106 
2108  opts.optionalB("main", "extraBonds",
2109  "Should extra bonded forces be applied",
2110  &extraBondsOn, FALSE);
2111  opts.optional("extraBonds", "extraBondsFile",
2112  "file with list of extra bonds",
2113  PARSE_MULTIPLES);
2114  opts.optionalB("extraBonds", "extraBondsCosAngles",
2115  "Should extra angles be cosine-based to match ancient bug",
2116  &extraBondsCosAngles, TRUE);
2117 
2118 }
2119 
2120 void SimParameters::config_parser_misc(ParseOptions &opts) {
2121 
2123  opts.optional("main", "ldBalancer", "Load balancer",
2124  loadBalancer);
2125  opts.optional("main", "ldbStrategy", "Load balancing strategy",
2126  loadStrategy);
2127  opts.optional("main", "ldbPeriod", "steps between load balancing",
2128  &ldbPeriod);
2129  opts.range("ldbPeriod", POSITIVE);
2130  opts.optional("main", "firstLdbStep", "when to start load balancing",
2131  &firstLdbStep);
2132  opts.range("firstLdbStep", POSITIVE);
2133  opts.optional("main", "lastLdbStep", "when to stop load balancing",
2134  &lastLdbStep);
2135  opts.range("lastLdbStep", POSITIVE);
2136  opts.optional("main", "hybridGroupSize", "Hybrid load balancing group size",
2137  &hybridGroupSize);
2138  opts.optional("main", "ldbBackgroundScaling",
2139  "background load scaling", &ldbBackgroundScaling);
2140  opts.range("ldbBackgroundScaling", NOT_NEGATIVE);
2141  opts.optional("main", "ldbPMEBackgroundScaling",
2142  "PME node background load scaling", &ldbPMEBackgroundScaling);
2143  opts.range("ldbPMEBackgroundScaling", NOT_NEGATIVE);
2144  opts.optional("main", "ldbHomeBackgroundScaling",
2145  "home node background load scaling", &ldbHomeBackgroundScaling);
2146  opts.range("ldbHomeBackgroundScaling", NOT_NEGATIVE);
2147  opts.optional("main", "ldbRelativeGrainsize",
2148  "fraction of average load per compute", &ldbRelativeGrainsize, 0.);
2149  opts.range("ldbRelativeGrainsize", NOT_NEGATIVE);
2150 
2151  opts.optional("main", "traceStartStep", "when to start tracing", &traceStartStep);
2152  opts.range("traceStartStep", POSITIVE);
2153  opts.optional("main", "numTraceSteps", "the number of timesteps to be traced", &numTraceSteps);
2154  opts.range("numTraceSteps", POSITIVE);
2155 
2156 #ifdef MEASURE_NAMD_WITH_PAPI
2157  opts.optionalB("main", "papiMeasure", "whether use PAPI to measure performacne", &papiMeasure, FALSE);
2158  opts.optional("main", "papiMeasureStartStep", "when to measure performacne using PAPI", &papiMeasureStartStep);
2159  opts.range("papiMeasureStartStep", POSITIVE);
2160  opts.optional("main", "numPapiMeasureSteps", "the number of timesteps to be measured using PAPI", &numPapiMeasureSteps);
2161  opts.range("numPapiMeasureSteps", POSITIVE);
2162 #endif
2163 
2164  opts.optionalB("main", "outputMaps", "whether to dump compute map and patch map for analysis just before load balancing", &outputMaps, FALSE);
2165  opts.optionalB("main", "benchTimestep", "whether to do benchmarking timestep in which case final file output is disabled", &benchTimestep, FALSE);
2166  opts.optional("main", "useCkLoop", "whether to use CkLoop library to parallelize a loop in a function like OpenMP", &useCkLoop,
2167  #if CMK_SMP && USE_CKLOOP
2168  ( CkNumPes() < 2 * CkNumNodes() ? 0 : CKLOOP_CTRL_PME_FORWARDFFT ) );
2169  #else
2170  0);
2171  #endif
2172  opts.range("useCkLoop", NOT_NEGATIVE);
2173 
2174  opts.optionalB("main", "simulateInitialMapping", "whether to study the initial mapping scheme", &simulateInitialMapping, FALSE);
2175  opts.optional("main", "simulatedPEs", "the number of PEs to be used for studying initial mapping", &simulatedPEs);
2176  opts.range("simulatedPEs", POSITIVE);
2177  opts.optional("main", "simulatedNodeSize", "the node size to be used for studying initial mapping", &simulatedNodeSize);
2178  opts.range("simulatedNodeSize", POSITIVE);
2179  opts.optionalB("main", "disableTopology", "ignore torus information during patch placement", &disableTopology, FALSE);
2180  opts.optionalB("main", "verboseTopology", "print torus information during patch placement", &verboseTopology, FALSE);
2181 
2182  opts.optionalB("main", "ldbUnloadPME", "no load on PME nodes",
2183  &ldbUnloadPME, FALSE);
2184  opts.optionalB("main", "ldbUnloadZero", "no load on pe zero",
2185  &ldbUnloadZero, FALSE);
2186  opts.optionalB("main", "ldbUnloadOne", "no load on pe one",
2187  &ldbUnloadOne, FALSE);
2188  opts.optionalB("main", "ldbUnloadOutputPEs", "no load on output PEs",
2189  &ldbUnloadOutputPEs, FALSE);
2190  opts.optionalB("main", "noPatchesOnZero", "no patches on pe zero",
2191  &noPatchesOnZero, FALSE);
2192  opts.optionalB("main", "noPatchesOnOutputPEs", "no patches on Output PEs",
2193  &noPatchesOnOutputPEs, FALSE);
2194  opts.optionalB("main", "noPatchesOnOne", "no patches on pe one",
2195  &noPatchesOnOne, FALSE);
2196  opts.optionalB("main", "useCompressedPsf", "The structure file psf is in the compressed format",
2197  &useCompressedPsf, FALSE);
2198  opts.optionalB("main", "genCompressedPsf", "Generate the compressed version of the psf file",
2199  &genCompressedPsf, FALSE);
2200  opts.optionalB("main", "usePluginIO", "Use the plugin I/O to load the molecule system",
2201  &usePluginIO, FALSE);
2202  opts.optionalB("main", "mallocTest", "test how much memory all PEs can allocate",
2203  &mallocTest, FALSE);
2204  opts.optionalB("main", "printExclusions", "print exclusion lists to stdout",
2205  &printExclusions, FALSE);
2206  opts.optional("main", "proxySendSpanningTree", "using spanning tree to send proxies",
2207  &proxySendSpanningTree, -1);
2208  opts.optional("main", "proxyRecvSpanningTree", "using spanning tree to receive proxies",
2209  &proxyRecvSpanningTree, 0); // default off due to memory leak -1);
2210  opts.optional("main", "proxyTreeBranchFactor", "the branch factor when building a spanning tree",
2211  &proxyTreeBranchFactor, 0); // actual default in ProxyMgr.C
2212  opts.optionalB("main", "twoAwayX", "half-size patches in 1st dimension",
2213  &twoAwayX, -1);
2214  opts.optionalB("main", "twoAwayY", "half-size patches in 2nd dimension",
2215  &twoAwayY, -1);
2216  opts.optionalB("main", "twoAwayZ", "half-size patches in 3rd dimension",
2217  &twoAwayZ, -1);
2218  opts.optional("main", "maxPatches", "maximum patch count", &maxPatches, -1);
2219 
2221  opts.optional("main", "firsttimestep", "Timestep to start simulation at",
2222  &firstTimestep, 0);
2223  opts.range("firsttimestep", NOT_NEGATIVE);
2224 
2226  opts.optionalB("main", "test", "Perform self-tests rather than simulation",
2227  &testOn, FALSE);
2228  opts.optionalB("main", "commOnly", "Do not evaluate forces or integrate",
2229  &commOnly, FALSE);
2230 
2231  opts.optionalB("main", "statsOn", "counters in machine layer",
2232  &statsOn, FALSE);
2234  opts.optionalB("main", "hbonds", "Use explicit hydrogen bond term",
2235  &HydrogenBonds, FALSE);
2236  opts.optionalB("hbonds","hbAntecedents","Include Antecedent in hbond term",
2237  &useAntecedent, TRUE);
2238  opts.optional("hbonds","hbAAexp","Hbond AA-A-H angle cos exponential",
2239  &aaAngleExp, 2);
2240  opts.optional("hbonds","hbHAexp","Hbond D-H-A angle cos exponential",
2241  &haAngleExp, 4);
2242  opts.optional("hbonds","hbDistAexp","Hbond A-D dist attractive exponential",
2243  &distAttExp, 4);
2244  opts.optional("hbonds","hbDistRexp","Hbond A-D dist repulstive exponential",
2245  &distRepExp, 6);
2246  opts.optional("hbonds","hbCutoffAngle","Hbond D-H-A cutoff angle",
2247  &dhaCutoffAngle, 100.0);
2248  opts.range("hbCutoffAngle", NOT_NEGATIVE);
2249  opts.optional("hbonds","hbOnAngle","Hbond D-H-A switch function on angle",
2250  &dhaOnAngle, 60.0);
2251  opts.range("hbOnAngle", NOT_NEGATIVE);
2252  opts.optional("hbonds","hbOffAngle","Hbond D-H-A switch function off angle",
2253  &dhaOffAngle, 80.0);
2254  opts.range("hbOffAngle", NOT_NEGATIVE);
2255  opts.optional("hbonds","hbCutoffDist","Hbond A-D cutoff distance",
2256  &daCutoffDist, 7.5);
2257  opts.range("hbCutoffDist", POSITIVE);
2258  opts.units("hbCutoffDist", N_ANGSTROM);
2259  opts.optional("hbonds","hbOnDist","Hbond A-D switch function on distance",
2260  &daOnDist, 5.5);
2261  opts.range("hbOnDist", POSITIVE);
2262  opts.units("hbOnDist", N_ANGSTROM);
2263  opts.optional("hbonds","hbOffDist","Hbond A-D switch function off distance",
2264  &daOffDist, 6.5);
2265  opts.range("hbOffDist", POSITIVE);
2266  opts.units("hbOffDist", N_ANGSTROM);
2267 
2268  // IMD options
2269  opts.optionalB("main","IMDon","Connect using IMD?",&IMDon, FALSE);
2270  opts.require("IMDon","IMDport", "Port to which to bind", &IMDport);
2271  opts.range("IMDport",POSITIVE);
2272  opts.require("IMDon","IMDfreq", "Frequency at which to report", &IMDfreq);
2273  opts.range("IMDfreq",POSITIVE);
2274  opts.optionalB("IMDon","IMDwait","Pause until IMD connection?",&IMDwait,
2275  FALSE);
2276  opts.optionalB("IMDon","IMDignore","Ignore any user input?",&IMDignore,
2277  FALSE);
2278  opts.optionalB("IMDon","IMDignoreForces","Ignore forces ONLY?",&IMDignoreForces,
2279  FALSE);
2280  // Maximum Partition options
2281  opts.optional("ldBalancer", "maxSelfPart",
2282  "maximum number of self partitions in one patch", &maxSelfPart, 20);
2283  opts.range("maxSelfPart",POSITIVE);
2284  opts.optional("ldBalancer", "maxPairPart",
2285  "maximum number of pair partitions in one patch", &maxPairPart, 8);
2286  opts.range("maxPairPart",POSITIVE);
2287  opts.optional("ldBalancer", "numAtomsSelf",
2288  "maximum number of atoms in one self compute distribution",
2289  &numAtomsSelf, 154);
2290  opts.range("numAtomsSelf",NOT_NEGATIVE);
2291 
2292  opts.optional("ldBalancer", "numAtomsSelf2",
2293  "maximum number of atoms in one self compute distribution",
2294  &numAtomsSelf2, 154);
2295  opts.range("numAtomsSelf2",NOT_NEGATIVE);
2296 
2297  opts.optional("ldBalancer", "numAtomsPair",
2298  "maximum number of atoms in one pair compute distribution",
2299  &numAtomsPair, 318);
2300  opts.range("numAtomsPair",NOT_NEGATIVE);
2301  opts.optional("ldBalancer", "numAtomsPair2",
2302  "maximum number of atoms in one pair compute distribution",
2303  &numAtomsPair2, 637);
2304  opts.range("numAtomsPair2",NOT_NEGATIVE);
2305  opts.optional("main", "minAtomsPerPatch",
2306  "minimum average atoms per patch",
2307  &minAtomsPerPatch, 40);
2308  opts.range("minAtomsPerPatch",NOT_NEGATIVE);
2309 
2310  // Set number added to patch atom count during initial node assignment
2311  opts.optional("main", "emptyPatchLoad",
2312  "load generated by empty patch, in atoms",
2313  &emptyPatchLoad, 40);
2314  opts.range("emptyPatchLoad",POSITIVE);
2315 
2316  // Maximum exclusion flags per atom
2317  opts.optional("main", "maxExclusionFlags",
2318  "maximum number of exclusion flags per atom", &maxExclusionFlags, 256);
2319  opts.range("maxExclusionFlags",POSITIVE);
2320 
2321  // Bonded interactions on GPU
2322  opts.optional("main", "bondedCUDA", "Bitmask for calculating bonded interactions on GPU", &bondedCUDA, 255);
2323 
2324  // Automatically disable individual CUDA kernels that are
2325  // incompatible with simulation options.
2326  // Set FALSE to manually control kernel use for development.
2327  opts.optionalB("main", "useCUDAdisable", "Disable kernels to maintain feature compatibility with CUDA", &useCUDAdisable, TRUE);
2328 
2329  // MIC specific parameters
2330  opts.optional("main", "mic_unloadMICPEs", "Indicates whether or not the load balancer should unload PEs driving Xeon Phi cards", &mic_unloadMICPEs, 1);
2331  opts.optional("main", "mic_singleKernel", "Set to non-zero to have all MIC work to be placed in a single kernel", &mic_singleKernel, 1);
2332  opts.optional("main", "mic_deviceThreshold", "Threshold to use for directing computes to Xeon Phi devices", &mic_deviceThreshold, -1);
2333  opts.optional("main", "mic_hostSplit", "DMK - reserved", &mic_hostSplit, -1);
2334  opts.optional("main", "mic_numParts_self_p1", "MIC-Specific NumParts SELF Parameter 1", &mic_numParts_self_p1, -1);
2335  opts.optional("main", "mic_numParts_pair_p1", "MIC-Specific NumParts PAIR Parameter 1", &mic_numParts_pair_p1, -1);
2336  opts.optional("main", "mic_numParts_pair_p2", "MIC-Specific NumParts PAIR Parameter 2", &mic_numParts_pair_p2, -1);
2337  opts.range("mic_unloadMICPEs", NOT_NEGATIVE);
2338  opts.range("mic_singleKernel", NOT_NEGATIVE);
2339 }
2340 
2341 void SimParameters::readExtendedSystem(const char *filename, Lattice *latptr) {
2342 
2343  if ( ! latptr ) {
2344  iout << iINFO << "EXTENDED SYSTEM FILE " << filename << "\n" << endi;
2345  }
2346 
2347  ifstream xscFile(filename);
2348  if ( ! xscFile ) NAMD_die("Unable to open extended system file.\n");
2349 
2350  char labels[1024];
2351  do {
2352  if ( ! xscFile ) NAMD_die("Error reading extended system file.\n");
2353  xscFile.getline(labels,1023);
2354  } while ( strncmp(labels,"#$LABELS ",9) );
2355 
2356  int a_x, a_y, a_z, b_x, b_y, b_z, c_x, c_y, c_z;
2357  a_x = a_y = a_z = b_x = b_y = b_z = c_x = c_y = c_z = -1;
2358  int o_x, o_y, o_z, s_u, s_v, s_w, s_x, s_y, s_z;
2359  o_x = o_y = o_z = s_u = s_v = s_w = s_x = s_y = s_z = -1;
2360 
2361  int pos = 0;
2362  char *l_i = labels + 8;
2363  while ( *l_i ) {
2364  if ( *l_i == ' ' ) { ++l_i; continue; }
2365  char *l_i2;
2366  for ( l_i2 = l_i; *l_i2 && *l_i2 != ' '; ++l_i2 );
2367  if ( (l_i2 - l_i) == 3 && (l_i[1] == '_') ) {
2368  if (l_i[0] == 'a' && l_i[2] == 'x') a_x = pos;
2369  if (l_i[0] == 'a' && l_i[2] == 'y') a_y = pos;
2370  if (l_i[0] == 'a' && l_i[2] == 'z') a_z = pos;
2371  if (l_i[0] == 'b' && l_i[2] == 'x') b_x = pos;
2372  if (l_i[0] == 'b' && l_i[2] == 'y') b_y = pos;
2373  if (l_i[0] == 'b' && l_i[2] == 'z') b_z = pos;
2374  if (l_i[0] == 'c' && l_i[2] == 'x') c_x = pos;
2375  if (l_i[0] == 'c' && l_i[2] == 'y') c_y = pos;
2376  if (l_i[0] == 'c' && l_i[2] == 'z') c_z = pos;
2377  if (l_i[0] == 'o' && l_i[2] == 'x') o_x = pos;
2378  if (l_i[0] == 'o' && l_i[2] == 'y') o_y = pos;
2379  if (l_i[0] == 'o' && l_i[2] == 'z') o_z = pos;
2380  if (l_i[0] == 's' && l_i[2] == 'u') s_u = pos;
2381  if (l_i[0] == 's' && l_i[2] == 'v') s_v = pos;
2382  if (l_i[0] == 's' && l_i[2] == 'w') s_w = pos;
2383  if (l_i[0] == 's' && l_i[2] == 'x') s_x = pos;
2384  if (l_i[0] == 's' && l_i[2] == 'y') s_y = pos;
2385  if (l_i[0] == 's' && l_i[2] == 'z') s_z = pos;
2386  }
2387  ++pos;
2388  l_i = l_i2;
2389  }
2390  int numpos = pos;
2391 
2392  for ( pos = 0; pos < numpos; ++pos ) {
2393  double tmp;
2394  xscFile >> tmp;
2395  if ( ! xscFile ) NAMD_die("Error reading extended system file.\n");
2396  if ( pos == a_x ) cellBasisVector1.x = tmp;
2397  if ( pos == a_y ) cellBasisVector1.y = tmp;
2398  if ( pos == a_z ) cellBasisVector1.z = tmp;
2399  if ( pos == b_x ) cellBasisVector2.x = tmp;
2400  if ( pos == b_y ) cellBasisVector2.y = tmp;
2401  if ( pos == b_z ) cellBasisVector2.z = tmp;
2402  if ( pos == c_x ) cellBasisVector3.x = tmp;
2403  if ( pos == c_y ) cellBasisVector3.y = tmp;
2404  if ( pos == c_z ) cellBasisVector3.z = tmp;
2405  if ( pos == o_x ) cellOrigin.x = tmp;
2406  if ( pos == o_y ) cellOrigin.y = tmp;
2407  if ( pos == o_z ) cellOrigin.z = tmp;
2408  if ( pos == s_u ) strainRate2.x = tmp;
2409  if ( pos == s_v ) strainRate2.y = tmp;
2410  if ( pos == s_w ) strainRate2.z = tmp;
2411  if ( pos == s_x ) strainRate.x = tmp;
2412  if ( pos == s_y ) strainRate.y = tmp;
2413  if ( pos == s_z ) strainRate.z = tmp;
2414  }
2415 
2416  if ( latptr ) {
2417  Lattice test;
2418  test.set(cellBasisVector1,cellBasisVector2,cellBasisVector3,cellOrigin);
2419 
2420  if ( test.a_p() && ! lattice.a_p() ) {
2421  NAMD_die("cellBasisVector1 added during atom reinitialization");
2422  }
2423  if ( lattice.a_p() && ! test.a_p() ) {
2424  NAMD_die("cellBasisVector1 dropped during atom reinitialization");
2425  }
2426  if ( test.b_p() && ! lattice.b_p() ) {
2427  NAMD_die("cellBasisVector2 added during atom reinitialization");
2428  }
2429  if ( lattice.b_p() && ! test.b_p() ) {
2430  NAMD_die("cellBasisVector2 dropped during atom reinitialization");
2431  }
2432  if ( test.c_p() && ! lattice.c_p() ) {
2433  NAMD_die("cellBasisVector3 added during atom reinitialization");
2434  }
2435  if ( lattice.c_p() && ! test.c_p() ) {
2436  NAMD_die("cellBasisVector3 dropped during atom reinitialization");
2437  }
2438 
2439  latptr->set(cellBasisVector1,cellBasisVector2,cellBasisVector3,cellOrigin);
2440  }
2441 
2442 }
2443 
2444 #ifdef MEM_OPT_VERSION
2445 //This global var is defined in mainfunc.C
2446 extern char *gWorkDir;
2447 #endif
2448 
2449 void SimParameters::check_config(ParseOptions &opts, ConfigList *config, char *&cwd) {
2450 
2451  int len; // String length
2452  StringList *current; // Pointer to config option list
2453 
2454 #ifdef MEM_OPT_VERSION
2455  char *namdWorkDir = NULL;
2456 #endif
2457 
2458  if ( opts.defined("obsolete") ) {
2459  iout << iWARN <<
2460  "\"obsolete\" defined, silently ignoring obsolete options\n" << endi;
2461  }
2462 
2463  // Take care of cwd processing
2464  if (opts.defined("cwd"))
2465  {
2466  // First allocate and get the cwd value
2467  current = config->find("cwd");
2468 
2469  len = strlen(current->data);
2470 
2471  if ( CHDIR(current->data) )
2472  {
2473  NAMD_die("chdir() to given cwd failed!");
2474  } else {
2475  iout << iINFO << "Changed directory to " << current->data << "\n" << endi;
2476  }
2477 
2478  if (current->data[len-1] != PATHSEP)
2479  len++;
2480 
2481  cwd = new char[len+1];
2482 
2483  strcpy(cwd, current->data);
2484 
2485  if (current->data[strlen(current->data)-1] != PATHSEP)
2486  strcat(cwd, PATHSEPSTR);
2487  }
2488 
2489 #ifdef MEM_OPT_VERSION
2490  if(cwd!=NULL)namdWorkDir = cwd;
2491  else namdWorkDir = gWorkDir;
2492  int dirlen = strlen(namdWorkDir);
2493  //only support the path representation on UNIX-like platforms
2494  char *tmpDir;
2495  if(namdWorkDir[dirlen-1]=='/'){
2496  tmpDir = new char[dirlen+1];
2497  tmpDir[dirlen] = 0;
2498  }else{
2499  tmpDir = new char[dirlen+2];
2500  tmpDir[dirlen]='/';
2501  tmpDir[dirlen+1]=0;
2502  }
2503  memcpy(tmpDir, namdWorkDir, dirlen);
2504  namdWorkDir = tmpDir;
2505  //finished recording the per atom files, free the space for gWorkDir
2506  delete [] gWorkDir;
2507 #endif
2508 
2509 
2510  // Don't try to specify coordinates with pluginIO
2511  if ( usePluginIO && opts.defined("coordinates") ) {
2512  NAMD_die("Separate coordinates file not allowed with plugin IO, coordinates will be taken from structure file.");
2513  }
2514 
2515  // If it's not AMBER||GROMACS, then "coordinates", "structure"
2516  // and "parameters" must be specified.
2517  if (!amberOn && !gromacsOn) {
2518 #ifndef MEM_OPT_VERSION
2519  if (useCompressedPsf)
2520  NAMD_die("useCompressedPsf requires memory-optimized build!");
2521  if (!usePluginIO && !genCompressedPsf && !opts.defined("coordinates"))
2522  NAMD_die("coordinates not found in the configuration file!");
2523 #else
2524  if(!usePluginIO && !opts.defined("bincoordinates")) {
2525  NAMD_die("bincoordinates not found in the configuration file for the memory optimized version!");
2526  }
2527  if(!usePluginIO && opts.defined("coordinates")) {
2528  NAMD_die("coordinates not allowed in the configuration file for the memory optimized version!");
2529  }
2530 #endif
2531  if (!opts.defined("structure"))
2532  NAMD_die("structure not found in the configuration file!");
2533  if (!opts.defined("parameters"))
2534  NAMD_die("parameters not found in the configuration file!");
2535  }
2536 
2537  // In any case, there should be either "coordinates" or
2538  // "ambercoor", but not both
2539  if (opts.defined("coordinates") && opts.defined("ambercoor"))
2540  NAMD_die("Cannot specify both coordinates and ambercoor!");
2541 #ifndef MEM_OPT_VERSION
2542  if (!genCompressedPsf && !opts.defined("coordinates") && !opts.defined("ambercoor")
2543  && !opts.defined("grocoorfile") && !usePluginIO)
2544  NAMD_die("Coordinate file not found!");
2545 #endif
2546 
2547  // Make sure that both a temperature and a velocity PDB were
2548  // specified
2549  if (opts.defined("temperature") &&
2550  (opts.defined("velocities") || opts.defined("binvelocities")) )
2551  {
2552  NAMD_die("Cannot specify both an initial temperature and a velocity file");
2553  }
2554 
2555 #ifdef MEM_OPT_VERSION
2556 //record the absolute file name for binAtomFile, binCoorFile and binVelFile etc.
2557  binAtomFile = NULL;
2558  binCoorFile = NULL;
2559  binVelFile = NULL;
2560  binRefFile = NULL;
2561 
2562  char *curfile = NULL;
2563  dirlen = strlen(namdWorkDir);
2564  current = config->find("structure");;
2565  curfile = current->data;
2566  int filelen = strlen(curfile);
2567  if(*curfile == '/' || *curfile=='~') {
2568  //check whether it is an absolute path
2569  //WARNING: Only works on Unix-like platforms!
2570  //Needs to fix on Windows platform.
2571  //-Chao Mei
2572  //adding 5 because of ".bin"+"\0"
2573  binAtomFile = new char[filelen+5];
2574  memcpy(binAtomFile, curfile, filelen);
2575  memcpy(binAtomFile+filelen, ".bin", 4);
2576  binAtomFile[filelen+4] = 0;
2577  }else{
2578  binAtomFile = new char[dirlen+filelen+5];
2579  memcpy(binAtomFile, namdWorkDir, dirlen);
2580  memcpy(binAtomFile+dirlen, curfile, filelen);
2581  memcpy(binAtomFile+dirlen+filelen, ".bin", 4);
2582  binAtomFile[dirlen+filelen+4] = 0;
2583  }
2584 
2585  current = config->find("bincoordinates");
2586  curfile = current->data;
2587  filelen = strlen(curfile);
2588  if(*curfile == '/' || *curfile=='~') {
2589  binCoorFile = new char[filelen+1];
2590  memcpy(binCoorFile, curfile, filelen);
2591  binCoorFile[filelen] = 0;
2592  }else{
2593  binCoorFile = new char[dirlen+filelen+1];
2594  memcpy(binCoorFile, namdWorkDir, dirlen);
2595  memcpy(binCoorFile+dirlen, curfile, filelen);
2596  binCoorFile[dirlen+filelen] = 0;
2597  }
2598 
2599  if(opts.defined("binvelocities")){
2600  current = config->find("binvelocities");
2601  curfile = current->data;
2602  filelen = strlen(curfile);
2603  if(*curfile == '/' || *curfile=='~') {
2604  binVelFile = new char[filelen+1];
2605  memcpy(binVelFile, curfile, filelen);
2606  binVelFile[filelen] = 0;
2607  }else{
2608  binVelFile = new char[dirlen+filelen+1];
2609  memcpy(binVelFile, namdWorkDir, dirlen);
2610  memcpy(binVelFile+dirlen, curfile, filelen);
2611  binVelFile[dirlen+filelen] = 0;
2612  }
2613  }
2614 
2615  if(opts.defined("binrefcoords")){
2616  current = config->find("binrefcoords");
2617  curfile = current->data;
2618  filelen = strlen(curfile);
2619  if(*curfile == '/' || *curfile=='~') {
2620  binRefFile = new char[filelen+1];
2621  memcpy(binRefFile, curfile, filelen);
2622  binRefFile[filelen] = 0;
2623  }else{
2624  binRefFile = new char[dirlen+filelen+1];
2625  memcpy(binRefFile, namdWorkDir, dirlen);
2626  memcpy(binRefFile+dirlen, curfile, filelen);
2627  binRefFile[dirlen+filelen] = 0;
2628  }
2629  }
2630 
2631  //deal with output file name to make it absolute path for parallel output
2632  if(outputFilename[0] != '/' && outputFilename[0]!='~') {
2633  filelen = strlen(outputFilename);
2634  char *tmpout = new char[filelen];
2635  memcpy(tmpout, outputFilename, filelen);
2636  CmiAssert(filelen+dirlen <= 120); //leave 8 chars for file suffix
2637  memcpy(outputFilename, namdWorkDir, dirlen);
2638  memcpy(outputFilename+dirlen, tmpout, filelen);
2639  outputFilename[filelen+dirlen] = 0;
2640  delete [] tmpout;
2641  }
2642 
2643  if ( dcdFrequency && opts.defined("dcdfile") &&
2644  dcdFilename[0] != '/' && dcdFilename[0]!='~' ) {
2645  filelen = strlen(dcdFilename);
2646  char *tmpout = new char[filelen];
2647  memcpy(tmpout, dcdFilename, filelen);
2648  CmiAssert(filelen+dirlen <= 120); //leave 8 chars for file suffix
2649  memcpy(dcdFilename, namdWorkDir, dirlen);
2650  memcpy(dcdFilename+dirlen, tmpout, filelen);
2651  dcdFilename[filelen+dirlen] = 0;
2652  delete [] tmpout;
2653  }
2654 
2655  if ( velDcdFrequency && opts.defined("veldcdfile") &&
2656  velDcdFilename[0] != '/' && velDcdFilename[0]!='~' ) {
2657  filelen = strlen(velDcdFilename);
2658  char *tmpout = new char[filelen];
2659  memcpy(tmpout, velDcdFilename, filelen);
2660  CmiAssert(filelen+dirlen <= 120); //leave 8 chars for file suffix
2661  memcpy(velDcdFilename, namdWorkDir, dirlen);
2662  memcpy(velDcdFilename+dirlen, tmpout, filelen);
2663  velDcdFilename[filelen+dirlen] = 0;
2664  delete [] tmpout;
2665  }
2666 
2667  if ( forceDcdFrequency && opts.defined("forcedcdfile") &&
2668  forceDcdFilename[0] != '/' && forceDcdFilename[0]!='~' ) {
2669  filelen = strlen(forceDcdFilename);
2670  char *tmpout = new char[filelen];
2671  memcpy(tmpout, forceDcdFilename, filelen);
2672  CmiAssert(filelen+dirlen <= 120); //leave 8 chars for file suffix
2673  memcpy(forceDcdFilename, namdWorkDir, dirlen);
2674  memcpy(forceDcdFilename+dirlen, tmpout, filelen);
2675  forceDcdFilename[filelen+dirlen] = 0;
2676  delete [] tmpout;
2677  }
2678 
2679  if ( restartFrequency && opts.defined("restartname") &&
2680  restartFilename[0] != '/' && restartFilename[0]!='~' ) {
2681  filelen = strlen(restartFilename);
2682  char *tmpout = new char[filelen];
2683  memcpy(tmpout, restartFilename, filelen);
2684  CmiAssert(filelen+dirlen <= 120); //leave 8 chars for file suffix
2685  memcpy(restartFilename, namdWorkDir, dirlen);
2686  memcpy(restartFilename+dirlen, tmpout, filelen);
2687  restartFilename[filelen+dirlen] = 0;
2688  delete [] tmpout;
2689  }
2690 
2691  delete [] namdWorkDir;
2692 
2693  if (opts.defined("numinputprocs")) {
2694  if(numinputprocs > CkNumPes()) {
2695  iout << iWARN << "The number of input processors exceeds the total number of processors. Resetting to half of the number of total processors.\n" << endi;
2696  numinputprocs = (CkNumPes()>>1)+(CkNumPes()&1);
2697  }
2698  }
2699 
2700  if (opts.defined("numoutputprocs")) {
2701  if(numoutputprocs > CkNumPes()) {
2702  iout << iWARN << "The number of output processors exceeds the total number of processors. Resetting to half of the number of total processors.\n" << endi;
2703  numoutputprocs = (CkNumPes()>>1)+(CkNumPes()&1);
2704  }
2705  }
2706 
2707 #ifndef OUTPUT_SINGLE_FILE
2708 #error OUTPUT_SINGLE_FILE not defined!
2709 #endif
2710 
2711  #if !OUTPUT_SINGLE_FILE
2712  //create directories for multi-file output scheme
2713  create_output_directories("coor");
2714  create_output_directories("vel");
2715  if(dcdFrequency) {
2716  create_output_directories("dcd");
2717  if(opts.defined("dcdfile")){
2718  iout << iWARN << "The dcd file output has been changed to directory: " << outputFilename << ".\n" << endi;
2719  }
2720  }
2721  if (velDcdFrequency) {
2722  create_output_directories("veldcd");
2723  if(opts.defined("veldcdfile")){
2724  iout << iWARN << "The veldcd file output has been changed to directory: " << outputFilename << ".\n" << endi;
2725  }
2726  }
2727  if (forceDcdFrequency) {
2728  create_output_directories("forcedcd");
2729  if(opts.defined("forcedcdfile")){
2730  iout << iWARN << "The forcedcd file output has been changed to directory: " << outputFilename << ".\n" << endi;
2731  }
2732  }
2733  #endif
2734 #endif
2735 
2736  if (! opts.defined("auxFile")) {
2737  strcpy(auxFilename,outputFilename);
2738  strcat(auxFilename,".aux");
2739  }
2740 
2741  // Check for frequencies
2742  if (dcdFrequency) {
2743  if (! opts.defined("dcdfile")) {
2744  strcpy(dcdFilename,outputFilename);
2745  strcat(dcdFilename,".dcd");
2746  }
2747  } else {
2748  dcdFilename[0] = STRINGNULL;
2749  }
2750 
2751  if (velDcdFrequency) {
2752  if (! opts.defined("veldcdfile")) {
2753  strcpy(velDcdFilename,outputFilename);
2754  strcat(velDcdFilename,".veldcd");
2755  }
2756  } else {
2757  velDcdFilename[0] = STRINGNULL;
2758  }
2759 
2760  if (forceDcdFrequency) {
2761  if (! opts.defined("forcedcdfile")) {
2762  strcpy(forceDcdFilename,outputFilename);
2763  strcat(forceDcdFilename,".forcedcd");
2764  }
2765  } else {
2766  forceDcdFilename[0] = STRINGNULL;
2767  }
2768 
2769  if (xstFrequency) {
2770  if (! opts.defined("xstfile")) {
2771  strcpy(xstFilename,outputFilename);
2772  strcat(xstFilename,".xst");
2773  }
2774  } else {
2775  xstFilename[0] = STRINGNULL;
2776  }
2777 
2778  if (restartFrequency) {
2779  if (! opts.defined("restartname")) {
2780  strcpy(restartFilename,outputFilename);
2781  if ( ! restartSave ) strcat(restartFilename,".restart");
2782  }
2783  } else {
2784  restartFilename[0] = STRINGNULL;
2785  restartSave = FALSE;
2786  binaryRestart = FALSE;
2787  }
2788 
2789  if (storeComputeMap || loadComputeMap) {
2790  if (! opts.defined("computeMapFile")) {
2791  strcpy(computeMapFilename,"computeMapFile");
2792  strcat(computeMapFilename,".txt");
2793  }
2794  }
2795 
2796 
2797  if (!amberOn)
2798  { //****** BEGIN CHARMM/XPLOR type changes
2800  if (!paraTypeXplorOn && !paraTypeCharmmOn)
2801  {
2802  paraTypeXplorOn = TRUE;
2803  }
2805  if (paraTypeXplorOn && paraTypeCharmmOn)
2806  {
2807  NAMD_die("Please specify either XPLOR or CHARMM format for parameters!");
2808  }
2809  //****** END CHARMM/XPLOR type changes
2810  }
2811 
2812 
2813  // If minimization isn't on, must have a temp or velocity
2814  if (!(minimizeOn||minimizeCGOn) && !opts.defined("temperature") &&
2815  !opts.defined("velocities") && !opts.defined("binvelocities") )
2816  {
2817  NAMD_die("Must have either an initial temperature or a velocity file");
2818  }
2819 
2820  if (minimizeOn||minimizeCGOn) { initialTemp = 0.0; }
2821  if (opts.defined("velocities") || opts.defined("binvelocities") )
2822  {
2823  initialTemp = -1.0;
2824  }
2825 
2827 
2828  if ( opts.defined("extendedSystem") ) readExtendedSystem(config->find("extendedSystem")->data);
2829 
2830 #ifdef MEM_OPT_VERSION
2831  if ( LJcorrection ) {
2832  NAMD_die("LJ tail corrections not yet available for memory optimized builds");
2833  }
2834 #endif
2835 
2836  if ( LJcorrection && ! cellBasisVector3.length2() ) {
2837  NAMD_die("Can't use LJ tail corrections without periodic boundary conditions!");
2838  }
2839 
2840  if ( cellBasisVector3.length2() && ! cellBasisVector2.length2() ) {
2841  NAMD_die("Used cellBasisVector3 without cellBasisVector2!");
2842  }
2843 
2844  if ( cellBasisVector2.length2() && ! cellBasisVector1.length2() ) {
2845  NAMD_die("Used cellBasisVector2 without cellBasisVector1!");
2846  }
2847 
2848  if ( cellOrigin.length2() && ! cellBasisVector1.length2() ) {
2849  NAMD_die("Used cellOrigin without cellBasisVector1!");
2850  }
2851 
2852  lattice.set(cellBasisVector1,cellBasisVector2,cellBasisVector3,cellOrigin);
2853 
2854  if (! opts.defined("DCDunitcell")) {
2855  dcdUnitCell = lattice.a_p() && lattice.b_p() && lattice.c_p();
2856  }
2857 
2858  char s[129];
2859 
2861  if ( ! opts.defined("cylindricalBCAxis") )
2862  {
2863  cylindricalBCAxis = 'x';
2864  }
2865  else
2866  {
2867  opts.get("cylindricalBCAxis", s);
2868 
2869  if (!strcasecmp(s, "x"))
2870  {
2871  cylindricalBCAxis = 'x';
2872  }
2873  else if (!strcasecmp(s, "y"))
2874  {
2875  cylindricalBCAxis = 'y';
2876  }
2877  else if (!strcasecmp(s, "z"))
2878  {
2879  cylindricalBCAxis = 'z';
2880  }
2881  else
2882  {
2883  char err_msg[128];
2884 
2885  sprintf(err_msg, "Illegal value '%s' for 'cylindricalBCAxis' in configuration file", s);
2886  NAMD_die(err_msg);
2887  }
2888  }
2889 
2890  if (!opts.defined("splitPatch"))
2891  {
2892  splitPatch = SPLIT_PATCH_HYDROGEN;
2893  }
2894  else
2895  {
2896  opts.get("splitPatch", s);
2897  if (!strcasecmp(s, "position"))
2898  splitPatch = SPLIT_PATCH_POSITION;
2899  else if (!strcasecmp(s,"hydrogen"))
2900  splitPatch = SPLIT_PATCH_HYDROGEN;
2901  else
2902  {
2903  char err_msg[129];
2904  sprintf(err_msg,
2905  "Illegal value '%s' for 'splitPatch' in configuration file",
2906  s);
2907  NAMD_die(err_msg);
2908  }
2909  }
2910 
2912  opts.get("exclude", s);
2913 
2914  if (!strcasecmp(s, "none"))
2915  {
2916  exclude = NONE;
2917  splitPatch = SPLIT_PATCH_POSITION;
2918  }
2919  else if (!strcasecmp(s, "1-2"))
2920  {
2921  exclude = ONETWO;
2922  splitPatch = SPLIT_PATCH_POSITION;
2923  }
2924  else if (!strcasecmp(s, "1-3"))
2925  {
2926  exclude = ONETHREE;
2927  }
2928  else if (!strcasecmp(s, "1-4"))
2929  {
2930  exclude = ONEFOUR;
2931  }
2932  else if (!strcasecmp(s, "scaled1-4"))
2933  {
2934  exclude = SCALED14;
2935  }
2936  else
2937  {
2938  char err_msg[128];
2939 
2940  sprintf(err_msg, "Illegal value '%s' for 'exclude' in configuration file",
2941  s);
2942  NAMD_die(err_msg);
2943  }
2944 
2945  if (scale14 != 1.0 && exclude != SCALED14)
2946  {
2947  iout << iWARN << "Exclude is not scaled1-4; 1-4scaling ignored.\n" << endi;
2948  }
2949 
2950  // water model stuff
2951  if (!opts.defined("waterModel")) {
2952  watmodel = WAT_TIP3;
2953  } else {
2954  opts.get("waterModel", s);
2955  if (!strncasecmp(s, "tip4", 4)) {
2956  iout << iINFO << "Using TIP4P water model.\n" << endi;
2957  watmodel = WAT_TIP4;
2958  } else if (!strncasecmp(s, "tip3", 4)) {
2959  iout << iINFO << "Using TIP3P water model.\n" << endi;
2960  watmodel = WAT_TIP3;
2961  } else if (!strncasecmp(s, "swm4", 4)) {
2962  iout << iINFO << "Using SWM4-DP water model.\n" << endi;
2963  watmodel = WAT_SWM4;
2964  } else {
2965  char err_msg[128];
2966  sprintf(err_msg,
2967  "Illegal value %s for 'waterModel' in configuration file", s);
2968  NAMD_die(err_msg);
2969  }
2970  }
2971  if (watmodel == WAT_SWM4 && !drudeOn) {
2972  NAMD_die("Must have 'drudeOn' enabled to use SWM4-DP water model.");
2973  }
2974  if (drudeOn && watmodel != WAT_SWM4) {
2975  watmodel = WAT_SWM4;
2976  iout << iWARN
2977  << "Setting water model to 'swm4' (SWM4-DP) for Drude polarization.\n"
2978  << endi;
2979  }
2980 
2981  // Drude water model uses "lonepairs"
2982  if (watmodel == WAT_SWM4) {
2983  lonepairs = TRUE;
2984  }
2985 
2986  // Added by JLai -- 8.2.11 -- Checks if Go method is defined
2987  if (goForcesOn) {
2988  iout << iINFO << "Go forces are on\n" << endi;
2989  // Added by JLai -- 6.3.11 -- Checks if Go method is defined
2990  int * gomethod = &goMethod;
2991  if (!opts.defined("GoMethod")) {
2992  *gomethod = 0;
2993  // printf("GO METHOD IS NOT DEFINED SO WE'LL SET IT TO SOME WEIRD VALUE\n");
2994  } else {
2995  opts.get("GoMethod",s);
2996  // printf("GO METHOD IS DEFINED SO WE'LL PRINT IT OUT: %s\n",s);
2997  *gomethod = atoi(s);
2998  }
2999  if (!strcasecmp(s, "matrix")) {
3000  goMethod = 1;
3001  //GoMethod = GO_MATRIX;
3002  } else if (!strcasecmp(s, "faster")) {
3003  goMethod = 2;
3004  //GoMethod = GO_FASTER;
3005  } else if (!strcasecmp(s, "lowmem")) {
3006  goMethod = 3;
3007  //GoMethod = GO_LOWMEM;
3008  }
3009  else {
3010  char err_msg[129];
3011  sprintf(err_msg,
3012  "Illegal value '%s' for 'GoMethod' in configuration file",
3013  s);
3014  NAMD_die(err_msg);
3015  }
3016  } // End of NAMD code to check goMethod
3017  // End of Port -- JL
3018 
3019  // Get multiple timestep integration scheme
3020  if (!opts.defined("MTSAlgorithm"))
3021  {
3022  MTSAlgorithm = VERLETI;
3023  }
3024  else
3025  {
3026  opts.get("MTSAlgorithm", s);
3027 
3028  if (!strcasecmp(s, "naive"))
3029  {
3030  MTSAlgorithm = NAIVE;
3031  }
3032  else if (!strcasecmp(s, "constant"))
3033  {
3034  MTSAlgorithm = NAIVE;
3035  }
3036  else if (!strcasecmp(s, "impulse"))
3037  {
3038  MTSAlgorithm = VERLETI;
3039  }
3040  else if (!strcasecmp(s, "verleti"))
3041  {
3042  MTSAlgorithm = VERLETI;
3043  }
3044  else
3045  {
3046  char err_msg[129];
3047 
3048  sprintf(err_msg,
3049  "Illegal value '%s' for 'MTSAlgorithm' in configuration file",
3050  s);
3051  NAMD_die(err_msg);
3052  }
3053  }
3054 
3055  // Get the long range force splitting specification
3056  if (!opts.defined("longSplitting"))
3057  {
3058  longSplitting = C1;
3059  }
3060  else
3061  {
3062  opts.get("longSplitting", s);
3063  if (!strcasecmp(s, "sharp"))
3064  longSplitting = SHARP;
3065  else if (!strcasecmp(s, "xplor"))
3066  longSplitting = XPLOR;
3067  else if (!strcasecmp(s, "c1"))
3068  longSplitting = C1;
3069  else if (!strcasecmp(s, "c2"))
3070  longSplitting = C2;
3071  else
3072  {
3073  char err_msg[129];
3074 
3075  sprintf(err_msg,
3076  "Illegal value '%s' for 'longSplitting' in configuration file",
3077  s);
3078  NAMD_die(err_msg);
3079  }
3080  }
3081 
3082  // take care of rigid bond options
3083  if (!opts.defined("rigidBonds"))
3084  {
3085  rigidBonds = RIGID_NONE;
3086  }
3087  else
3088  {
3089  opts.get("rigidBonds", s);
3090  if (!strcasecmp(s, "all"))
3091  {
3092  rigidBonds = RIGID_ALL;
3093  }
3094  else if (!strcasecmp(s, "water"))
3095  {
3096  rigidBonds = RIGID_WATER;
3097  }
3098  else if (!strcasecmp(s, "none"))
3099  {
3100  rigidBonds = RIGID_NONE;
3101  }
3102  else
3103  {
3104  char err_msg[256];
3105  sprintf(err_msg,
3106  "Illegal value '%s' for 'rigidBonds' in configuration file", s);
3107  NAMD_die(err_msg);
3108  }
3109  }
3110 
3111  // TIP4P and SWM4-DP water models require rigid water
3112  if ((watmodel == WAT_TIP4 || watmodel == WAT_SWM4)
3113  && rigidBonds == RIGID_NONE) {
3114  char err_msg[256];
3115  sprintf(err_msg,
3116  "Water model %s requires rigidBonds set to \"all\" or \"water\"",
3117  (watmodel == WAT_TIP4 ? "TIP4P" : "SWM4-DP"));
3118  NAMD_die(err_msg);
3119  }
3120 
3121  // Take care of switching stuff
3122  if (switchingActive)
3123  {
3124 
3125  if (!opts.defined("switchDist")) {
3126  NAMD_die("switchDist must be defined when switching is enabled");
3127  }
3128 
3129  if ( (switchingDist>cutoff) || (switchingDist<0) )
3130  {
3131  char err_msg[129];
3132 
3133  sprintf(err_msg,
3134  "switchDist muct be between 0 and cutoff, which is %f", cutoff);
3135  NAMD_die(err_msg);
3136  }
3137 
3138  }
3139 
3140  if ( martiniSwitching )
3141  {
3142  if ( ! switchingActive )
3143  {
3144  NAMD_die("martiniSwitching requires switching");
3145  }
3146  if ( vdwForceSwitching )
3147  {
3148  NAMD_die("martiniSwitching and vdwForceSwitching are exclusive to one another. Select only one.");
3149  }
3150  if ( dielectric != 15.0 && ! martiniDielAllow )
3151  {
3152  iout << iWARN << "USE DIELECTRIC OF 15.0 WITH MARTINI.\n";
3153  iout << iWARN << "SETTING dielectric 15.0\n";
3154  iout << iWARN << "FOR NON-STANDARD DIELECTRIC WITH MARTINI, SET: martiniDielAllow on\n";
3155  dielectric = 15.0;
3156  }
3157  if ( ! cosAngles )
3158  {
3159  iout << iWARN << "USE COSINE BASED ANGLES WITH MARTINI.\n";
3160  iout << iWARN << "SETTING cosAngles on\n";
3161  cosAngles = TRUE;
3162  }
3163  if ( PMEOn )
3164  {
3165  NAMD_die("Do not use Particle Mesh Ewald with Martini. Set: PME off");
3166  }
3167  if ( MSMOn )
3168  {
3169  NAMD_die("Do not use Multilevel Summation Method with Martini. Set: MSM off");
3170  }
3171  if ( FMMOn )
3172  {
3173  NAMD_die("Do not use Fast Multipole Method with Martini. Set: FMM off");
3174  }
3175 
3176  }
3177 
3178 
3179  if (!opts.defined("pairlistDist"))
3180  {
3181  pairlistDist = cutoff;
3182  }
3183  else if (pairlistDist < cutoff)
3184  {
3185  NAMD_die("pairlistDist must be >= cutoff distance");
3186  }
3187 
3188  patchDimension = pairlistDist;
3189 
3190  if ( splitPatch == SPLIT_PATCH_HYDROGEN ) {
3191  patchDimension += hgroupCutoff;
3192  }
3193 
3194  BigReal defaultMargin = 0.0;
3195  if (berendsenPressureOn || langevinPistonOn) {
3196  defaultMargin = ( useFlexibleCell ? 0.06 : 0.03 ) * patchDimension;
3197  }
3198  if ( margin == XXXBIGREAL ) {
3199  margin = defaultMargin;
3200  }
3201  if ( defaultMargin != 0.0 && margin == 0.0 ) {
3202  margin = defaultMargin;
3203  iout << iWARN << "ALWAYS USE NON-ZERO MARGIN WITH CONSTANT PRESSURE!\n";
3204  iout << iWARN << "CHANGING MARGIN FROM 0 to " << margin << "\n" << endi;
3205  }
3206 
3207  patchDimension += margin;
3208 
3209  //ensure patch can handle alpha_cutoff for gbis
3210  if (GBISOn) {
3211  //Check compatibility
3212  if (fullDirectOn) {
3213  NAMD_die("GBIS not compatible with FullDirect");
3214  }
3215  if (PMEOn) {
3216  NAMD_die("GBIS not compatible with PME");
3217  }
3218  if (MSMOn) {
3219  NAMD_die("GBIS not compatible with MSM");
3220  }
3221  if (FMMOn) {
3222  NAMD_die("GBIS not compatible with FMM");
3223  }
3224  if (alchOn) {
3225  NAMD_die("GBIS not compatible with Alchemical Transformations");
3226  }
3227  if (lesOn) {
3228  NAMD_die("GBIS not compatible with Locally Enhanced Sampling");
3229  }
3230  if (FMAOn) {
3231  NAMD_die("GBIS not compatible with FMA");
3232  }
3233  if (drudeOn) {
3234  NAMD_die("GBIS not compatible with Drude Polarization");
3235  }
3236 
3237  if (alpha_cutoff > patchDimension) {
3238  patchDimension = alpha_cutoff;
3239  }
3240  //calculate kappa
3241  BigReal tmp = (initialTemp > 0) ? initialTemp : 300;
3242  kappa = 50.29216*sqrt(ion_concentration/solvent_dielectric/tmp);
3243  /*magic number = 1/sqrt(eps0*kB/(2*nA*e^2*1000))*/
3244  } // GBISOn
3245 
3246  if (LCPOOn) {
3247 #ifdef MEM_OPT_VERSION
3248  NAMD_die("SASA not yet available for memory optimized builds");
3249 #endif
3250  if ( lattice.volume() > 0 ) {
3251  NAMD_die("SASA does not yet support periodic boundary conditions.");
3252  }
3253  //LCPO requires patches to be at least 16.2Ang in each dimension
3254  // twoAway[XYZ} is ignored for now
3255  }
3256 
3257  // Turn on global integration if not explicitly specified
3258 
3259  if ( dihedralOn ) globalOn = TRUE;
3260 
3261 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
3262  if (loweAndersenOn) {
3263  NAMD_die("Lowe-Andersen dynamics not compatible with CUDA at this time");
3264  }
3265 #endif
3266  // END LA
3267 
3268  // BEGIN LA
3269  if (loweAndersenOn && (langevinOn || tCoupleOn))
3270  {
3271  NAMD_die("Lowe-Andersen dynamics, Langevin dynamics and temperature coupling are mutually exclusive dynamics modes");
3272  }
3273  // END LA
3274 
3275  if (tCoupleOn && opts.defined("rescaleFreq") )
3276  {
3277  NAMD_die("Temperature coupling and temperature rescaling are mutually exclusive");
3278  }
3279 
3280  if (globalOn && CkNumPes() > 1)
3281  {
3282  NAMD_die("Global integration does not run in parallel (yet).");
3283  }
3284 
3285  if (COLDOn && langevinOn)
3286  {
3287  NAMD_die("COLD and Langevin dynamics are mutually exclusive dynamics modes");
3288  }
3289  if (COLDOn && minimizeOn)
3290  {
3291  NAMD_die("COLD and minimization are mutually exclusive dynamics modes");
3292  }
3293  if (COLDOn && tCoupleOn)
3294  {
3295  NAMD_die("COLD and temperature coupling are mutually exclusive dynamics modes");
3296  }
3297  if (COLDOn && opts.defined("rescaleFreq"))
3298  {
3299  NAMD_die("COLD and velocity rescaling are mutually exclusive dynamics modes");
3300  }
3301 
3302  if (splitPatch == SPLIT_PATCH_POSITION && mollyOn )
3303  {
3304  NAMD_die("splitPatch hydrogen is required for MOLLY");
3305  }
3306 
3307  if (splitPatch == SPLIT_PATCH_POSITION && rigidBonds != RIGID_NONE)
3308  {
3309  NAMD_die("splitPatch hydrogen is required for rigidBonds");
3310  }
3311 
3312  if (accelMDOn) {
3313  if(accelMDG){
3314  char msg[128];
3315  if(accelMDGiE < 1 || accelMDGiE > 2){
3316  sprintf(msg, "accelMDGiE was set to %d but it should be 1 or 2", accelMDGiE);
3317  NAMD_die(msg);
3318  }
3319  if(accelMDGStatWindow > 0){
3320  if(accelMDGcMDPrepSteps % accelMDGStatWindow != 0)
3321  NAMD_die("'accelMDGcMDPrepSteps' has to be a multiple of 'accelMDGStatWindow'");
3322  if(accelMDGcMDSteps % accelMDGStatWindow != 0)
3323  NAMD_die("'accelMDGcMDSteps' has to be a multiple of 'accelMDGStatWindow'");
3324  if(accelMDGEquiPrepSteps % accelMDGStatWindow != 0)
3325  NAMD_die("'accelMDGEquiPrepSteps' has to be a multiple of 'accelMDGStatWindow'");
3326  if(accelMDGEquiSteps % accelMDGStatWindow != 0)
3327  NAMD_die("'accelMDGEquiSteps' has to be a multiple of 'accelMDGStatWindow'");
3328  }
3329  if(accelMDGRestart && accelMDGcMDSteps == 0)
3330  accelMDGcMDPrepSteps = 0;
3331  else if(accelMDGcMDSteps - accelMDGcMDPrepSteps < 2)
3332  NAMD_die("'accelMDGcMDSteps' should be larger than 'accelMDGcMDPrepSteps'");
3333 
3334  if(accelMDGEquiSteps == 0)
3335  accelMDGEquiPrepSteps = 0;
3336  else if(accelMDGresetVaftercmd){
3337  if(accelMDGEquiPrepSteps <= 0)
3338  NAMD_die("'accelMDGEquiPrepSteps' should be non-zero");
3339  if(accelMDGEquiSteps - accelMDGEquiPrepSteps < 1)
3340  NAMD_die("'accelMDGEquiSteps' should be larger than 'accelMDGEquiPrepSteps'");
3341  }
3342 
3343  //warn user that accelMD params will be ignored
3344  if(opts.defined("accelMDE"))
3345  iout << iWARN << "accelMDE will be ignored with accelMDG on.\n" << endi;
3346  if(opts.defined("accelMDalpha"))
3347  iout << iWARN << "accelMDalpha will be ignored with accelMDG on.\n" << endi;
3348  if(opts.defined("accelMDTE"))
3349  iout << iWARN << "accelMDTE will be ignored with accelMDG on.\n" << endi;
3350  if(opts.defined("accelMDTalpha"))
3351  iout << iWARN << "accelMDTalpha will be ignored with accelMDG on.\n" << endi;
3352  }
3353  else{
3354  if(!opts.defined("accelMDE") || !opts.defined("accelMDalpha"))
3355  NAMD_die("accelMDE and accelMDalpha are required for accelMD with accelMDG off");
3356 
3357  if(accelMDdual && (!opts.defined("accelMDTE") || !opts.defined("accelMDTalpha"))){
3358  NAMD_die("accelMDTE and accelMDTalpha are required for accelMDdual with accelMDG off");
3359  }
3360  }
3361  }
3362 
3363  // Set the default value for the maximum movement parameter
3364  // for minimization
3365  if (minimizeOn && (maximumMove == 0.0))
3366  {
3367  maximumMove = 0.75 * pairlistDist/stepsPerCycle;
3368  }
3369  if (adaptTempOn) {
3370  if (!adaptTempRescale && !adaptTempLangevin)
3371  NAMD_die("Adaptive tempering needs to be coupled to either the Langevin thermostat or velocity rescaling.");
3372  if (opts.defined("adaptTempInFile") && (opts.defined("adaptTempTmin") ||
3373  opts.defined("adaptTempTmax") ||
3374  adaptTempBins != 0))
3375  NAMD_die("cannot simultaneously specify adaptTempInFile and any of {adaptTempTmin, adaptTempTmax,adaptTempBins} as these are read from the input file");
3376  if (!opts.defined("adaptTempInFile") && !(opts.defined("adaptTempTmin") &&
3377  opts.defined("adaptTempTmax") &&
3378  adaptTempBins != 0 ))
3379  NAMD_die("Need to specify either adaptTempInFile or all of {adaptTempTmin, adaptTempTmax,adaptTempBins} if adaptTempMD is on.");
3380  }
3381 
3382  langevinOnAtStartup = langevinOn;
3383  if (langevinOn) {
3384  if ( ! opts.defined("langevinDamping") ) langevinDamping = 0.0;
3385  if ( ! opts.defined("langevinHydrogen") ) langevinHydrogen = TRUE;
3386  if ( (opts.defined("langevinDamping") || opts.defined("langevinHydrogen"))
3387  && (opts.defined("langevinFile") || opts.defined("langevinCol")) )
3388  NAMD_die("To specify Langevin dynamics parameters, use either langevinDamping and langevinHydrogen or langevinFile and langevinCol. Do not combine them.");
3389  if ( opts.defined("langevinHydrogen") && langevinDamping == 0.0 )
3390  NAMD_die("langevinHydrogen requires langevinDamping to be set.");
3391  }
3392 
3393  // BEGIN LA
3394  if (loweAndersenOn) {
3395  if (!opts.defined("loweAndersenRate")) loweAndersenRate = 100;
3396  if (!opts.defined("loweAndersenCutoff")) loweAndersenCutoff = 2.7;
3397  }
3398  // END LA
3399 
3400  // BKR - stochastic velocity rescaling
3401  if (stochRescaleOn) {
3402  if (langevinOn || loweAndersenOn || tCoupleOn ||
3403  opts.defined("rescaleFreq") || opts.defined("reassignFreq"))
3404  NAMD_die("Stochastic velocity rescaling is incompatible with other temperature control methods");
3405  // This is largely the same default used in GROMACS.
3406  if (!opts.defined("stochRescaleFreq")) stochRescaleFreq = stepsPerCycle;
3407  }
3408 
3409  if (opts.defined("rescaleFreq"))
3410  {
3411  if (!opts.defined("rescaleTemp"))
3412  {
3413  if (opts.defined("temperature"))
3414  {
3415  rescaleTemp = initialTemp;
3416  }
3417  else
3418  {
3419  NAMD_die("Must give a rescale temperature if rescaleFreq is defined");
3420  }
3421  }
3422  }
3423  else
3424  {
3425  rescaleFreq = -1;
3426  rescaleTemp = 0.0;
3427  }
3428 
3429  if (opts.defined("rescaleTemp"))
3430  {
3431  if (!opts.defined("rescaleFreq"))
3432  {
3433  NAMD_die("Must give a rescale freqency if rescaleTemp is given");
3434  }
3435  }
3436 
3437  if (opts.defined("reassignFreq"))
3438  {
3439  if (!opts.defined("reassignTemp"))
3440  {
3441  if (opts.defined("temperature"))
3442  {
3443  reassignTemp = initialTemp;
3444  }
3445  else
3446  {
3447  NAMD_die("Must give a reassign temperature if reassignFreq is defined");
3448  }
3449  }
3450  }
3451  else
3452  {
3453  reassignFreq = -1;
3454  reassignTemp = 0.0;
3455  }
3456 
3457  if (opts.defined("reassignTemp"))
3458  {
3459  if (!opts.defined("reassignFreq"))
3460  {
3461  NAMD_die("Must give a reassignment freqency if reassignTemp is given");
3462  }
3463  }
3464 
3465  if (opts.defined("reassignIncr"))
3466  {
3467  if (!opts.defined("reassignFreq"))
3468  {
3469  NAMD_die("Must give a reassignment freqency if reassignIncr is given");
3470  }
3471  }
3472  else
3473  {
3474  reassignIncr = 0.0;
3475  }
3476 
3477  if (opts.defined("reassignHold"))
3478  {
3479  if (!opts.defined("reassignIncr"))
3480  {
3481  NAMD_die("Must give a reassignment increment if reassignHold is given");
3482  }
3483  }
3484  else
3485  {
3486  reassignHold = 0.0;
3487  }
3488 
3489  if (!opts.defined("seed"))
3490  {
3491  randomSeed = (unsigned int) time(NULL) + 31530001 * CmiMyPartition();
3492  }
3493 
3494  // REST2
3495  if (opts.defined("soluteScaling")) {
3496  // Parameters soluteScalingFactorCharge and soluteScalingFactorVdw
3497  // allow independent scaling of electrostatics and van der Waals.
3498  // Initialize with soluteScalingFactor if either is not already set.
3499  if ( ! opts.defined("soluteScalingFactorCharge") ) {
3500  soluteScalingFactorCharge = soluteScalingFactor;
3501  }
3502  if ( ! opts.defined("soluteScalingFactorVdw") ) {
3503  soluteScalingFactorVdw = soluteScalingFactor;
3504  }
3505  }
3506 
3507 //fepb
3508  alchFepOnAtStartup = alchFepOn = FALSE;
3509  alchThermIntOnAtStartup = alchThermIntOn = FALSE;
3510  alchOnAtStartup = alchOn;
3511 
3512  if (alchOn) {
3513  if (martiniSwitching) {
3514  iout << iWARN << "Martini switching disabled for alchemical "
3515  "interactions.\n" << endi;
3516  }
3517 
3518  if (!opts.defined("alchType")) {
3519  NAMD_die("Must define type of alchemical simulation: fep or ti\n");
3520  }
3521  else {
3522  opts.get("alchType",s);
3523  if (!strcasecmp(s, "fep")) {
3524  alchFepOnAtStartup = alchFepOn = TRUE;
3525  }
3526  else if (!strcasecmp(s, "ti")) {
3527  alchThermIntOnAtStartup = alchThermIntOn = TRUE;
3528  }
3529  else {
3530  NAMD_die("Unknown type of alchemical simulation; choices are fep or ti\n");
3531  }
3532  }
3533 
3534  if (rescaleFreq > 0) alchTemp = rescaleTemp;
3535  else if (reassignFreq > 0) alchTemp = reassignTemp;
3536  else if (langevinOn) alchTemp = langevinTemp;
3537  else if (stochRescaleOn) alchTemp = stochRescaleTemp;
3538  else if (tCoupleOn) alchTemp = tCoupleTemp;
3539  else NAMD_die("Alchemical FEP can be performed only in constant temperature simulations\n");
3540 
3541  if (reassignFreq > 0 && reassignIncr != 0)
3542  NAMD_die("reassignIncr cannot be used in alchemical simulations\n");
3543 
3544  if (alchLambda < 0.0 || alchLambda > 1.0)
3545  NAMD_die("alchLambda values should be in the range [0.0, 1.0]\n");
3546 
3547  if (alchVdwLambdaEnd > 1.0)
3548  NAMD_die("Gosh tiny Elvis, you kicked soft-core in the van der Waals! alchVdwLambdaEnd should be in the range [0.0, 1.0]\n");
3549 
3550  if (alchBondLambdaEnd > 1.0)
3551  NAMD_die("alchBondLambdaEnd should be in the range [0.0, 1.0]\n");
3552 
3553  if (alchElecLambdaStart > 1.0)
3554  NAMD_die("alchElecLambdaStart should be in the range [0.0, 1.0]\n");
3555 
3556  if (alchWCAOn) {
3557  if (alchRepLambdaEnd > 1.0)
3558  NAMD_die("alchRepLambdaEnd should be in the range [0.0, 1.0]\n");
3559  if (alchVdwLambdaEnd < alchRepLambdaEnd)
3560  NAMD_die("alchVdwLambdaEnd should be greater than alchRepLambdaEnd\n");
3561  if (alchVdwShiftCoeff > 0.0) {
3562  iout << iWARN << "alchVdwShiftCoeff is non-zero but not used when WCA"
3563  << " is active. Setting it to zero now.\n" << endi;
3564  alchVdwShiftCoeff = 0.0;
3565  }
3566  if (alchThermIntOn) {
3567  NAMD_die("alchWCA is not currently compatible with TI");
3568  }
3569 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
3570  NAMD_die("alchWCA is not currently available with CUDA");
3571 #endif
3572  }
3573 
3574  if (alchFepOn) {
3575  if (alchLambda2 < 0.0 || alchLambda2 > 1.0)
3576  NAMD_die("alchLambda2 values should be in the range [0.0, 1.0]\n");
3577 
3578  setupIDWS(); // setup IDWS if it was activated.
3579 
3580  if (!opts.defined("alchoutfile")) {
3581  strcpy(alchOutFile, outputFilename);
3582  strcat(alchOutFile, ".fep");
3583  }
3584 
3585  if (!opts.defined("alchLambda") || !opts.defined("alchLambda2")) {
3586  NAMD_die("alchFepOn is on, but alchLambda or alchLambda2 is not set.");
3587  }
3588  }
3589  else if (alchThermIntOn) {
3590  // alchLambda2 is only needed for nonequilibrium switching
3591  if (alchLambdaFreq && (alchLambda2 < 0.0 || alchLambda2 > 1.0))
3592  NAMD_die("alchLambda2 values should be in the range [0.0, 1.0]\n");
3593 
3594  if (!opts.defined("alchoutfile")) {
3595  strcpy(alchOutFile, outputFilename);
3596  strcat(alchOutFile, ".ti");
3597  }
3598  }
3599  }
3600 
3601 //fepe
3602 
3603  if ( alchOn && alchFepOn && alchThermIntOn )
3604  NAMD_die("Sorry, combined TI and FEP is not implemented.\n");
3605  if ( alchOn && lesOn )
3606  NAMD_die("Sorry, combined LES with FEP or TI is not implemented.\n");
3607  if ( alchOn && alchThermIntOn && lesOn )
3608  NAMD_die("Sorry, combined LES and TI is not implemented.\n");
3609  if ( alchWCAOn && !alchOn ) {
3610  iout << iWARN << "Alchemical WCA decomposition was requested but \
3611  alchemical free energy calculation is not active. Setting \
3612  alchWCA to off.\n" << endi;
3613  alchWCAOn = FALSE;
3614  }
3615  if ( alchDecouple && !alchOn ) {
3616  iout << iWARN << "Alchemical decoupling was requested but \
3617  alchemical free energy calculation is not active. Setting \
3618  alchDecouple to off.\n" << endi;
3619  alchDecouple = FALSE;
3620  }
3621  if ( alchBondDecouple && !alchOn ) {
3622  iout << iWARN << "Alchemical bond decoupling was requested but \
3623  alchemical free energy calculation is not active. Setting \
3624  alchBondDecouple to off.\n" << endi;
3625  alchBondDecouple = FALSE;
3626  }
3627 
3628  if ( lesOn && ( lesFactor < 1 || lesFactor > 255 ) ) {
3629  NAMD_die("lesFactor must be positive and less than 256");
3630  }
3631  if ((pairInteractionOn && alchOn) || (pairInteractionOn && lesOn))
3632  NAMD_die("Sorry, pair interactions may not be calculated when LES, FEP or TI is enabled.");
3633 
3634  // Drude model
3635  if (drudeOn) {
3636  if ( ! langevinOn ) {
3637  NAMD_die("Drude model requires use of Langevin thermostat.");
3638  }
3639  if ( ! opts.defined("drudeDamping")) {
3640  drudeDamping = langevinDamping;
3641  iout << iWARN << "Undefined 'drudeDamping' will be set to "
3642  "value of 'langevinDamping'\n" << endi;
3643  }
3644  if ( alchOn ) {
3645  NAMD_die("Drude implementation is incompatible with alchemical "
3646  "free energy calculation.");
3647  }
3648  }
3649 
3650  // Set up load balancing variables
3651  if (opts.defined("ldBalancer")) {
3652  if (strcasecmp(loadBalancer, "none") == 0)
3653  ldBalancer = LDBAL_NONE;
3654  else if (strcasecmp(loadBalancer, "hybrid") == 0)
3655  ldBalancer = LDBAL_HYBRID;
3656  else
3657  NAMD_die("Unknown ldBalancer selected");
3658  } else {
3659  ldBalancer = LDBAL_CENTRALIZED;
3660 #ifdef MEM_OPT_VERSION
3661  if ( CkNumPes() > 1400 ) ldBalancer = LDBAL_HYBRID;
3662 #endif
3663  }
3664 
3665  if (opts.defined("ldbStrategy")) {
3666  // Assign the load balancing strategy
3667  if (strcasecmp(loadStrategy, "comprehensive") == 0)
3668  ldbStrategy = LDBSTRAT_COMPREHENSIVE;
3669  else if (strcasecmp(loadStrategy, "refineonly") == 0)
3670  ldbStrategy = LDBSTRAT_REFINEONLY;
3671  else if (strcasecmp(loadStrategy, "old") == 0)
3672  ldbStrategy = LDBSTRAT_OLD;
3673  else
3674  NAMD_die("Unknown ldbStrategy selected");
3675  } else {
3676  ldbStrategy = LDBSTRAT_DEFAULT;
3677  }
3678 
3679  if (!opts.defined("ldbPeriod")) {
3680  ldbPeriod=200*stepsPerCycle;
3681  }
3682 
3683  // Set default values
3684  if (!opts.defined("firstLdbStep")) {
3685  firstLdbStep=5*stepsPerCycle;
3686  }
3687 
3688  if (ldbPeriod <= firstLdbStep) {
3689  NAMD_die("ldbPeriod must greater than firstLdbStep.");
3690  }
3691 
3692  if (!opts.defined("lastLdbStep")) {
3693  lastLdbStep = -1;
3694  }
3695 
3696  if (!opts.defined("hybridGroupSize")) {
3697  hybridGroupSize = 512;
3698  }
3699  if ( hybridGroupSize < CkNumPes() ) {
3700  // match load balancer boundaries to physical nodes if possible
3701  int groupsize = hybridGroupSize;
3702  int *rpelist;
3703  int nodesize;
3704  CmiGetPesOnPhysicalNode(CmiPhysicalNodeID(0), &rpelist, &nodesize);
3705  if ( CkNumPes() % nodesize ) nodesize = CmiNodeSize(CmiNodeOf(0));
3706  if ( CkNumPes() % nodesize ) nodesize = 1;
3707  groupsize += nodesize - 1;
3708  while ( 2 * groupsize > CkNumPes() ) --groupsize;
3709  if ( groupsize < nodesize ) groupsize = nodesize;
3710  while ( groupsize % nodesize ) --groupsize;
3711  while ( groupsize && CkNumPes() % groupsize ) groupsize -= nodesize;
3712  if ( 2 * groupsize < hybridGroupSize ) {
3713  groupsize += nodesize;
3714  while ( CkNumPes() % groupsize ) groupsize += nodesize;
3715  }
3716  if ( 2 * groupsize <= CkNumPes() ) hybridGroupSize = groupsize;
3717  }
3718 
3719  // tracing will be done if trace is available and user says +traceOff
3720  // in that case we set nice values for some functions
3721  bool specialTracing = traceAvailable() && (traceIsOn() == 0);
3722 
3723  if(!opts.defined("traceStartStep")) {
3724  traceStartStep = 4 * firstLdbStep + 2 * ldbPeriod;
3725  }
3726  if(!opts.defined("numTraceSteps")) {
3727  numTraceSteps = 100;
3728  }
3729 
3730  if(specialTracing) {
3731  if (!opts.defined("firstLdbStep")) firstLdbStep = 20;
3732  if (!opts.defined("ldbPeriod")) ldbPeriod = 100;
3733 
3734  if(!opts.defined("traceStartStep")) {
3735  traceStartStep = 4 * firstLdbStep + 2 * ldbPeriod; // 380
3736  }
3737 
3738  if(!opts.defined("numTraceSteps")) {
3739  numTraceSteps = 80;
3740  }
3741  }
3742 
3743 #ifdef MEASURE_NAMD_WITH_PAPI
3744  if(papiMeasure){
3745  if(!opts.defined("papiMeasureStartStep")) {
3746  papiMeasureStartStep = 3 * firstLdbStep;
3747  }
3748  if(!opts.defined("numPapiMeasureSteps")) {
3749  numPapiMeasureSteps = 8; //including two pme steps
3750  }
3751  }
3752 #endif
3753 
3754  if(simulateInitialMapping) {
3755  if(!opts.defined("simulatedPEs")){
3756  simulatedPEs = CkNumPes();
3757  }
3758  if(!opts.defined("simulatedNodeSize")){
3759  simulatedNodeSize = CkMyNodeSize();
3760  }
3761  }
3762 
3763 #ifdef MEM_OPT_VERSION
3764  //Some constraints on the values of load balancing parameters.
3765  //The reason is related to communication schemes used in sending proxy
3766  //data. If the step immediately after the load balancing is not a step
3767  //for atom migration, then it's possible there are some necessary information
3768  // missing inside the ProxyPatch which will crash the program. Therefore,
3769  // It's better that the step immediately after the load balancing be a step
3770  // for atom migration so that the some overhead in Proxy msgs are removed.
3771  // --Chao Mei
3772  if(ldbPeriod%stepsPerCycle!=0 || firstLdbStep%stepsPerCycle!=0) {
3773  iout << iWARN << "In memory optimized version, the ldbPeriod parameter or firstLdbStep parameter is better set to be a multiple of stepsPerCycle parameter!\n";
3774  }
3775 #endif
3776 
3777  if (N < firstTimestep) { N = firstTimestep; }
3778 
3779  if ( (firstTimestep%stepsPerCycle) != 0)
3780  {
3781  NAMD_die("First timestep must be a multiple of stepsPerCycle!!");
3782  }
3783 
3784  // Make sure only one full electrostatics algorithm is selected
3785  {
3786  int i = 0;
3787  if ( FMAOn ) ++i;
3788  if ( PMEOn ) ++i;
3789  if ( MSMOn ) ++i;
3790  if ( FMMOn ) ++i;
3791  if ( fullDirectOn ) ++i;
3792  if ( i > 1 )
3793  NAMD_die("More than one full electrostatics algorithm selected!!!");
3794  }
3795 
3796  if (!opts.defined("ldbBackgroundScaling")) {
3797  ldbBackgroundScaling = 1.0;
3798  }
3799  if (!opts.defined("ldbPMEBackgroundScaling")) {
3800  ldbPMEBackgroundScaling = ldbBackgroundScaling;
3801  }
3802  if (!opts.defined("ldbHomeBackgroundScaling")) {
3803  ldbHomeBackgroundScaling = ldbBackgroundScaling;
3804  }
3805 
3806  // Check on PME parameters
3807  if (PMEOn) { // idiot checking
3808  if ( lattice.volume() == 0. ) {
3809  NAMD_die("PME requires periodic boundary conditions.");
3810  }
3811  if ( PMEGridSpacing == 0. ) {
3812  if ( PMEGridSizeX * PMEGridSizeY * PMEGridSizeZ == 0 )
3813  NAMD_die("Either PMEGridSpacing or PMEGridSizeX, PMEGridSizeY, and PMEGridSizeZ must be specified.");
3814  else PMEGridSpacing = 1.5; // only exit in very bad cases
3815  }
3816 #ifndef TEST_PME_GRID
3817  for ( int idim = 0; idim < 3; ++idim ) {
3818  int *gridSize;
3819  BigReal cellLength;
3820  const char *direction;
3821  switch ( idim ) {
3822  case 0: direction = "X";
3823  gridSize = &PMEGridSizeX; cellLength = lattice.a().length();
3824  break;
3825  case 1: direction = "Y";
3826  gridSize = &PMEGridSizeY; cellLength = lattice.b().length();
3827  break;
3828  case 2: direction = "Z";
3829  gridSize = &PMEGridSizeZ; cellLength = lattice.c().length();
3830  break;
3831  }
3832  int minSize = (int) ceil(cellLength/PMEGridSpacing);
3833 #else
3834  for ( int minSize = 1; minSize < 300; ++minSize ) {
3835 #endif
3836  int bestSize = 10 * (minSize + 10); // make sure it's big
3837  int max2, max3, ts;
3838  for ( max2=2, ts=1; ts < minSize; ++max2 ) ts *= 2;
3839  for ( max3=2, ts=1; ts < minSize; ++max3 ) ts *= 3;
3840  int max5 = 2;
3841  int max7 = 1;
3842  int max11 = 1;
3843  for ( int i2 = 0; i2 <= max2; ++i2 ) {
3844  for ( int i3 = 0; i3 <= max3; ++i3 ) {
3845  for ( int i5 = 0; i5 <= max5; ++i5 ) {
3846  for ( int i7 = 0; i7 <= max7; ++i7 ) {
3847  for ( int i11 = 0; i11 <= max11; ++i11 ) {
3848  if ( i5 + i7 + i11 > i2 ) continue;
3849  int testSize = 2; // must be even
3850  for ( int j2 = 0; j2 < i2; ++j2 ) testSize *= 2;
3851  if ( testSize > bestSize ) continue;
3852  for ( int j3 = 0; j3 < i3; ++j3 ) testSize *= 3;
3853  if ( testSize > bestSize ) continue;
3854  for ( int j5 = 0; j5 < i5; ++j5 ) testSize *= 5;
3855  if ( testSize > bestSize ) continue;
3856  for ( int j7 = 0; j7 < i7; ++j7 ) testSize *= 7;
3857  if ( testSize > bestSize ) continue;
3858  for ( int j11 = 0; j11 < i11; ++j11 ) testSize *= 11;
3859  if ( testSize > bestSize ) continue;
3860  if ( testSize >= minSize ) bestSize = testSize;
3861  } } } } }
3862 #ifdef TEST_PME_GRID
3863  iout << minSize << " " << bestSize << "\n" << endi;
3864 #else
3865  if ( ! *gridSize ) { // set it
3866  *gridSize = bestSize;
3867  }
3868  if ( *gridSize * PMEGridSpacing < cellLength ) {
3869  char errmsg[512];
3870  sprintf(errmsg, "PMEGridSize%s %d is too small for cell length %f and PMEGridSpacing %f\n",
3871  direction, *gridSize, cellLength, PMEGridSpacing);
3872  NAMD_die(errmsg);
3873  }
3874 #endif
3875  }
3876  if ( PMEGridSizeX < 5 ) {
3877  NAMD_die("PMEGridSizeX (number of grid points) is very small.");
3878  }
3879  if ( PMEGridSizeY < 5 ) {
3880  NAMD_die("PMEGridSizeY (number of grid points) is very small.");
3881  }
3882  if ( PMEGridSizeZ < 5 ) {
3883  NAMD_die("PMEGridSizeZ (number of grid points) is very small.");
3884  }
3885  BigReal tolerance = PMETolerance;
3886  BigReal ewaldcof = 1.0;
3887  while ( erfc(ewaldcof*cutoff)/cutoff >= tolerance ) ewaldcof *= 2.0;
3888  BigReal ewaldcof_lo = 0.;
3889  BigReal ewaldcof_hi = ewaldcof;
3890  for ( int i = 0; i < 100; ++i ) {
3891  ewaldcof = 0.5 * ( ewaldcof_lo + ewaldcof_hi );
3892  if ( erfc(ewaldcof*cutoff)/cutoff >= tolerance ) {
3893  ewaldcof_lo = ewaldcof;
3894  } else {
3895  ewaldcof_hi = ewaldcof;
3896  }
3897  }
3898  PMEEwaldCoefficient = ewaldcof;
3899 
3900 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
3901  bool one_device_per_node = deviceCUDA->one_device_per_node(); // only checks node 0
3902  if ( ! opts.defined("PMEOffload") ) {
3903  PMEOffload = ( (PMEInterpOrder > 4) && one_device_per_node );
3904  if ( PMEOffload ) iout << iINFO << "Enabling PMEOffload because PMEInterpOrder > 4.\n" << endi;
3905  } else if ( PMEOffload && ! one_device_per_node ) {
3906  PMEOffload = 0;
3907  iout << iWARN << "Disabling PMEOffload because multiple CUDA devices per process are not supported.\n" << endi;
3908  }
3909  if ( usePMECUDA && ! ( useCUDA2 || one_device_per_node ) ) {
3910  usePMECUDA = 0;
3911  iout << iWARN << "Disabling usePMECUDA because multiple CUDA devices per process requires useCUDA2.\n" << endi;
3912  }
3913 #else
3914  PMEOffload = 0;
3915 #endif
3916  } else { // initialize anyway
3917  useDPME = 0;
3918  PMEGridSizeX = 0;
3919  PMEGridSizeY = 0;
3920  PMEGridSizeZ = 0;
3921  PMEGridSpacing = 1000.;
3922  PMEEwaldCoefficient = 0;
3923  PMEOffload = 0;
3924  }
3925 
3926  // Take care of initializing FMA values to something if FMA is not
3927  // active
3928  if (!FMAOn)
3929  {
3930  FMALevels = 0;
3931  FMAMp = 0;
3932  FMAFFTOn = FALSE;
3933  FMAFFTBlock = 0;
3934  }
3935  else
3936  {
3937  // idiot checking: frm bug reported by Tom Bishop.
3938  // DPMTA requires: (#terms in fma)/(fft blocking factor) = integer.
3939  if (FMAFFTBlock != 4)
3940  NAMD_die("FMAFFTBlock: Block length must be 4 for short FFT's");
3941  if (FMAMp % FMAFFTBlock != 0)
3942  NAMD_die("FMAMp: multipole term must be multiple of block length (FMAFFTBlock)");
3943  }
3944 
3945  if ( (nonbondedFrequency > stepsPerCycle) || ( (stepsPerCycle % nonbondedFrequency) != 0) )
3946  {
3947  NAMD_die("stepsPerCycle must be a multiple of nonbondedFreq");
3948  }
3949 
3950  if (!LCPOOn && !GBISOn && !GBISserOn && !FMAOn && !PMEOn && !MSMOn && !fullDirectOn && !FMMOn)
3951  {
3952  fullElectFrequency = 0;
3953  }
3954  else
3955  {
3956  if (!opts.defined("fullElectFrequency"))
3957  {
3958  if (opts.defined("fmaFrequency")) {
3959  iout << iWARN << "The parameter fmaFrequency has been renamed fullElectFrequency.\n" << endi;
3960  fullElectFrequency = fmaFrequency;
3961  } else {
3962  iout << iWARN << "The parameter fullElectFrequency now defaults to nonbondedFreq (" << nonbondedFrequency << ") rather than stepsPerCycle.\n" << endi;
3963  fullElectFrequency = nonbondedFrequency;
3964  }
3965  }
3966  else
3967  {
3968  if (opts.defined("fmaFrequency")) {
3969  iout << iWARN << "Ignoring redundant parameter fmaFrequency in favor of fullElectFrequency.\n" << endi;
3970  }
3971  if ( (fullElectFrequency > stepsPerCycle) || ( (stepsPerCycle % fullElectFrequency) != 0) )
3972  {
3973  NAMD_die("stepsPerCycle must be a multiple of fullElectFrequency");
3974  }
3975  }
3976 
3977  if ( (nonbondedFrequency > fullElectFrequency) || ( (fullElectFrequency % nonbondedFrequency) != 0) )
3978  {
3979  NAMD_die("fullElectFrequency must be a multiple of nonbondedFreq");
3980  }
3981 
3982  if (singleTopology && fullElectFrequency > 1) NAMD_die("Single topology free energy calculation discourages multiple timesteps to assure accuracy!");
3983  if (singleTopology && alchDecouple) NAMD_die("Single topology free energy calculation can NOT work with alchDecouple on");
3984 
3985  if (multigratorOn) {
3986  if ( (multigratorTemperatureFreq > multigratorPressureFreq) || ( (multigratorPressureFreq % multigratorTemperatureFreq) != 0) )
3987  {
3988  NAMD_die("multigratorTemperatureFreq must be a multiple of multigratorPressureFreq");
3989  }
3990  if ( (fullElectFrequency > multigratorTemperatureFreq) || ( (multigratorTemperatureFreq % fullElectFrequency) != 0) )
3991  {
3992  NAMD_die("fullElectFrequency must be a multiple of multigratorTemperatureFreq");
3993  }
3994  if (multigratorNoseHooverChainLength <= 2) {
3995  NAMD_die("multigratorNoseHooverChainLength must be greater than 2");
3996  }
3997  }
3998 
3999  if (!opts.defined("fmaTheta"))
4000  fmaTheta=0.715; /* Suggested by Duke developers */
4001  }
4002 
4003  if ( lesOn && ( FMAOn || useDPME || fullDirectOn ) ) {
4004  NAMD_die("Sorry, LES is only implemented for PME full electrostatics.");
4005  }
4006  if ( alchFepOn && ( FMAOn || useDPME || fullDirectOn ) ) {
4007  NAMD_die("Sorry, FEP is only implemented for PME full electrostatics.");
4008  }
4009  if ( alchThermIntOn && ( FMAOn || useDPME || fullDirectOn ) ) {
4010  NAMD_die("Sorry, TI is only implemented for PME full electrostatics.");
4011  }
4012  if ( pairInteractionOn && FMAOn ) {
4013  NAMD_die("Sorry, pairInteraction not implemented for FMA.");
4014  }
4015  if ( pairInteractionOn && useDPME ) {
4016  NAMD_die("Sorry, pairInteraction not implemented for DPME.");
4017  }
4018  if ( pairInteractionOn && fullDirectOn ) {
4019  NAMD_die("Sorry, pairInteraction not implemented for full direct electrostatics.");
4020  }
4021  if ( ! pairInteractionOn ) {
4022  pairInteractionSelf = 0;
4023  }
4024  if ( pairInteractionOn && !pairInteractionSelf && !config->find("pairInteractionGroup2"))
4025  NAMD_die("pairInteractionGroup2 must be specified");
4026 
4027  if ( ! fixedAtomsOn ) {
4028  fixedAtomsForces = 0;
4029  }
4030 
4031  if ( gridforceOn || mgridforceOn ) {
4032  parse_mgrid_params(config);
4033  }
4034 
4035  if ( extraBondsOn ) {
4036  extraBondsCosAnglesSetByUser = ! ! config->find("extraBondsCosAngles");
4037  } else {
4038  extraBondsCosAnglesSetByUser = false;
4039  }
4040 
4041  if (!opts.defined("constraints"))
4042  {
4043  constraintExp = 0;
4044  constraintScaling = 1.0;
4045 
4046  //****** BEGIN selective restraints (X,Y,Z) changes
4047  selectConstraintsOn = FALSE;
4048  //****** END selective restraints (X,Y,Z) changes
4049 
4050  //****** BEGIN moving constraints changes
4051  movingConstraintsOn = FALSE;
4052  //****** END moving constraints changes
4053  //****** BEGIN rotating constraints changes
4054  rotConstraintsOn = FALSE;
4055  //****** END rotating constraints changes
4056  }
4057  //****** BEGIN rotating constraints changes
4058  else {
4059  if (rotConstraintsOn) {
4060  rotConsAxis = rotConsAxis.unit();
4061  }
4062  }
4063  if(opts.defined("rotConstraints")
4064  && opts.defined("movingConstraints")) {
4065  NAMD_die("Rotating and moving constraints are mutually exclusive!");
4066  }
4067  //****** END rotating constraints changes
4068 
4069  //****** BEGIN selective restraints (X,Y,Z) changes
4070  if(opts.defined("selectConstraints") && !opts.defined("selectConstrX")
4071  && !opts.defined("selectConstrY") && !opts.defined("selectConstrZ")) {
4072  NAMD_die("selectConstraints was specified, but no Cartesian components were defined!");
4073  }
4074  if (!opts.defined("selectConstraints")) {
4075  constrXOn = FALSE;
4076  constrYOn = FALSE;
4077  constrZOn = FALSE;
4078  }
4079  //****** END selective restraints (X,Y,Z) changes
4080 
4081 
4082  //****** BEGIN SMD constraints changes
4083 
4084  if (!opts.defined("SMD")) {
4085  SMDOn = FALSE;
4086  }
4087 
4088  if (SMDOn) {
4089  // normalize direction
4090  if (SMDDir.length2() == 0) {
4091  NAMD_die("SMD direction vector must be non-zero");
4092  }
4093  else {
4094  SMDDir = SMDDir.unit();
4095  }
4096 
4097  if (SMDOutputFreq > 0 && SMDOutputFreq < stepsPerCycle
4098  || SMDOutputFreq % stepsPerCycle != 0) {
4099  NAMD_die("SMDOutputFreq must be a multiple of stepsPerCycle");
4100  }
4101  }
4102 
4103  //****** END SMD constraints changes
4104 
4105  if (!sphericalBCOn)
4106  {
4107  sphericalBCr1 = 0.0;
4108  sphericalBCk1 = 0.0;
4109  sphericalBCexp1 = 0;
4110  sphericalBCr2 = 0.0;
4111  sphericalBCk2 = 0.0;
4112  sphericalBCexp2 = 0;
4113  }
4114  else if (!opts.defined("sphericalBCr2"))
4115  {
4116  sphericalBCr2 = -1.0;
4117  sphericalBCk2 = 0.0;
4118  sphericalBCexp2 = 0;
4119  }
4120 
4121  if (!cylindricalBCOn)
4122  {
4123  cylindricalBCr1 = 0.0;
4124  cylindricalBCk1 = 0.0;
4125  cylindricalBCexp1 = 0;
4126  cylindricalBCr2 = 0.0;
4127  cylindricalBCk2 = 0.0;
4128  cylindricalBCexp2 = 0;
4129  cylindricalBCl1 = 0.0;
4130  cylindricalBCl2 = 0.0;
4131  }
4132  else if (!opts.defined("cylindricalBCr2"))
4133  {
4134  cylindricalBCr2 = -1.0;
4135  cylindricalBCk2 = 0.0;
4136  cylindricalBCexp2 = 0;
4137  cylindricalBCl2 = 0.0;
4138  }
4139 
4140  if (!eFieldOn)
4141  {
4142  eField.x = 0.0;
4143  eField.y = 0.0;
4144  eField.z = 0.0;
4145  eFieldFreq = 0.0;
4146  eFieldPhase = 0.0;
4147  }
4148  else
4149  {
4150  if (!opts.defined("eFieldFreq")) eFieldFreq = 0.0;
4151  if (!opts.defined("eFieldPhase")) eFieldPhase = 0.0;
4152  }
4153 
4154  if (!stirOn)
4155  {
4156  stirFilename[0] = STRINGNULL;
4157  stirStartingTheta = 0.0;
4158  stirVel = 0.0;
4159  stirK = 0.0;
4160  stirAxis.x = 0.0;
4161  stirAxis.y = 0.0;
4162  stirAxis.z = 0.0;
4163  stirPivot.x = 0.0;
4164  stirPivot.y = 0.0;
4165  stirPivot.z = 0.0;
4166  }
4167 
4168  if (!opts.defined("langevin"))
4169  {
4170  langevinTemp = 0.0;
4171  }
4172 
4173  // BEGIN LA
4174  if (!opts.defined("loweAndersen"))
4175  {
4176  loweAndersenTemp = 0.0;
4177  }
4178  // END LA
4179 
4180  if (!opts.defined("tcouple"))
4181  {
4182  tCoupleTemp = 0.0;
4183  }
4184 
4185  if (HydrogenBonds)
4186  {
4187  if (daCutoffDist > pairlistDist)
4188  NAMD_die("Hydrogen bond cutoff distance must be <= pairlist distance");
4189  }
4190 
4191  // If we're doing pair interaction, set
4192  // outputEnergies to 1 to make NAMD not die (the other nonbonded code paths
4193  // aren't defined when these options are enabled), and set nonbondedFreq to
4194  // 1 to avoid getting erroneous output. Warn the user of what we're doing.
4195  if (pairInteractionOn) {
4196  if (outputEnergies != 1) {
4197  iout << iWARN << "Setting outputEnergies to 1 due to\n";
4198  iout << iWARN << "pairInteraction calculations\n" << endi;
4199  outputEnergies = 1;
4200  }
4201  }
4202  if (pairInteractionOn || pressureProfileOn) {
4203  if (nonbondedFrequency != 1) {
4204  iout << iWARN << "Setting nonbondedFreq to 1 due to\n";
4205  iout << iWARN << "pairInteraction or pressure profile calculations\n" << endi;
4206  }
4207  }
4208 
4209  // print timing at a reasonable interval by default
4210  if (!opts.defined("outputTiming"))
4211  {
4212  outputTiming = firstLdbStep;
4213  int ot2 = 10 * outputEnergies;
4214  if ( outputTiming < ot2 ) outputTiming = ot2;
4215  }
4216 
4217  // Checks if a secondary process was added in the configuration, and sets
4218  // the appropriated variable
4219  if(qmForcesOn){
4220 
4221  if (opts.defined("QMSecProc")){
4222  qmSecProcOn = true;
4223  }
4224  else {
4225  qmSecProcOn = false;
4226  }
4227 
4228  if (opts.defined("qmPrepProc")){
4229  qmPrepProcOn = true;
4230  }
4231  else {
4232  qmPrepProcOn = false;
4233  }
4234 
4235  if (opts.defined("QMParamPDB")){
4236  qmParamPDBDefined = true;
4237  }
4238  else {
4239  qmParamPDBDefined = false;
4240  }
4241 
4242  if (opts.defined("QMBondColumn")){
4243  qmBondOn = true;
4244  }
4245  else {
4246  qmBondOn = false;
4247  }
4248 
4249  if ( strcasecmp(qmSoftware,"orca") != 0 &&
4250  strcasecmp(qmSoftware,"mopac") != 0 &&
4251  strcasecmp(qmSoftware,"custom") != 0 ) {
4252  NAMD_die("Available QM software options are \'mopac\', \'orca\', or \'custom\'.");
4253  }
4254  else {
4255  if ( strcasecmp(qmSoftware,"orca") == 0 )
4256  qmFormat = QMFormatORCA;
4257  if ( strcasecmp(qmSoftware,"mopac") == 0 )
4258  qmFormat = QMFormatMOPAC;
4259  if ( strcasecmp(qmSoftware,"custom") == 0 )
4260  qmFormat = QMFormatUSR;
4261 
4262  if (qmFormat == QMFormatORCA || qmFormat == QMFormatMOPAC) {
4263 
4264  if (! opts.defined("QMConfigLine"))
4265  NAMD_die("If the selected QM software is \'mopac\' or \'orca\'\
4266 , QMConfigLine needs to be defined.");
4267 
4268  }
4269  }
4270 
4271  qmChrgMode = QMCHRGMULLIKEN;
4272  if (opts.defined("QMChargeMode")) {
4273  if ( strcasecmp(qmChrgModeS,"none") != 0 &&
4274  strcasecmp(qmChrgModeS,"mulliken") != 0 &&
4275  strcasecmp(qmChrgModeS,"chelpg") != 0) {
4276  NAMD_die("Available charge options are \'none\', \'mulliken\' or \'chelpg\'.");
4277  }
4278  else {
4279  if ( strcasecmp(qmChrgModeS,"none") == 0 )
4280  qmChrgMode = QMCHRGNONE;
4281  if ( strcasecmp(qmChrgModeS,"mulliken") == 0 )
4282  qmChrgMode = QMCHRGMULLIKEN;
4283  if ( strcasecmp(qmChrgModeS,"chelpg") == 0 )
4284  qmChrgMode = QMCHRGCHELPG;
4285  }
4286  }
4287 
4288  if (qmFormat == QMFormatMOPAC && qmChrgMode == QMCHRGCHELPG)
4289  NAMD_die("Available charge options for MOPAC are \'none\' and \'mulliken\'.");
4290 
4291  if (qmFormat == QMFormatUSR && qmChrgMode == QMCHRGCHELPG)
4292  NAMD_die("Available charge options for MOPAC are \'none\' and \'mulliken\'.");
4293 
4294  if (qmBondOn && (opts.defined("QMBondValueType"))) {
4295  if ( strcasecmp(qmBondValueTypeS,"len") != 0 &&
4296  strcasecmp(qmBondValueTypeS,"ratio") != 0 ) {
4297  NAMD_die("Available QM bond value type options are \'len\' or \'ratio\'.");
4298  }
4299  else {
4300  // #define QMLENTYPE 1
4301  // #define QMRATIOTYPE 2
4302  if ( strcasecmp(qmBondValueTypeS,"len") == 0 )
4303  qmBondValType = 1;
4304  if ( strcasecmp(qmBondValueTypeS,"ratio") == 0 )
4305  qmBondValType = 2;
4306  }
4307  }
4308  else if (qmBondOn && ! (opts.defined("QMBondValueType")))
4309  qmBondValType = 1;
4310 
4311  if ( strcmp(qmColumn,"beta") != 0 &&
4312  strcmp(qmColumn,"occ") != 0 ) {
4313  NAMD_die("Available column options are \'beta\' and \'occ\'.");
4314  }
4315 
4316  if (qmBondOn) {
4317  if ( strcmp(qmBondColumn,"beta") != 0 &&
4318  strcmp(qmBondColumn,"occ") != 0 ) {
4319  NAMD_die("Available column options are \'beta\' and \'occ\'.");
4320  }
4321 
4322  if (strcmp(qmBondColumn,qmColumn) == 0)
4323  NAMD_die("QM column and bond-column must be different!");
4324  }
4325 
4326  qmBondScheme = 1;
4327  if (opts.defined("QMBondScheme")) {
4328  if ( strcasecmp(qmBondSchemeS,"CS") == 0 )
4329  qmBondScheme = QMSCHEMECS;
4330  if ( strcasecmp(qmBondSchemeS,"RCD") == 0 )
4331  qmBondScheme = QMSCHEMERCD;
4332  if ( strcasecmp(qmBondSchemeS,"Z1") == 0 )
4333  qmBondScheme = QMSCHEMEZ1;
4334  if ( strcasecmp(qmBondSchemeS,"Z2") == 0 )
4335  qmBondScheme = QMSCHEMEZ2;
4336  if ( strcasecmp(qmBondSchemeS,"Z3") == 0 )
4337  qmBondScheme = QMSCHEMEZ3;
4338  }
4339 
4340 // #define QMPCSCHEMENONE 1
4341 // #define QMPCSCHEMEROUND 2
4342 // #define QMPCSCHEMEZERO 3
4343  qmPCScheme = 1;
4344  if (opts.defined("QMPointChargeScheme") && qmPCSwitchOn) {
4345  if ( strcasecmp(qmPCSchemeS,"none") == 0 )
4346  qmPCScheme = 1;
4347 
4348  if ( strcasecmp(qmPCSchemeS,"round") == 0 )
4349  qmPCScheme = 2;
4350  if ( strcasecmp(qmPCSchemeS,"zero") == 0 )
4351  qmPCScheme = 3;
4352 
4353  if ( qmPCScheme > 1 && ! qmPCSwitchOn)
4354  NAMD_die("QM Charge Schemes \'round\' or \'zero\' can only be applied with QMswitching set to \'on\'!");
4355  }
4356 
4357  // Redundant option to deprecate "qmNoPC" option.
4358  if (qmElecEmbed)
4359  qmNoPC = FALSE;
4360 
4361 // #define QMLSSMODEDIST 1
4362 // #define QMLSSMODECOM 2
4363  if (qmLSSOn) {
4364 
4365  if (qmNoPC)
4366  NAMD_die("QM Live Solvent Selection cannot be done with QMNoPntChrg set to \'on\'!") ;
4367 
4368  if (rigidBonds != RIGID_NONE)
4369  NAMD_die("QM Live Solvent Selection cannot be done with fixed bonds!") ;
4370 
4371  if (qmLSSFreq % qmPCSelFreq != 0)
4372  NAMD_die("Frequency of QM solvent update must be a multiple of frequency of point charge selection.");
4373 
4374  if (qmLSSFreq % stepsPerCycle != 0)
4375  NAMD_die("Frequency of QM solvent update must be a multiple of steps per cycle.");
4376 
4377  if (opts.defined("QMLSSMode") ) {
4378  if ( strcasecmp(qmLSSModeS,"dist") != 0 &&
4379  strcasecmp(qmLSSModeS,"COM") != 0 ) {
4380  NAMD_die("Available LSS mode options are \'dist\' and \'COM\'.");
4381  }
4382  if ( strcasecmp(qmLSSModeS,"dist") == 0 )
4383  qmLSSMode = 1;
4384  else if ( strcasecmp(qmLSSModeS,"COM") == 0 )
4385  qmLSSMode = 2;
4386  }
4387  else
4388  qmLSSMode = 1;
4389  }
4390 
4391 // #define QMPCSCALESHIFT 1
4392 // #define QMPCSCALESWITCH 2
4393  if (qmPCSwitchOn) {
4394 
4395  if (opts.defined("QMSwitchingType") ) {
4396  if ( strcasecmp(qmPCSwitchTypeS,"shift") != 0 &&
4397  strcasecmp(qmPCSwitchTypeS,"switch") != 0 ) {
4398  NAMD_die("Available scaling options are \'shift\' and \'switch\'.");
4399  }
4400  if ( strcasecmp(qmPCSwitchTypeS,"shift") == 0 )
4401  qmPCSwitchType = 1;
4402  else if ( strcasecmp(qmPCSwitchTypeS,"switch") == 0 )
4403  qmPCSwitchType = 2;
4404  }
4405  else
4406  qmPCSwitchType = 1;
4407  }
4408 
4409  if (qmNoPC && qmPCSelFreq > 1) {
4410  iout << iWARN << "QMPCStride being IGNORED since QMNoPntChrg is set to \'on\'!\n" << endi;
4411  qmPCSelFreq = 1;
4412  }
4413 
4414  if (qmNoPC && qmPCSwitchOn)
4415  NAMD_die("QM PC switching can only be applied with QMNoPntChrg set to \'off\'!");
4416 
4417 // if (qmNoPC && qmBondOn)
4418 // NAMD_die("QM-MM bonds can only be applied with QMNoPntChrg set to \'off\'!");
4419 
4420  if (qmPCSelFreq <= 0)
4421  NAMD_die("QMPCFreq can only be a positive number! For static point charge selection, see QMCutomPC.");
4422 
4423  if (qmCustomPCSel && qmNoPC)
4424  NAMD_die("QM Custom PC Selection is incompatible with QMNoPntChrg!");
4425 
4426 // if (qmCustomPCSel && qmPCSwitchOn)
4427 // NAMD_die("QM Custom PC Selection is incompatible with QMSwitching!");
4428 
4429  if (qmCustomPCSel && qmPCSelFreq > 1)
4430  NAMD_die("QM Custom PC Selection is incompatible with QMPCStride > 1!");
4431 
4432  if (qmCSMD && (! opts.defined("QMCSMDFile") ))
4433  NAMD_die("QM Conditional SMD is ON, but no CSMD configuration file was profided!");
4434  }
4435 
4436 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
4437  // Disable various CUDA kernels if they do not fully support
4438  // or are otherwise incompatible with simulation options.
4439  if ( useCUDAdisable ) {
4440  if ( drudeOn && useCUDA2 && (bondedCUDA & 0x0001) ) {
4441  // disable CUDA kernels for spring bonds
4442  bondedCUDA &= ~0x0001;
4443  iout << iWARN << "Disabling CUDA kernel for bonds due to incompatibility with Drude oscillators.\n";
4444  }
4445  if ( accelMDOn && (accelMDdihe || accelMDdual) && useCUDA2 && (bondedCUDA & (0x0004 | 0x0020)) ) {
4446  // disable CUDA kernels for dihedrals and crossterms
4447  bondedCUDA &= ~(0x0004 | 0x0020);
4448  iout << iWARN << "Disabling CUDA kernels for dihedrals and crossterms due to incompatibility with accelerated MD options.\n";
4449  }
4450  }
4451 #endif
4452 
4453 #ifdef NAMD_AVXTILES
4454  if (avxTilesCommandLineDisable) useAVXTiles = FALSE;
4455  if (useAVXTiles) {
4456  if (alchOn || lesOn || tabulatedEnergies || drudeOn || goForcesOn ||
4457  pressureProfileOn || qmForcesOn) {
4458  useAVXTiles = FALSE;
4459  iout << iWARN << "Disabling AVX tiles optimizations due to "
4460  << "incompatible simulation params.\n";
4461  }
4462  }
4463 #else
4464  useAVXTiles = FALSE;
4465 #endif
4466 
4467 } // check_config()
4468 
4469 
4470 void SimParameters::print_config(ParseOptions &opts, ConfigList *config, char *&cwd) {
4471 
4472  StringList *current; // Pointer to config option list
4473 
4474  // Now that we have read everything, print it out so that
4475  // the user knows what is going on
4476  iout << iINFO << "SIMULATION PARAMETERS:\n";
4477  iout << iINFO << "TIMESTEP " << dt << "\n" << endi;
4478  iout << iINFO << "NUMBER OF STEPS " << N << "\n";
4479  iout << iINFO << "STEPS PER CYCLE " << stepsPerCycle << "\n";
4480  iout << endi;
4481 
4482  if ( lattice.a_p() || lattice.b_p() || lattice.c_p() ) {
4483  if ( lattice.a_p() )
4484  iout << iINFO << "PERIODIC CELL BASIS 1 " << lattice.a() << "\n";
4485  if ( lattice.b_p() )
4486  iout << iINFO << "PERIODIC CELL BASIS 2 " << lattice.b() << "\n";
4487  if ( lattice.c_p() )
4488  iout << iINFO << "PERIODIC CELL BASIS 3 " << lattice.c() << "\n";
4489  iout << iINFO << "PERIODIC CELL CENTER " << lattice.origin() << "\n";
4490  if (wrapWater) {
4491  iout << iINFO << "WRAPPING WATERS AROUND PERIODIC BOUNDARIES ON OUTPUT.\n";
4492  }
4493  if (wrapAll) {
4494  iout << iINFO << "WRAPPING ALL CLUSTERS AROUND PERIODIC BOUNDARIES ON OUTPUT.\n";
4495  }
4496  if (wrapNearest) {
4497  iout << iINFO << "WRAPPING TO IMAGE NEAREST TO PERIODIC CELL CENTER.\n";
4498  }
4499  iout << endi;
4500  }
4501 
4502  if ( CkNumPes() > 512 ) ldbUnloadOne = TRUE;
4503  if ( ldbUnloadOne || CkNumPes() > 128 ) ldbUnloadZero = TRUE;
4504 
4505  if (ldBalancer == LDBAL_NONE) {
4506  iout << iINFO << "LOAD BALANCER None\n" << endi;
4507  } else {
4508  if (ldBalancer == LDBAL_CENTRALIZED) {
4509  iout << iINFO << "LOAD BALANCER Centralized\n" << endi;
4510  } else if (ldBalancer == LDBAL_HYBRID) {
4511  iout << iINFO << "LOAD BALANCER Hybrid\n" << endi;
4512  }
4513 
4514  if (ldbStrategy == LDBSTRAT_DEFAULT) {
4515  iout << iINFO << "LOAD BALANCING STRATEGY New Load Balancers -- DEFAULT\n";
4516  } else if (ldbStrategy == LDBSTRAT_REFINEONLY) {
4517  iout << iINFO << "LOAD BALANCING STRATEGY Refinement Only\n";
4518  } else if (ldbStrategy == LDBSTRAT_COMPREHENSIVE) {
4519  iout << iINFO << "LOAD BALANCING STRATEGY Comprehensive\n";
4520  } else if (ldbStrategy == LDBSTRAT_OLD) {
4521  iout << iINFO << "LOAD BALANCING STRATEGY Old Load Balancers\n";
4522  }
4523 
4524  iout << iINFO << "LDB PERIOD " << ldbPeriod << " steps\n";
4525  iout << iINFO << "FIRST LDB TIMESTEP " << firstLdbStep << "\n";
4526  if (ldBalancer == LDBAL_HYBRID)
4527  iout << iINFO << "HYBRIDLB GROUP SIZE " << hybridGroupSize << "\n";
4528  iout << iINFO << "LAST LDB TIMESTEP " << lastLdbStep << "\n";
4529  if ( ldbRelativeGrainsize > 0. )
4530  iout << iINFO << "LDB RELATIVE GRAINSIZE " << ldbRelativeGrainsize << "\n";
4531  iout << iINFO << "LDB BACKGROUND SCALING " << ldbBackgroundScaling << "\n";
4532  iout << iINFO << "HOM BACKGROUND SCALING " << ldbHomeBackgroundScaling << "\n";
4533  if ( PMEOn ) {
4534  iout << iINFO << "PME BACKGROUND SCALING "
4535  << ldbPMEBackgroundScaling << "\n";
4536  if ( ldbUnloadPME )
4537  iout << iINFO << "REMOVING LOAD FROM PME NODES" << "\n";
4538  }
4539  if ( ldbUnloadZero ) iout << iINFO << "REMOVING LOAD FROM NODE 0\n";
4540  if ( ldbUnloadOne ) iout << iINFO << "REMOVING LOAD FROM NODE 1\n";
4541  if ( ldbUnloadOutputPEs ) iout << iINFO << "REMOVING LOAD FROM OUTPUT PES\n";
4542  iout << endi;
4543  }
4544 
4545  if ( ldbUnloadOne || CkNumPes() > 256 ) noPatchesOnOne = TRUE;
4546  if ( ldbUnloadZero || noPatchesOnOne ||
4547  CkNumPes() > 64 || ( IMDon && CkNumPes() > 8 ) ) {
4548  noPatchesOnZero = TRUE;
4549  }
4550  if ( noPatchesOnZero ) iout << iINFO << "REMOVING PATCHES FROM PROCESSOR 0\n";
4551  if ( noPatchesOnOne ) iout << iINFO << "REMOVING PATCHES FROM PROCESSOR 1\n";
4552  iout << endi;
4553 
4554 #if defined(NAMD_CUDA) || defined(NAMD_HIP) || defined(NAMD_MIC)
4555  maxSelfPart = maxPairPart = 1;
4556 #endif
4557 
4558  if (ldBalancer == LDBAL_HYBRID) {
4559  iout << iINFO << "MAX SELF PARTITIONS " << maxSelfPart << "\n"
4560  << iINFO << "MAX PAIR PARTITIONS " << maxPairPart << "\n"
4561  << iINFO << "SELF PARTITION ATOMS " << numAtomsSelf << "\n"
4562  << iINFO << "SELF2 PARTITION ATOMS " << numAtomsSelf2 << "\n"
4563  << iINFO << "PAIR PARTITION ATOMS " << numAtomsPair << "\n"
4564  << iINFO << "PAIR2 PARTITION ATOMS " << numAtomsPair2 << "\n";
4565  }
4566  iout << iINFO << "MIN ATOMS PER PATCH " << minAtomsPerPatch << "\n"
4567  << iINFO << "EMPTY PATCH LOAD " << emptyPatchLoad << " ATOMS\n"
4568  << endi;
4569 
4570  if (initialTemp < 0)
4571  {
4572  current = config->find("velocities");
4573 
4574  if (current == NULL)
4575  {
4576  current = config->find("binvelocities");
4577  }
4578 
4579  iout << iINFO << "VELOCITY FILE " << current->data << "\n";
4580  }
4581  else
4582  {
4583  iout << iINFO << "INITIAL TEMPERATURE "
4584  << initialTemp << "\n";
4585  }
4586  iout << endi;
4587 
4588  iout << iINFO << "CENTER OF MASS MOVING INITIALLY? ";
4589 
4590  if (comMove)
4591  {
4592  iout << "YES\n";
4593  }
4594  else
4595  {
4596  iout << "NO\n";
4597  }
4598  iout << endi;
4599 
4600  if ( zeroMomentum ) {
4601  iout << iINFO << "REMOVING CENTER OF MASS DRIFT DURING SIMULATION";
4602  if ( zeroMomentumAlt ) iout << " (ALT METHOD)";
4603  iout << "\n" << endi;
4604  }
4605 
4606  iout << iINFO << "DIELECTRIC "
4607  << dielectric << "\n";
4608 
4609  if ( nonbondedScaling != 1.0 )
4610  {
4611  iout << iINFO << "NONBONDED SCALING " << nonbondedScaling << "\n" << endi;
4612  }
4613  iout << iINFO << "EXCLUDE ";
4614 
4615  switch (exclude)
4616  {
4617  case NONE:
4618  iout << "NONE\n";
4619  break;
4620  case ONETWO:
4621  iout << "ONETWO\n";
4622  break;
4623  case ONETHREE:
4624  iout << "ONETHREE\n";
4625  break;
4626  case ONEFOUR:
4627  iout << "ONE-FOUR\n";
4628  break;
4629  default:
4630  iout << "SCALED ONE-FOUR\n";
4631  break;
4632  }
4633  iout << endi;
4634 
4635  if (exclude == SCALED14)
4636  {
4637  iout << iINFO << "1-4 ELECTROSTATICS SCALED BY " << scale14 << "\n";
4638  iout << iINFO << "MODIFIED 1-4 VDW PARAMETERS WILL BE USED\n" << endi;
4639  } else {
4640  iout << iWARN << "MODIFIED 1-4 VDW PARAMETERS WILL BE IGNORED\n" << endi;
4641  }
4642 
4643 #ifdef SPEC_DISABLED_VERSION
4644  if (dcdFrequency > 0) {
4645  dcdFrequency = 0;
4646  iout << iWARN << "DCD TRAJECTORY OUTPUT IS DISABLED IN SPEC RELEASE\n";
4647  }
4648 #endif
4649 
4650  if (dcdFrequency > 0)
4651  {
4652  iout << iINFO << "DCD FILENAME "
4653  << dcdFilename << "\n";
4654  iout << iINFO << "DCD FREQUENCY "
4655  << dcdFrequency << "\n";
4656  iout << iINFO << "DCD FIRST STEP "
4657  << ( ((firstTimestep + dcdFrequency)/dcdFrequency)*dcdFrequency ) << "\n";
4658  if ( dcdUnitCell ) {
4659  iout << iINFO << "DCD FILE WILL CONTAIN UNIT CELL DATA\n";
4660  }
4661  }
4662  else
4663  {
4664  iout << iINFO << "NO DCD TRAJECTORY OUTPUT\n";
4665  }
4666  iout << endi;
4667 
4668  if (xstFrequency > 0)
4669  {
4670  iout << iINFO << "XST FILENAME "
4671  << xstFilename << "\n";
4672  iout << iINFO << "XST FREQUENCY "
4673  << xstFrequency << "\n";
4674  }
4675  else
4676  {
4677  iout << iINFO << "NO EXTENDED SYSTEM TRAJECTORY OUTPUT\n";
4678  }
4679  iout << endi;
4680 
4681  if (velDcdFrequency > 0)
4682  {
4683  iout << iINFO << "VELOCITY DCD FILENAME "
4684  << velDcdFilename << "\n";
4685  iout << iINFO << "VELOCITY DCD FREQUENCY "
4686  << velDcdFrequency << "\n";
4687  iout << iINFO << "VELOCITY DCD FIRST STEP "
4688  << ( ((firstTimestep + velDcdFrequency)/velDcdFrequency)*velDcdFrequency ) << "\n";
4689  }
4690  else
4691  {
4692  iout << iINFO << "NO VELOCITY DCD OUTPUT\n";
4693  }
4694  iout << endi;
4695 
4696  if (forceDcdFrequency > 0)
4697  {
4698  iout << iINFO << "FORCE DCD FILENAME "
4699  << forceDcdFilename << "\n";
4700  iout << iINFO << "FORCE DCD FREQUENCY "
4701  << forceDcdFrequency << "\n";
4702  iout << iINFO << "FORCE DCD FIRST STEP "
4703  << ( ((firstTimestep + forceDcdFrequency)/forceDcdFrequency)*forceDcdFrequency ) << "\n";
4704  }
4705  else
4706  {
4707  iout << iINFO << "NO FORCE DCD OUTPUT\n";
4708  }
4709  iout << endi;
4710 
4711  iout << iINFO << "OUTPUT FILENAME "
4712  << outputFilename << "\n" << endi;
4713  if (binaryOutput)
4714  {
4715  iout << iINFO << "BINARY OUTPUT FILES WILL BE USED\n" << endi;
4716  }
4717 #ifdef MEM_OPT_VERSION
4718  if(!binaryOutput){
4719  iout << iWARN <<"SINCE MEMORY OPTIMIZED VERSION IS USED, OUTPUT IN TEXT FORMAT IS DISABLED!\n" << endi;
4720  binaryOutput = TRUE;
4721  }
4722 #endif
4723 
4724  if (! restartFrequency)
4725  {
4726  iout << iINFO << "NO RESTART FILE\n";
4727  }
4728  else
4729  {
4730  iout << iINFO << "RESTART FILENAME "
4731  << restartFilename << "\n";
4732  iout << iINFO << "RESTART FREQUENCY "
4733  << restartFrequency << "\n";
4734  if (restartSave) {
4735  iout << iINFO << "RESTART FILES WILL NOT BE OVERWRITTEN\n";
4736  }
4737  if (restartSaveDcd) {
4738  iout << iINFO << "DCD FILE WILL BE SPLIT WHEN RESTART FILES ARE WRITTEN\n";
4739  }
4740 
4741  if (binaryRestart)
4742  {
4743  iout << iINFO << "BINARY RESTART FILES WILL BE USED\n";
4744  }
4745  }
4746  iout << endi;
4747 
4748  if (switchingActive)
4749  {
4750  iout << iINFO << "SWITCHING ACTIVE\n";
4751  if ( vdwForceSwitching ) {
4752  iout << iINFO << "VDW FORCE SWITCHING ACTIVE\n";
4753  }
4754  if ( martiniSwitching ) {
4755  iout << iINFO << "MARTINI RESIDUE-BASED COARSE-GRAIN SWITCHING ACTIVE\n";
4756  }
4757  iout << iINFO << "SWITCHING ON "
4758  << switchingDist << "\n";
4759  iout << iINFO << "SWITCHING OFF "
4760  << cutoff << "\n";
4761  }
4762  else
4763  {
4764  iout << iINFO << "CUTOFF "
4765  << cutoff << "\n";
4766  }
4767 
4768  iout << iINFO << "PAIRLIST DISTANCE " << pairlistDist << "\n";
4769  iout << iINFO << "PAIRLIST SHRINK RATE " << pairlistShrink << "\n";
4770  iout << iINFO << "PAIRLIST GROW RATE " << pairlistGrow << "\n";
4771  iout << iINFO << "PAIRLIST TRIGGER " << pairlistTrigger << "\n";
4772  iout << iINFO << "PAIRLISTS PER CYCLE " << pairlistsPerCycle << "\n";
4773  if ( outputPairlists )
4774  iout << iINFO << "PAIRLIST OUTPUT STEPS " << outputPairlists << "\n";
4775  iout << endi;
4776 
4777  if ( pairlistMinProcs > 1 )
4778  iout << iINFO << "REQUIRING " << pairlistMinProcs << " PROCESSORS FOR PAIRLISTS\n";
4779  usePairlists = ( CkNumPes() >= pairlistMinProcs );
4780 
4781 #ifdef OPENATOM_VERSION
4782 if ( openatomOn )
4783 {
4784  iout << iINFO << "OPENATOM QM/MM CAR-PARINELLO ACTIVE\n";
4785  iout << iINFO << "OPENATOM CONFIG FILE: " << openatomConfig << "\n";
4786  iout << iINFO << "OPENATOM STRUCT FILE: " << openatomStruct << "\n";
4787  iout << iINFO << "OPENATOM PDB FILE: " << openatomPDB << "\n";
4788 }
4789 #endif // OPENATOM_VERSION
4790 
4791  // FB - FEP and TI are now dependent on pairlists - disallow usePairlists=0
4792  if ( (alchOn) && (!usePairlists)) {
4793  NAMD_die("Sorry, Alchemical simulations require pairlists to be enabled\n");
4794  }
4795 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
4796  if ( ! usePairlists ) {
4797  usePairlists = 1;
4798  iout << iINFO << "CUDA ACCELERATION REQUIRES PAIRLISTS\n";
4799  }
4800 #endif
4801 
4802  iout << iINFO << "PAIRLISTS " << ( usePairlists ? "ENABLED" : "DISABLED" )
4803  << "\n" << endi;
4804 
4805  iout << iINFO << "MARGIN " << margin << "\n";
4806  if ( margin > 4.0 ) {
4807  iout << iWARN << "MARGIN IS UNUSUALLY LARGE AND WILL LOWER PERFORMANCE\n";
4808  BigReal f = patchDimension/(patchDimension-margin);
4809  f *= f*f;
4810  iout << iWARN << "MARGIN INCREASED PATCH VOLUME BY A FACTOR OF " << f << "\n";
4811  }
4812 
4813  if ( splitPatch == SPLIT_PATCH_HYDROGEN ) {
4814  iout << iINFO << "HYDROGEN GROUP CUTOFF " << hgroupCutoff << "\n";
4815  }
4816 
4817  iout << iINFO << "PATCH DIMENSION "
4818  << patchDimension << "\n";
4819 
4820  iout << endi;
4821 
4822  if (outputEnergies != 1)
4823  {
4824  iout << iINFO << "ENERGY OUTPUT STEPS "
4825  << outputEnergies << "\n";
4826  iout << endi;
4827  }
4828 
4829  iout << iINFO << "OUPUT ENERGY PRECISION " << outputEnergiesPrecision << "\n";
4830 
4831  if (mergeCrossterms) {
4832  iout << iINFO << "CROSSTERM ENERGY INCLUDED IN DIHEDRAL\n" << endi;
4833  }
4834 
4835  if (outputMomenta != 0)
4836  {
4837  iout << iINFO << "MOMENTUM OUTPUT STEPS "
4838  << outputMomenta << "\n";
4839  iout << endi;
4840  }
4841 
4842  if (outputTiming != 0)
4843  {
4844  iout << iINFO << "TIMING OUTPUT STEPS "
4845  << outputTiming << "\n";
4846  iout << endi;
4847  }
4848 
4849  if (outputCudaTiming != 0)
4850  {
4851  iout << iINFO << "CUDA TIMING OUTPUT STEPS "
4852  << outputCudaTiming << "\n";
4853  iout << endi;
4854  }
4855 
4856  if (outputPressure != 0)
4857  {
4858  iout << iINFO << "PRESSURE OUTPUT STEPS "
4859  << outputPressure << "\n";
4860  iout << endi;
4861  }
4862 
4863  if (fixedAtomsOn)
4864  {
4865  iout << iINFO << "FIXED ATOMS ACTIVE\n";
4866  if ( fixedAtomsForces )
4867  iout << iINFO << "FORCES BETWEEN FIXED ATOMS ARE CALCULATED\n";
4868  iout << endi;
4869  }
4870 
4871  if (constraintsOn)
4872  {
4873  iout << iINFO << "HARMONIC CONSTRAINTS ACTIVE\n";
4874 
4875  iout << iINFO << "HARMONIC CONS EXP "
4876  << constraintExp << "\n";
4877 
4878  if (constraintScaling != 1.0) {
4879  iout << iINFO << "HARMONIC CONS SCALING "
4880  << constraintScaling << "\n";
4881  }
4882 
4883  //****** BEGIN selective restraints (X,Y,Z) changes
4884 
4885  if (selectConstraintsOn) {
4886  iout << iINFO << "SELECTED CARTESIAN COMPONENTS OF HARMONIC RESTRAINTS ACTIVE\n";
4887 
4888  if (constrXOn)
4889  iout << iINFO << "RESTRAINING X-COMPONENTS OF CARTESIAN COORDINATES!\n";
4890 
4891  if (constrYOn)
4892  iout << iINFO << "RESTRAINING Y-COMPONENTS OF CARTESIAN COORDINATES!\n";
4893 
4894  if (constrZOn)
4895  iout << iINFO << "RESTRAINING Z-COMPONENTS OF CARTESIAN COORDINATES!\n";
4896  }
4897  //****** END selective restraints (X,Y,Z) changes
4898 
4899  if (sphericalConstraintsOn) {
4900  iout << iINFO << "SPHERICAL HARMONIC CONSTRAINTS ACTIVE\n";
4901  iout << iINFO << "RESTRAINING DISTANCE TO " << sphericalConstrCenter <<"\n";
4902  }
4903  iout << endi;
4904 
4905  //****** BEGIN moving constraints changes
4906 
4907  if (movingConstraintsOn) {
4908  iout << iINFO << "MOVING HARMONIC CONSTRAINTS ACTIVE\n";
4909 
4910  iout << iINFO << "MOVING CONSTRAINT VELOCITY "
4911  << movingConsVel << " ANGSTROM/TIMESTEP\n";
4912 
4913  iout << iINFO << "ALL CONSTRAINED ATOMS WILL MOVE\n";
4914  }
4915  //****** END moving constraints changes
4916  iout << endi;
4917 
4918  //****** BEGIN rotating constraints changes
4919 
4920  if (rotConstraintsOn) {
4921  iout << iINFO << "ROTATING HARMONIC CONSTRAINTS ACTIVE\n";
4922 
4923  iout << iINFO << "AXIS OF ROTATION "
4924  << rotConsAxis << "\n";
4925 
4926  iout << iINFO << "PIVOT OF ROTATION "
4927  << rotConsPivot << "\n";
4928 
4929  iout << iINFO << "ROTATING CONSTRAINT VELOCITY "
4930  << rotConsVel << " DEGREES/TIMESTEP\n";
4931  }
4932  iout << endi;
4933  //****** END rotating constraints changes
4934  }
4935 
4936  // moving drag
4937  if (movDragOn) {
4938  iout << iINFO << "MOVING DRAG ACTIVE.\n";
4939 
4940  iout << iINFO << "MOVING DRAG MAIN PDB FILE "
4941  << movDragFile << "\n";
4942 
4943  iout << iINFO << "MOVING DRAG GLOBAL VELOCITY (A/step) "
4944  << movDragGlobVel << "\n";
4945 
4946  iout << iINFO << "MOVING DRAG LINEAR VELOCITY FILE "
4947  << movDragVelFile << "\n";
4948 
4949  iout << endi;
4950  }
4951 
4952  // rotating drag
4953  if (rotDragOn) {
4954  iout << iINFO << "ROTATING DRAG ACTIVE.\n";
4955 
4956  iout << iINFO << "ROTATING DRAG MAIN PDB FILE "
4957  << rotDragFile << "\n";
4958 
4959  iout << iINFO << "ROTATING DRAG AXIS FILE "
4960  << rotDragAxisFile << "\n";
4961 
4962  iout << iINFO << "ROTATING DRAG PIVOT POINT FILE "
4963  << rotDragPivotFile << "\n";
4964 
4965  iout << iINFO << "ROTATING DRAG GLOBAL ANGULAR VELOCITY (deg/step) "
4966  << rotDragGlobVel << "\n";
4967 
4968  iout << iINFO << "ROTATING DRAG ANGULAR VELOCITY FILE "
4969  << rotDragVelFile << "\n";
4970 
4971  iout << endi;
4972  }
4973 
4974 
4975  // "constant" torque
4976  if (consTorqueOn) {
4977  iout << iINFO << "\"CONSTANT\" TORQUE ACTIVE.\n";
4978 
4979  iout << iINFO << "\"CONSTANT\" TORQUE MAIN PDB FILE "
4980  << consTorqueFile << "\n";
4981 
4982  iout << iINFO << "\"CONSTANT\" TORQUE AXIS FILE "
4983  << consTorqueAxisFile << "\n";
4984 
4985  iout << iINFO << "\"CONSTANT\" TORQUE PIVOT POINT FILE "
4986  << consTorquePivotFile << "\n";
4987 
4988  iout << iINFO << "\"CONSTANT\" TORQUE GLOBAL VALUE (Kcal/(mol*A^2)) "
4989  << consTorqueGlobVal << "\n";
4990 
4991  iout << iINFO << "\"CONSTANT\" TORQUE DACTORS FILE "
4992  << consTorqueValFile << "\n";
4993 
4994  iout << endi;
4995  }
4996 
4997  if (mgridforceOn) {
4998  iout << iINFO << "GRID FORCE ACTIVE\n";
4999  iout << iINFO << " Please include this reference in published work using\n";
5000  iout << iINFO << " the Gridforce module of NAMD: David Wells, Volha Abramkina,\n";
5001  iout << iINFO << " and Aleksei Aksimentiev, J. Chem. Phys. 127:125101-10 (2007).\n";
5002  print_mgrid_params();
5003  }
5004 
5005  //****** BEGIN SMD constraints changes
5006 
5007  if (SMDOn) {
5008  iout << iINFO << "SMD ACTIVE\n";
5009 
5010  iout << iINFO << "SMD VELOCITY "
5011  << SMDVel << " ANGSTROM/TIMESTEP\n";
5012 
5013  iout << iINFO << "SMD DIRECTION "
5014  << SMDDir << "\n";
5015 
5016  iout << iINFO << "SMD K "
5017  << SMDk << "\n";
5018 
5019  iout << iINFO << "SMD K2 "
5020  << SMDk2 << "\n";
5021 
5022  iout << iINFO << "SMD OUTPUT FREQUENCY "
5023  << SMDOutputFreq << " TIMESTEPS\n";
5024 
5025  iout << iINFO << "SMD FILE " << SMDFile << "\n";
5026 
5027  iout << endi;
5028  }
5029 
5030  //****** END SMD constraints changes
5031 
5032  if (TMDOn) {
5033  iout << iINFO << "TMD ACTIVE BETWEEN STEPS " << TMDFirstStep
5034  << " and " << TMDLastStep << "\n";
5035  iout << iINFO << "TMD K " << TMDk << "\n";
5036  iout << iINFO << "TMD FILE " << TMDFile << "\n";
5037  iout << iINFO << "TMD OUTPUT FREQUENCY " << TMDOutputFreq << "\n";
5038  if (TMDInitialRMSD) {
5039  iout << iINFO << "TMD TARGET RMSD AT FIRST STEP " << TMDInitialRMSD << "\n";
5040  } else {
5041  iout << iINFO << "TMD TARGET RMSD AT FIRST STEP COMPUTED FROM INITIAL COORDINATES\n";
5042  }
5043  iout << iINFO << "TMD TARGET RMSD AT FINAL STEP " << TMDFinalRMSD << "\n";
5044  iout << endi;
5045  }
5046 
5047  if (symmetryOn) {
5048  if (symmetryLastStep == -1){
5049  iout << iINFO << "SYMMETRY RESTRAINTS ACTIVE BETWEEN STEPS " << symmetryFirstStep << " and " << "INFINITY" << "\n";
5050  }
5051  else{
5052  iout << iINFO << "SYMMETRY RESTRAINTS ACTIVE BETWEEN STEPS " << symmetryFirstStep << " and " << symmetryLastStep << "\n";
5053  }
5054  // iout << iINFO << "SYMMETRY FILE " << symmetryFile << "\n";
5055 
5056  current = config->find("symmetryFile");
5057  for ( ; current; current = current->next ) {
5058  iout << iINFO << "SYMMETRY FILE " << current->data << "\n";
5059  }
5060 
5061  current = config->find("symmetryMatrixFile");
5062  for ( ; current; current = current->next ) {
5063  iout << iINFO << "SYMMETRY MATRIX FILE " << current->data << "\n";
5064  }
5065  iout << iINFO << "SYMMETRY FORCE CONSTANT " << symmetryk << "\n";
5066  if (symmetryScaleForces){
5067  iout << iINFO << "SYMMETRY SCALE FORCES ON\n";
5068  }
5069  iout << iINFO << "SYMMETRY FIRST FULL STEP " << symmetryFirstFullStep << "\n";
5070  if (symmetryLastFullStep == -1){
5071  iout << iINFO << "SYMMETRY LAST FULL STEP " << "INFINITY" << "\n";
5072  //iout << iINFO << "FULL SYMMETRY FORCE BETWEEN STEPS " << symmetryFirstFullStep << " and " << "INFINITY" << "\n";
5073  }
5074  else {
5075  iout << iINFO << "SYMMETRY LAST FULL STEP " << symmetryLastFullStep << "\n";
5076  // iout << iINFO << "FULL SYMMETRY FORCE BETWEEN STEPS " << symmetryFirstFullStep << " and " << symmetryLastFullStep << "\n";
5077  }
5078 
5079  iout << endi;
5080  }
5081 //Modifications for alchemical fep
5082 // Alchemical FEP status
5083 
5084 // current = config->find("alchOutFile");
5085  if (alchFepOn)
5086  {
5087  iout << iINFO << "ALCHEMICAL FEP ON\n";
5088  iout << iINFO << "FEP CURRENT LAMBDA VALUE "
5089  << alchLambda << "\n";
5090  iout << iINFO << "FEP COMPARISON LAMBDA VALUE "
5091  << alchLambda2 << "\n";
5092  if (alchLambdaIDWS >= 0.) {
5093  iout << iINFO << "FEP ALTERNATE COMPARISON LAMBDA VALUE "
5094  << alchLambdaIDWS << "\n";
5095  }
5096  if (alchLambdaFreq > 0) {
5097  iout << iINFO << "FEP CURRENT LAMBDA VALUE SET TO INCREASE IN EVERY "
5098  << alchLambdaFreq << " STEPS\n";
5099  }
5100  if (!alchDecouple) {
5101  iout << iINFO << "FEP INTRA-ALCHEMICAL NON-BONDED INTERACTIONS WILL BE "
5102  << "DECOUPLED\n";
5103  }else{
5104  iout << iINFO << "FEP INTRA-ALCHEMICAL NON-BONDED INTERACTIONS WILL BE "
5105  << "RETAINED\n";
5106  }
5107  if (alchBondDecouple) {
5108  iout << iINFO << "FEP INTRA-ALCHEMICAL BONDED INTERACTIONS WILL BE "
5109  << "DECOUPLED\n";
5110  }else{
5111  iout << iINFO << "FEP INTRA-ALCHEMICAL BONDED INTERACTIONS WILL BE "
5112  << "RETAINED\n";
5113  }
5114  if (alchWCAOn) {
5115  iout << iINFO << "FEP WEEKS-CHANDLER-ANDERSEN (WCA) VDW DECOUPLING "
5116  << "ACTIVE\n";
5117  } else {
5118  iout << iINFO << "FEP VDW SHIFTING COEFFICIENT "
5119  << alchVdwShiftCoeff << "\n";
5120  }
5121  iout << iINFO << "FEP ELEC. ACTIVE FOR ANNIHILATED "
5122  << "PARTICLES BETWEEN LAMBDA = 0 AND LAMBDA = "
5123  << (1 - alchElecLambdaStart) << "\n";
5124  iout << iINFO << "FEP ELEC. ACTIVE FOR EXNIHILATED "
5125  << "PARTICLES BETWEEN LAMBDA = "
5126  << alchElecLambdaStart << " AND LAMBDA = 1\n";
5127  if (alchWCAOn) {
5128  iout << iINFO << "FEP VDW-REPU. ACTIVE FOR ANNIHILATED PARTICLES "
5129  << "BETWEEN LAMBDA = " << (1 - alchRepLambdaEnd) << " AND LAMBDA "
5130  << "= 1\n";
5131  iout << iINFO << "FEP VDW-REPU. ACTIVE FOR EXNIHILATED PARTICLES "
5132  << "BETWEEN LAMBDA = 0 AND LAMBDA " << alchRepLambdaEnd << "\n";
5133  iout << iINFO << "FEP VDW-ATTR. ACTIVE FOR ANNIHILATED PARTICLES "
5134  << "BETWEEN LAMBDA = " << (1 - alchVdwLambdaEnd) << " AND LAMBDA = "
5135  << (1 - alchRepLambdaEnd) << "\n";
5136  iout << iINFO << "FEP VDW-ATTR. ACTIVE FOR EXNIHILATED PARTICLES "
5137  << "BETWEEN LAMBDA = " << alchRepLambdaEnd << " AND LAMBDA = "
5138  << alchVdwLambdaEnd << "\n";
5139  } else {
5140  iout << iINFO << "FEP VDW ACTIVE FOR ANNIHILATED "
5141  << "PARTICLES BETWEEN LAMBDA = "
5142  << (1 - alchVdwLambdaEnd) << " AND LAMBDA = 1\n";
5143  iout << iINFO << "FEP VDW ACTIVE FOR EXNIHILATED "
5144  << "PARTICLES BETWEEN LAMBDA = 0 AND LAMBDA = "
5145  << alchVdwLambdaEnd << "\n";
5146  }
5147  iout << iINFO << "FEP BOND ACTIVE FOR ANNIHILATED "
5148  << "PARTICLES BETWEEN LAMBDA = "
5149  << (1 - alchBondLambdaEnd) << " AND LAMBDA = 1\n";
5150  iout << iINFO << "FEP BOND ACTIVE FOR EXNIHILATED "
5151  << "PARTICLES BETWEEN LAMBDA = 0 AND LAMBDA = "
5152  << alchBondLambdaEnd << "\n";
5153  }
5154 //fepe
5155 
5156  if (alchThermIntOn)
5157  {
5158  iout << iINFO << "THERMODYNAMIC INTEGRATION (TI) ON\n";
5159  iout << iINFO << "TI LAMBDA VALUE "
5160  << alchLambda << "\n";
5161  if (alchLambdaFreq > 0) {
5162  iout << iINFO << "TI COMPARISON LAMBDA VALUE "
5163  << alchLambda2 << "\n";
5164  iout << iINFO << "TI CURRENT LAMBDA VALUE SET TO INCREASE IN EVERY "
5165  << alchLambdaFreq << " STEPS\n";
5166  }
5167  if (!alchDecouple) {
5168  iout << iINFO << "TI INTRA-ALCHEMICAL NON-BONDED INTERACTIONS WILL BE "
5169  << "DECOUPLED\n";
5170  }else{
5171  iout << iINFO << "TI INTRA-ALCHEMICAL NON-BONDED INTERACTIONS WILL BE "
5172  << "RETAINED\n";
5173  }
5174  if (alchBondDecouple) {
5175  iout << iINFO << "TI INTRA-ALCHEMICAL BONDED INTERACTIONS WILL BE "
5176  << "DECOUPLED\n";
5177  }else{
5178  iout << iINFO << "TI INTRA-ALCHEMICAL BONDED INTERACTIONS WILL BE "
5179  << "RETAINED\n";
5180  }
5181  iout << iINFO << "TI VDW SHIFTING COEFFICIENT "
5182  << alchVdwShiftCoeff << "\n";
5183  iout << iINFO << "TI ELEC. ACTIVE FOR ANNIHILATED "
5184  << "PARTICLES BETWEEN LAMBDA = 0 AND LAMBDA = "
5185  << (1 - alchElecLambdaStart) << "\n";
5186  iout << iINFO << "TI ELEC. ACTIVE FOR EXNIHILATED "
5187  << "PARTICLES BETWEEN LAMBDA = "
5188  << alchElecLambdaStart << " AND LAMBDA = 1\n";
5189  iout << iINFO << "TI VDW ACTIVE FOR ANNIHILATED "
5190  << "PARTICLES BETWEEN LAMBDA = "
5191  << (1 - alchVdwLambdaEnd) << " AND LAMBDA = 1\n";
5192  iout << iINFO << "TI VDW ACTIVE FOR EXNIHILATED "
5193  << "PARTICLES BETWEEN LAMBDA = 0 AND LAMBDA = "
5194  << alchVdwLambdaEnd << "\n";
5195  iout << iINFO << "TI BOND ACTIVE FOR ANNIHILATED "
5196  << "PARTICLES BETWEEN LAMBDA = "
5197  << (1 - alchBondLambdaEnd) << " AND LAMBDA = 1\n";
5198  iout << iINFO << "TI BOND ACTIVE FOR EXNIHILATED "
5199  << "PARTICLES BETWEEN LAMBDA = 0 AND LAMBDA = "
5200  << alchBondLambdaEnd << "\n";
5201  }
5202 
5203 
5204  if ( lesOn ) {
5205  iout << iINFO << "LOCALLY ENHANCED SAMPLING ACTIVE\n";
5206  iout << iINFO << "LOCAL ENHANCEMENT FACTOR IS "
5207  << lesFactor << "\n";
5208  if ( lesReduceTemp ) iout << iINFO
5209  << "SCALING ENHANCED ATOM TEMPERATURE BY 1/" << lesFactor << "\n";
5210  if ( lesReduceMass ) iout << iINFO
5211  << "SCALING ENHANCED ATOM MASS BY 1/" << lesFactor << "\n";
5212  }
5213 
5214  if ( singleTopology ) {
5215  iout << iINFO << "SINGLE TOPOLOGY IS ON FOR RELATIVE FREE ENERGY CALCULATION\n";
5216  }
5217 
5218  // REST2
5219  if ( soluteScalingOn ) {
5220  iout << iINFO << "SOLUTE SCALING IS ACTIVE\n";
5221  if (soluteScalingFactorCharge != soluteScalingFactorVdw) {
5222  iout << iINFO << "SCALING FOR ELECTROSTATIC INTERACTIONS IS "
5223  << soluteScalingFactorCharge << "\n";
5224  iout << iINFO << "SCALING FOR VAN DER WAALS INTERACTIONS IS "
5225  << soluteScalingFactorVdw << "\n";
5226  iout << iINFO << "SCALING FOR BONDED INTERACTIONS IS "
5227  << soluteScalingFactor << "\n";
5228  }
5229  else {
5230  iout << iINFO << "SOLUTE SCALING FACTOR IS "
5231  << soluteScalingFactor << "\n";
5232  }
5233  if ( ! soluteScalingAll ) {
5234  iout << iINFO << "SOLUTE SCALING DISABLED FOR BONDS AND ANGLES\n";
5235  }
5236  }
5237 
5238  if ( pairInteractionOn ) {
5239  iout << iINFO << "PAIR INTERACTION CALCULATIONS ACTIVE\n";
5240  iout << iINFO << "USING FLAG " << pairInteractionGroup1
5241  << " FOR GROUP 1\n";
5242  if (pairInteractionSelf) {
5243  iout << iINFO << "COMPUTING ONLY SELF INTERACTIONS FOR GROUP 1 ATOMS\n";
5244  } else {
5245  iout << iINFO << "USING FLAG " << pairInteractionGroup2
5246  << " FOR GROUP 2\n";
5247  }
5248  }
5249 
5250  if (consForceOn) {
5251  iout << iINFO << "CONSTANT FORCE ACTIVE\n";
5252  if ( consForceScaling != 1.0 ) {
5253  iout << iINFO << "CONSTANT FORCE SCALING "
5254  << consForceScaling << "\n" << endi;
5255  }
5256  }
5257 
5258 
5259  // external command forces
5260 
5261  if (extForcesOn) {
5262  iout << iINFO << "EXTERNAL COMMAND FORCES ACTIVE\n";
5263  iout << iINFO << "EXT FORCES COMMAND: " << extForcesCommand << "\n";
5264  iout << iINFO << "EXT COORD FILENAME: " << extCoordFilename << "\n";
5265  iout << iINFO << "EXT FORCE FILENAME: " << extForceFilename << "\n";
5266  iout << endi;
5267  }
5268 
5269  // QM command forces
5270 
5271  if (qmForcesOn) {
5272  iout << iINFO << "QM FORCES ACTIVE\n";
5273  if (qmParamPDBDefined){
5274  iout << iINFO << "QM PDB PARAMETER FILE: " << qmParamPDB << "\n";
5275  }
5276  iout << iINFO << "QM SOFTWARE: " << qmSoftware << "\n";
5277 
5278  if ( qmChrgMode == QMCHRGNONE )
5279  iout << iINFO << "QM ATOM CHARGES FROM QM SOFTWARE: NONE\n";
5280  if ( qmChrgMode == QMCHRGMULLIKEN )
5281  iout << iINFO << "QM ATOM CHARGES FROM QM SOFTWARE: MULLIKEN\n";
5282  if ( qmChrgMode == QMCHRGCHELPG )
5283  iout << iINFO << "QM ATOM CHARGES FROM QM SOFTWARE: CHELPG\n";
5284 
5285  iout << iINFO << "QM EXECUTABLE PATH: " << qmExecPath << "\n";
5286  iout << iINFO << "QM COLUMN: " << qmColumn << "\n";
5287  if (qmBondOn) {
5288  iout << iINFO << "QM BOND COLUMN: " << qmBondColumn << "\n";
5289  iout << iINFO << "QM WILL DETECT BONDS BETWEEN QM AND MM ATOMS.\n";
5290  if (qmBondDist) {
5291  iout << iINFO << "QM BOND COLUMN WILL DEFINE LINK AOTM DISTANCE.\n";
5292  if (qmBondValType == 1)
5293  iout << iINFO << "QM BOND COLUMN HAS LENGTH INFORMATION.\n";
5294  else if (qmBondValType == 2)
5295  iout << iINFO << "QM BOND COLUMN HAS RATIO INFORMATION.\n";
5296  }
5297  if (qmNoPC) {
5298  iout << iINFO << "MECHANICHAL EMBEDDING SELECTED."
5299  " BOND SCHEME WILL BE IGNORED!\n" << endi;
5300  qmBondScheme = QMSCHEMEZ1;
5301  }
5302  else {
5303  if (qmBondScheme == QMSCHEMECS)
5304  iout << iINFO << "QM-MM BOND SCHEME: Charge Shift.\n";
5305  else if (qmBondScheme == QMSCHEMERCD)
5306  iout << iINFO << "QM-MM BOND SCHEME: Redistributed Charge and Dipole.\n";
5307  else if (qmBondScheme == QMSCHEMEZ1)
5308  iout << iINFO << "QM-MM BOND SCHEME: Z1.\n";
5309  else if (qmBondScheme == QMSCHEMEZ2)
5310  iout << iINFO << "QM-MM BOND SCHEME: Z2.\n";
5311  else if (qmBondScheme == QMSCHEMEZ3)
5312  iout << iINFO << "QM-MM BOND SCHEME: Z3.\n";
5313  }
5314 
5315  }
5316 
5317  if (qmChrgFromPSF) {
5318  iout << iINFO << "QM Will use PSF charges.\n";
5319  }
5320 
5321  iout << iINFO << "QM BASE DIRECTORY: " << qmBaseDir << "\n";
5322 
5323  if (qmPrepProcOn) {
5324  iout << iINFO << "QM PREPARATION PROCESS: " << qmPrepProc << "\n";
5325  }
5326  if (qmSecProcOn) {
5327  iout << iINFO << "QM SECONDARY PROCESS: " << qmSecProc << "\n";
5328  }
5329 
5330  current = config->find("QMConfigLine");
5331  for ( ; current; current = current->next ) {
5332 
5333  if ( strstr(current->data,"\n") ) {
5334  iout << iINFO << "QM configuration lines from NADM config file\n";
5335  continue;
5336  }
5337 
5338  iout << iINFO << "QM CONFIG LINE: " << current->data << "\n";
5339 
5340  }
5341 
5342  if (qmReplaceAll) {
5343  iout << iINFO << "QM FORCES WILL REPLACE ALL NAMD FORCES!\n";
5344  }
5345 
5346  if (qmNoPC)
5347  iout << iINFO << "QM NO POINT CHARGE: ON.\n";
5348 
5349  if (qmCustomPCSel)
5350  iout << iINFO << "QM CUSTOM POINT CHARGE SELECTION IS ACTIVATED\n";
5351 
5352  if (! qmNoPC && ! qmCustomPCSel)
5353  iout << iINFO << "QM POINT CHARGES WILL BE SELECTED EVERY "
5354  << qmPCSelFreq << " STEPS.\n";
5355 
5356  if (qmPCSwitchOn) {
5357  iout << iINFO << "QM Point Charge Switching: ON.\n";
5358 
5359  if (qmPCScheme == 1)
5360  iout << iINFO << "QM Point Charge SCHEME: none.\n";
5361  else if (qmPCScheme == 2)
5362  iout << iINFO << "QM Point Charge SCHEME: round.\n";
5363  else if (qmPCScheme == 3)
5364  iout << iINFO << "QM Point Charge SCHEME: zero.\n";
5365  }
5366 
5367  if (qmLSSOn) {
5368  iout << iINFO << "QM LIVE SOLVENT SELECTION IS ACTIVE.\n" ;
5369  iout << iINFO << "QM LIVE SOLVENT SELECTION FREQUENCY: "
5370  << qmLSSFreq << "\n" << endi;
5371 
5372  current = config->find("QMLSSSize");
5373  for ( ; current; current = current->next ) {
5374  iout << iINFO << "QM LIVE SOLVENT SELECTION SIZE (\"qmGrpID numMolecules\"): " << current->data << "\n";
5375  }
5376 
5377  if (! opts.defined("QMLWSResname"))
5378  strcpy(qmLSSResname,"TIP3");
5379  iout << iINFO << "QM LIVE SOLVENT SELECTION WILL USE RESIDUE TYPE: " << qmLSSResname << "\n" << endi;
5380  }
5381 
5382  iout << iINFO << "QM executions per node: " << qmSimsPerNode << "\n";
5383 
5384  iout << endi;
5385  }
5386 
5387 
5388  // gbis gbobc implicit solvent parameters
5389 
5390  if (GBISserOn) {
5391  GBISOn = 0;//turning gbis-ser on turns gbis-parallel off
5392  iout << iINFO<< "GBIS GENERALIZED BORN IMPLICIT SOLVENT ACTIVE (SERIAL)\n";
5393  }
5394  if (GBISOn) {
5395  iout << iINFO << "GBIS GENERALIZED BORN IMPLICIT SOLVENT ACTIVE\n";
5396  }
5397  if (GBISOn || GBISserOn) {
5398  iout << iINFO << "GBIS SOLVENT DIELECTRIC: " << solvent_dielectric<< "\n";
5399  iout << iINFO << "GBIS PROTEIN DIELECTRIC: " << dielectric<< "\n";
5400  iout <<iINFO<<"GBIS COULOMB RADIUS OFFSET: "<< coulomb_radius_offset<<" Ang\n";
5401  iout << iINFO << "GBIS ION CONCENTRATION: " << ion_concentration << " M\n";
5402  iout << iINFO << "GBIS DEBYE SCREENING LENGTH: " << 1.0/kappa << " Ang\n";
5403  iout << iINFO << "GBIS DELTA: " << gbis_delta << "\n";
5404  iout << iINFO << "GBIS BETA: " << gbis_beta << "\n";
5405  iout << iINFO << "GBIS GAMMA: " << gbis_gamma << "\n";
5406  iout << iINFO << "GBIS BORN RADIUS CUTOFF: " << alpha_cutoff << " Ang\n";
5407  iout << iINFO << "GBIS MAX BORN RADIUS: " << alpha_max << " Ang\n";
5408  iout << endi;
5409  }
5410 
5411  if (LCPOOn) {
5412  iout << iINFO << "SASA SURFACE TENSION: " << surface_tension<< " kcal/mol/Ang^2\n";
5413  }
5414 
5415  tclBCScript = 0;
5416  if (tclBCOn) {
5417  iout << iINFO << "TCL BOUNDARY FORCES ACTIVE\n";
5418  current = config->find("tclBCScript");
5419  if ( current ) {
5420  tclBCScript = current->data;
5421  iout << iINFO << "TCL BOUNDARY FORCES SCRIPT " << current->data << "\n";
5422  }
5423  iout << iINFO << "TCL BOUNDARY FORCES ARGS " << tclBCArgs << "\n";
5424  iout << endi;
5425  }
5426 
5427  // Global forces configuration
5428 
5429  globalForcesOn = ( tclForcesOn || freeEnergyOn || miscForcesOn ||
5430  (IMDon && ! (IMDignore || IMDignoreForces)) || SMDOn || TMDOn ||
5431  colvarsOn || symmetryOn || qmForcesOn );
5432 
5433 
5434  if (tclForcesOn)
5435  {
5436  iout << iINFO << "TCL GLOBAL FORCES ACTIVE\n";
5437 
5438  current = config->find("tclForcesScript");
5439 
5440  for ( ; current; current = current->next ) {
5441 
5442  if ( strstr(current->data,"\n") ) {
5443  iout << iINFO << "TCL GLOBAL FORCES SCRIPT INLINED IN CONFIG FILE\n";
5444  continue;
5445  }
5446 
5447  iout << iINFO << "TCL GLOBAL FORCES SCRIPT " << current->data << "\n";
5448 
5449  }
5450  iout << endi;
5451  }
5452 
5453  if (miscForcesOn)
5454  {
5455  iout << iINFO << "MISC FORCES ACTIVE\n";
5456 
5457  current = config->find("miscForcesScript");
5458 
5459  for ( ; current; current = current->next ) {
5460 
5461  if ( strstr(current->data,"\n") ) {
5462  iout << iINFO << "MISC FORCES SCRIPT INLINED IN CONFIG FILE\n";
5463  continue;
5464  }
5465 
5466  iout << iINFO << "MISC FORCES SCRIPT " << current->data << "\n";
5467 
5468  }
5469  iout << endi;
5470  }
5471 
5472  if (freeEnergyOn)
5473  {
5474  iout << iINFO << "FREE ENERGY PERTURBATION ACTIVE\n";
5475 
5476  current = config->find("freeEnergyConfig");
5477 
5478  for ( ; current; current = current->next ) {
5479 
5480  if ( strstr(current->data,"\n") ) {
5481  iout << iINFO << "FREE ENERGY PERTURBATION SCRIPT INLINED IN CONFIG FILE\n";
5482  continue;
5483  }
5484 
5485  iout << iINFO << "FREE ENERGY PERTURBATION SCRIPT " << current->data << "\n";
5486 
5487  }
5488  iout << endi;
5489  }
5490 
5491  if (colvarsOn)
5492  {
5493  iout << iINFO << "COLLECTIVE VARIABLES CALCULATION REQUESTED\n";
5494 
5495  current = config->find ("colvarsConfig");
5496  for ( ; current; current = current->next ) {
5497  if ( strstr(current->data,"\n") ) {
5498  iout << iINFO << "COLLECTIVE VARIABLES CONFIGURATION INLINED IN CONFIG FILE\n";
5499  continue;
5500  }
5501  iout << iINFO << "COLLECTIVE VARIABLES CONFIGURATION " << current->data << "\n";
5502  }
5503 
5504  current = config->find ("colvarsInput");
5505  for ( ; current; current = current->next ) {
5506  if ( strstr(current->data,"\n") ) {
5507  iout << iINFO << "COLLECTIVE VARIABLES RESTART INFORMATION INLINED IN CONFIG FILE\n";
5508  continue;
5509  }
5510  iout << iINFO << "COLLECTIVE VARIABLES RESTART INFORMATION " << current->data << "\n";
5511  }
5512 
5513  iout << endi;
5514  }
5515 
5516  if (IMDon)
5517  {
5518  iout << iINFO << "INTERACTIVE MD ACTIVE\n";
5519  iout << iINFO << "INTERACTIVE MD PORT " << IMDport << "\n";
5520  iout << iINFO << "INTERACTIVE MD FREQ " << IMDfreq << "\n";
5521  if (IMDignore) {
5522  iout << iINFO << "INTERACTIVE MD WILL NOT INFLUENCE SIMULATION\n";
5523  } else {
5524  if (IMDignoreForces)
5525  {
5526  iout << iINFO << "INTERACTIVE FORCES ARE DISABLED\n";
5527  iout << iINFO << "PAUSE, RESUME, DETACH AND FINISH INTERACTIVE MD ARE ENABLED\n";
5528  }
5529  if (IMDwait) iout << iINFO << "WILL AWAIT INTERACTIVE MD CONNECTION\n";
5530  }
5531  iout << endi;
5532  }
5533 
5534  if (globalOn && !dihedralOn)
5535  {
5536  iout << iINFO << "GLOBAL INTEGRATION TEST MODE ACTIVE\n";
5537  }
5538 
5539 
5540  if (dihedralOn)
5541  {
5542  iout << iINFO << "DIHEDRAL ANGLE DYNAMICS ACTIVE\n";
5543  if (!COLDOn)
5544  {
5545  iout << iINFO << "*** DIHEDRAL ANGLE DYNAMICS IS HIGHLY EXPERIMENTAL ***\n";
5546  iout << iINFO << "PLEASE CONSIDER USING THE COLD OPTION AS WELL\n";
5547  }
5548  }
5549 
5550  // This function is so long that it exceeds the emacs brace
5551  // matching default max length of 25600 (a bit before this comment). We
5552  // should take this is a not too subtle hint about scale of this
5553  // violation of good coding practices. Especially considering the
5554  // fact that this function still has about a thousand lines to go
5555  // before its done, and is doomed to grow with new features.
5556 
5557  if (COLDOn)
5558  {
5559  iout << iINFO << "COLD (CONSTRAINED OVERDAMPED LANGEVIN DYNAMICS) ACTIVE\n";
5560 
5561  iout << iINFO << "COLD TARGET TEMP "
5562  << COLDTemp << "\n";
5563 
5564  iout << iINFO << "COLD COLLISION RATE "
5565  << COLDRate << "\n";
5566  }
5567 
5568  if (cylindricalBCOn)
5569  {
5570  iout << iINFO << "CYLINDRICAL BOUNDARY CONDITIONS ACTIVE\n";
5571  iout << iINFO << "AXIS " << cylindricalBCAxis << "\n";
5572  iout << iINFO << "RADIUS #1 " << cylindricalBCr1 << "\n";
5573  iout << iINFO << "FORCE CONSTANT #1 " << cylindricalBCk1 << "\n";
5574  iout << iINFO << "EXPONENT #1 " << cylindricalBCexp1 << "\n";
5575  iout << iINFO << "LENGTH #1 " << cylindricalBCl1 << "\n";
5576  if (cylindricalBCr2 > 0.0)
5577  {
5578  iout << iINFO << "RADIUS #2 " << cylindricalBCr2 << "\n";
5579  iout << iINFO << "FORCE CONSTANT #2 " << cylindricalBCk2 << "\n";
5580  iout << iINFO << "EXPONENT #2 " << cylindricalBCexp2 << "\n";
5581  iout << iINFO << "LENGTH #2 " << cylindricalBCl2 << "\n";
5582  }
5583  iout << iINFO << "CYLINDER BOUNDARY CENTER(" << cylindricalCenter.x << ", "
5584  << cylindricalCenter.y << ", " << cylindricalCenter.z << ")\n";
5585  iout << endi;
5586  }
5587 
5588  if (sphericalBCOn)
5589  {
5590  iout << iINFO << "SPHERICAL BOUNDARY CONDITIONS ACTIVE\n";
5591 
5592  iout << iINFO << "RADIUS #1 "
5593  << sphericalBCr1 << "\n";
5594  iout << iINFO << "FORCE CONSTANT #1 "
5595  << sphericalBCk1 << "\n";
5596  iout << iINFO << "EXPONENT #1 "
5597  << sphericalBCexp1 << "\n";
5598 
5599  if (sphericalBCr2 > 0)
5600  {
5601  iout << iINFO << "RADIUS #2 "
5602  << sphericalBCr2 << "\n";
5603  iout << iINFO << "FORCE CONSTANT #2 "
5604  << sphericalBCk2 << "\n";
5605  iout << iINFO << "EXPONENT #2 "
5606  << sphericalBCexp2 << "\n";
5607  }
5608 
5609  iout << iINFO << "SPHERE BOUNDARY CENTER(" << sphericalCenter.x << ", "
5610  << sphericalCenter.y << ", " << sphericalCenter.z << ")\n";
5611  iout << endi;
5612  }
5613 
5614  if (eFieldOn)
5615  {
5616  iout << iINFO << "ELECTRIC FIELD ACTIVE\n";
5617 
5618  iout << iINFO << "E-FIELD VECTOR ("
5619  << eField.x << ", " << eField.y
5620  << ", " << eField.z << ")\n";
5621  if ( eFieldNormalized ) iout << iINFO << "E-FIELD VECTOR IS SCALED BY CELL BASIS VECTORS\n";
5622  iout << iINFO << "E-FIELD FREQUENCY IS (1/ps) " << eFieldFreq << "\n";
5623  iout << iINFO << "E-FIELD PHASE IS (deg) " << eFieldPhase << "\n";
5624 
5625  iout << endi;
5626  }
5627 
5628  if (stirOn)
5629  {
5630  iout << iINFO << "STIRRING TORQUES ACTIVE\n";
5631 
5632  iout << iINFO << "STIR STARTING THETA (deg) "<< stirStartingTheta << "\n";
5633  iout << iINFO << "STIR ANGULAR VELOCITY (deg/ts) " << stirVel <<"\n";
5634  iout << iINFO << "STIR FORCE HARMONIC SPRING CONSTANT "<< stirK << "\n";
5635  iout << iINFO << "STIR AXIS OF ROTATION (DIRECTION) ("
5636  << stirAxis.x << ", " << stirAxis.y
5637  << ", " << stirAxis.z << ")\n";
5638  iout << iINFO << "STIR PIVOT POINT (COORDINATE) ("
5639  << stirPivot.x << ", " << stirPivot.y
5640  << ", " << stirPivot.z << ")\n";
5641  current = config->find("stirFilename");
5642 
5643  iout << iINFO << "STIR ATOMS AND ORIGINAL POSITIONS FROM FILE " <<current ->data << '\n';
5644  current = config->find("stirredAtomsCol");
5645  iout << iINFO <<"STIR FILE COLUMN " << current ->data << '\n';
5646  iout << endi;
5647  }
5648 
5649  if (drudeOn)
5650  {
5651  iout << iINFO << "DRUDE MODEL DUAL THERMOSTAT IS ACTIVE\n";
5652  iout << iINFO << "DRUDE BOND TEMPERATURE " << drudeTemp << "\n";
5653  if (drudeDamping > 0.0) {
5654  iout << iINFO << "DRUDE DAMPING COEFFICIENT IS "
5655  << drudeDamping << " INVERSE PS\n";
5656  }
5657  if (drudeHardWallOn) {
5658  iout << iINFO << "DRUDE HARD WALL RESTRAINT IS ACTIVE FOR DRUDE BONDS\n";
5659  iout << iINFO << "DRUDE MAXIMUM BOND LENGTH BEFORE RESTRAINT IS "
5660  << drudeBondLen << "\n";
5661  } else if (drudeBondConst > 0.0) {
5662  iout << iINFO << "DRUDE QUARTIC RESTRAINT IS ACTIVE FOR DRUDE BONDS\n";
5663  iout << iINFO << "DRUDE MAXIMUM BOND LENGTH BEFORE RESTRAINT IS "
5664  << drudeBondLen << "\n";
5665  iout << iINFO << "DRUDE BOND RESTRAINT CONSTANT IS "
5666  << drudeBondConst << "\n";
5667  }
5668  if (drudeNbtholeCut > 0.0) {
5669  iout << iINFO << "DRUDE NBTHOLE IS ACTIVE\n";
5670  iout << iINFO << "DRUDE NBTHOLE RADIUS IS "
5671  << drudeNbtholeCut << "\n";
5672  }
5673  }
5674 
5675  if (langevinOn)
5676  {
5677  iout << iINFO << "LANGEVIN DYNAMICS ACTIVE\n";
5678  iout << iINFO << "LANGEVIN TEMPERATURE "
5679  << langevinTemp << "\n";
5680  if (! langevin_useBAOAB) iout << iINFO << "LANGEVIN USING BBK INTEGRATOR\n";
5681  else iout << iINFO << "LANGEVIN USING BAOAB INTEGRATOR\n"; // [!!] Info file
5682  if (langevinDamping > 0.0) {
5683  iout << iINFO << "LANGEVIN DAMPING COEFFICIENT IS "
5684  << langevinDamping << " INVERSE PS\n";
5685  if (langevinHydrogen)
5686  iout << iINFO << "LANGEVIN DYNAMICS APPLIED TO HYDROGENS\n";
5687  else
5688  iout << iINFO << "LANGEVIN DYNAMICS NOT APPLIED TO HYDROGENS\n";
5689  } else {
5690  iout << iINFO << "LANGEVIN DAMPING COEFFICIENTS DETERMINED FROM FILES\n";
5691  current = config->find("langevinFile");
5692  if ( current ) iout << iINFO << "LANGEVIN DAMPING FILE: " <<
5693  current->data << "\n";
5694  else iout << iINFO << "LANGEVIN DAMPING FILE IS COORDINATE PDB\n";
5695  current = config->find("langevinCol");
5696  if ( current ) iout << iINFO << "LANGEVIN DAMPING COLUMN: " <<
5697  current->data << "\n";
5698  else iout << iINFO << "LANGEVIN DAMPING COLUMN: DEFAULT (4TH, O)\n";
5699  }
5700  iout << endi;
5701  }
5702 
5703  // BEGIN LA
5704  if (loweAndersenOn)
5705  {
5706  iout << iINFO << "LOWE-ANDERSEN DYNAMICS ACTIVE\n";
5707  iout << iINFO << "LOWE-ANDERSEN TEMPERATURE "
5708  << loweAndersenTemp << " K\n";
5709  iout << iINFO << "LOWE-ANDERSEN RATE "
5710  << loweAndersenRate << " INVERSE PS\n";
5711  iout << iINFO << "LOWE-ANDERSEN CUTOFF "
5712  << loweAndersenCutoff << " ANGSTROMS\n";
5713  iout << endi;
5714  }
5715  // END LA
5716 
5717  if (tCoupleOn)
5718  {
5719  iout << iINFO << "TEMPERATURE COUPLING ACTIVE\n";
5720  iout << iINFO << "COUPLING TEMPERATURE "
5721  << tCoupleTemp << "\n";
5722  iout << endi;
5723  }
5724 
5725  if (stochRescaleOn)
5726  {
5727  iout << iINFO << "STOCHASTIC RESCALING ACTIVE\n";
5728  iout << iINFO << "STOCHASTIC RESCALING TEMPERATURE "
5729  << stochRescaleTemp << " K\n";
5730  iout << iINFO << "STOCHASTIC RESCALING PERIOD "
5731  << stochRescalePeriod << " PS\n";
5732  iout << iINFO << "STOCHASTIC RESCALING WILL OCCUR EVERY "
5733  << stochRescaleFreq << " STEPS\n";
5734  iout << endi;
5735  }
5736 
5737  if (minimizeOn)
5738  {
5739  iout << iINFO << "OLD STYLE MINIMIZATION ACTIVE\n";
5740  iout << endi;
5741  }
5742 
5743  if (minimizeCGOn)
5744  {
5745  iout << iINFO << "CONJUGATE GRADIENT MINIMIZATION ACTIVE\n";
5746  iout << iINFO << "LINE MINIMIZATION GOAL = " << minLineGoal << "\n";
5747  iout << iINFO << "BABY STEP SIZE = " << minBabyStep << "\n";
5748  iout << iINFO << "TINY STEP SIZE = " << minTinyStep << "\n";
5749  iout << endi;
5750  }
5751 
5752  if (maximumMove)
5753  {
5754  iout << iINFO << "MAXIMUM MOVEMENT "
5755  << maximumMove << "\n";
5756  iout << endi;
5757  }
5758 
5759  if (rescaleFreq > 0)
5760  {
5761  iout << iINFO << "VELOCITY RESCALE FREQ "
5762  << rescaleFreq << "\n";
5763  iout << iINFO << "VELOCITY RESCALE TEMP "
5764  << rescaleTemp << "\n";
5765  iout << endi;
5766  }
5767 
5768  if (reassignFreq > 0)
5769  {
5770  iout << iINFO << "VELOCITY REASSIGNMENT FREQ "
5771  << reassignFreq << "\n";
5772  iout << iINFO << "VELOCITY REASSIGNMENT TEMP "
5773  << reassignTemp << "\n";
5774  if ( reassignIncr != 0. )
5775  iout << iINFO << "VELOCITY REASSIGNMENT INCR "
5776  << reassignIncr << "\n";
5777  if ( reassignHold != 0. )
5778  iout << iINFO << "VELOCITY REASSIGNMENT HOLD "
5779  << reassignHold << "\n";
5780  iout << endi;
5781  }
5782 
5783  if ((int)berendsenPressureOn + (int)langevinPistonOn + (int)multigratorOn > 1)
5784  {
5785  NAMD_die("Multiple pressure control algorithms selected!\n");
5786  }
5787 
5788  if (excludeFromPressure) {
5789  iout << iINFO << "EXCLUDE FROM PRESSURE ACTIVE\n";
5790  }
5791  if (useConstantArea && useConstantRatio) {
5792  NAMD_die("useConstantArea and useConstantRatio are mutually exclusive.\n");
5793  }
5794  if (useConstantRatio && !useFlexibleCell) {
5795  NAMD_die("useConstantRatio requires useFlexibleCell.\n");
5796  }
5797  if (useConstantArea && surfaceTensionTarget) {
5798  NAMD_die("surfaceTensionTarget and useConstantArea are mutually exclusive.\n");
5799  }
5800  if (useConstantArea && !useFlexibleCell) {
5801  NAMD_die("useConstantArea requires useFlexibleCell.\n");
5802  }
5803 
5804  if (berendsenPressureOn || langevinPistonOn) {
5805  if (rigidBonds != RIGID_NONE && useGroupPressure == FALSE) {
5806  useGroupPressure = TRUE;
5807  iout << iWARN << "Option useGroupPressure is being enabled "
5808  << "due to pressure control with rigidBonds.\n" << endi;
5809  }
5810  }
5811 
5812  if (berendsenPressureOn)
5813  {
5814  if ( ! opts.defined("BerendsenPressureFreq") ) {
5815  berendsenPressureFreq = nonbondedFrequency;
5816  if ( fullElectFrequency )
5817  berendsenPressureFreq = fullElectFrequency;
5818  }
5819  if ( (berendsenPressureFreq % nonbondedFrequency) || ( fullElectFrequency
5820  && (berendsenPressureFreq % fullElectFrequency) ) )
5821  NAMD_die("berendsenPressureFreq must be a multiple of both fullElectFrequency and nonbondedFrequency\n");
5822  iout << iINFO << "BERENDSEN PRESSURE COUPLING ACTIVE\n";
5823  iout << iINFO << " TARGET PRESSURE IS "
5824  << berendsenPressureTarget << " BAR\n";
5825  iout << iINFO << " COMPRESSIBILITY ESTIMATE IS "
5826  << berendsenPressureCompressibility << " BAR^(-1)\n";
5827  iout << iINFO << " RELAXATION TIME IS "
5828  << berendsenPressureRelaxationTime << " FS\n";
5829  iout << iINFO << " APPLIED EVERY "
5830  << berendsenPressureFreq << " STEPS\n";
5831  iout << iINFO << " PRESSURE CONTROL IS "
5832  << (useGroupPressure?"GROUP":"ATOM") << "-BASED\n";
5833  iout << endi;
5834  berendsenPressureTarget /= PRESSUREFACTOR;
5835  berendsenPressureCompressibility *= PRESSUREFACTOR;
5836  }
5837 
5838  if (langevinPistonOn)
5839  {
5840  iout << iINFO << "LANGEVIN PISTON PRESSURE CONTROL ACTIVE\n";
5841  iout << iINFO << " TARGET PRESSURE IS "
5842  << langevinPistonTarget << " BAR\n";
5843  iout << iINFO << " OSCILLATION PERIOD IS "
5844  << langevinPistonPeriod << " FS\n";
5845  iout << iINFO << " DECAY TIME IS "
5846  << langevinPistonDecay << " FS\n";
5847  iout << iINFO << " PISTON TEMPERATURE IS "
5848  << langevinPistonTemp << " K\n";
5849  iout << iINFO << " PRESSURE CONTROL IS "
5850  << (useGroupPressure?"GROUP":"ATOM") << "-BASED\n";
5851  iout << iINFO << " INITIAL STRAIN RATE IS "
5852  << strainRate << "\n";
5853  iout << endi;
5854  langevinPistonTarget /= PRESSUREFACTOR;
5855  }
5856 
5857  if (multigratorOn) {
5858  multigratorPressureTarget /= PRESSUREFACTOR;
5859  }
5860 
5861  if (berendsenPressureOn || langevinPistonOn) {
5862  iout << iINFO << " CELL FLUCTUATION IS "
5863  << (useFlexibleCell?"AN":"") << "ISOTROPIC\n";
5864  if (useConstantRatio)
5865  iout << iINFO << " SHAPE OF CELL IS CONSTRAINED IN X-Y PLANE\n";
5866  if (useConstantArea)
5867  iout << iINFO << " CONSTANT AREA PRESSURE CONTROL ACTIVE\n";
5868  }
5869 
5870  if (surfaceTensionTarget != 0)
5871  {
5872  iout << iINFO << "SURFACE TENSION CONTROL ACTIVE\n";
5873  iout << iINFO << " TARGET SURFACE TENSION IS "
5874  << surfaceTensionTarget << " DYN/CM\n";
5875  iout << endi;
5876  // multiply by 100 to convert from dyn/cm to bar-Angstroms, then divide
5877  // by PRESSURE factor to convert bar to NAMD internal pressure units.
5878  surfaceTensionTarget *= 100.0 / PRESSUREFACTOR;
5879  }
5880 
5881  if (pressureProfileOn) {
5882  if ((berendsenPressureOn || langevinPistonOn) && !dcdUnitCell) {
5883 #if 1
5884  iout << iWARN << "Turning on dcdUnitCell so that trajectory files contain unit cell data.\n" << endi;
5885  dcdUnitCell = 1;
5886 #else
5887  NAMD_die("Sorry, pressure profile not implemented for constant pressure.");
5888 #endif
5889  }
5890  // if Ewald is on, only calculate Ewald
5891  if (pressureProfileEwaldOn)
5892  pressureProfileOn = 0;
5893 
5894  if (pressureProfileSlabs < 1)
5895  NAMD_die("pressureProfileSlabs must be positive.");
5896  iout << iINFO << "PRESSURE PROFILE CALCULATIONS ACTIVE\n";
5897  iout << iINFO << " NUMBER OF SLABS: " << pressureProfileSlabs << "\n";
5898  iout << iINFO << " SLAB THICKNESS: " << cellBasisVector3.z / pressureProfileSlabs
5899  << "\n";
5900  iout << iINFO << " TIMESTEPS BETWEEN DATA OUTPUT: "
5901  << pressureProfileFreq << "\n";
5902  iout << iINFO << " NUMBER OF ATOM TYPES: " << pressureProfileAtomTypes << "\n";
5903  iout << endi;
5904  } else {
5905  pressureProfileEwaldOn = 0;
5906  pressureProfileAtomTypes = 1;
5907  }
5908 
5909  if (accelMDOn) {
5910  iout << iINFO << "ACCELERATED MD ACTIVE\n";
5911 
5912  if ( accelMDdual) {
5913  accelMDdihe = FALSE;
5914  iout << iINFO << "APPLYING DUAL BOOST\n";
5915  }
5916  else if ( accelMDdihe ) {
5917  iout << iINFO << "BOOSTING DIHEDRAL POTENTIAL\n";
5918  } else {
5919  iout << iINFO << "BOOSTING TOTAL POTENTIAL\n";
5920  }
5921 
5922  if(accelMDG){
5923  switch(accelMDGiE) {
5924  case 1:
5925  iout << iINFO << "accelMDG THRESHOLD ENERGY SET TO LOWER BOUND Vmax\n";
5926  break;
5927  case 2:
5928  iout << iINFO << "accelMDG THRESHOLD ENERGY SET TO UPPER BOUND Vmin+(Vmax-Vmin)/k0\n";
5929  break;
5930  }
5931  if(accelMDGRestart)
5932  iout << iINFO << "accelMDG USING RESTART FILE " << accelMDGRestartFile << "\n";
5933  if(accelMDGresetVaftercmd)
5934  iout << iINFO << "accelMDG WILL RESET STATISTICS AFTER FIRST CMD STEPS\n";
5935 
5936  iout << iINFO << "accelMDG " << accelMDGcMDSteps << " CONVENTIONAL MD STEPS "
5937  << "(WITH " << accelMDGcMDPrepSteps << " PREPARATION STEPS)\n";
5938  if(accelMDGcMDSteps == 0)
5939  iout << iINFO << "(accelMDGcMDPrepSteps is set to zero automatically)\n";
5940 
5941  iout << iINFO << "accelMDG " << accelMDGEquiSteps << " EQUILIBRATION STEPS "
5942  << "(WITH " << accelMDGEquiPrepSteps << " PREPARATION STEPS)\n";
5943  if(accelMDGEquiSteps == 0)
5944  iout << iINFO << "(accelMDGEquiPrepSteps is set to zero automatically)\n";
5945 
5946  if(accelMDGStatWindow > 0)
5947  iout << iINFO << "accelMDG WILL RESET AVERAGE AND STANDARD DEVIATION EVERY " << accelMDGEquiSteps << " STEPS\n";
5948  else
5949  iout << iINFO << "accelMDG WILL NOT RESET AVERAGE AND STANDARD DEVIATION\n";
5950 
5951  if(accelMDdihe)
5952  iout << iINFO << "accelMDGSigma0D: " << accelMDGSigma0D << " KCAL/MOL\n";
5953  else if(accelMDdual)
5954  iout << iINFO << "accelMDGSigma0P: " << accelMDGSigma0P << " KCAL/MOL, "
5955  << "accelMDGSigma0D: " << accelMDGSigma0D << " KCAL/MOL\n";
5956  else
5957  iout << iINFO << "accelMDGSigma0P: " << accelMDGSigma0P << " KCAL/MOL\n";
5958  }
5959  else{
5960  iout << iINFO << "accelMDE: " << accelMDE << " KCAL/MOL, accelMDalpha: " << accelMDalpha << " KCAL/MOL\n";
5961  if (accelMDdual) {
5962  iout << iINFO << "accelMDTE: " << accelMDTE << " KCAL/MOL, "
5963  << "accelMDTalpha: " << accelMDTalpha << " KCAL/MOL\n";
5964  }
5965  }
5966  if ( accelMDLastStep > 0) {
5967  iout << iINFO << "accelMD WILL BE DONE FROM STEP " << accelMDFirstStep << " TO STEP " << accelMDLastStep << "\n";
5968  } else {
5969  iout << iINFO << "accelMD WILL BE DONE FROM STEP " << accelMDFirstStep << " TO THE END OF THE SIMULATION \n";
5970  }
5971  iout << iINFO << "accelMD OUTPUT FREQUENCY " << accelMDOutFreq << "\n";
5972  iout << endi;
5973  }
5974 
5975  if (adaptTempOn) {
5976  iout << iINFO << "ADAPTIVE TEMPERING ACTIVE:\n";
5977  iout << iINFO << " OUTPUT FREQUENCY: " << adaptTempOutFreq << "\n";
5978  iout << iINFO << " TEMPERATURE UPDATE FREQUENCY: " << adaptTempFreq << "\n";
5979  if ( adaptTempLastStep > 0 )
5980  iout << iINFO << " ADAPTIVE TEMPERING WILL BE DONE FROM STEP " << adaptTempFirstStep << " TO " << adaptTempLastStep << "\n";
5981  else
5982  iout << iINFO << " ADAPTIVE TEMPERING WILL BE DONE FROM STEP " << adaptTempFirstStep << "\n";
5983  if ( adaptTempLangevin )
5984  iout << iINFO << " ADAPTIVE TEMPERING COUPLED TO LANGEVIN THERMOSTAT\n";
5985  if ( adaptTempRescale )
5986  iout << iINFO << " ADAPTIVE TEMPERING COUPLED TO VELOCITY RESCALING\n";
5987  if (adaptTempRestartFreq > 0) {
5988  iout << iINFO << " WRITING RESTART INFORMATION TO " << adaptTempRestartFile << " EVERY " << adaptTempRestartFreq << " STEPS\n";
5989  }
5990 
5991  }
5992 
5993  if (FMAOn)
5994  {
5995  iout << iINFO << "FMA ACTIVE\n";
5996  iout << iINFO << "FMA THETA "
5997  << fmaTheta << "\n";
5998  iout << endi;
5999  }
6000 
6001  FFTWWisdomString = 0;
6002  if (PMEOn)
6003  {
6004  iout << iINFO << "PARTICLE MESH EWALD (PME) ACTIVE\n";
6005  iout << iINFO << "PME TOLERANCE "
6006  << PMETolerance << "\n";
6007  iout << iINFO << "PME EWALD COEFFICIENT "
6008  << PMEEwaldCoefficient << "\n";
6009  iout << iINFO << "PME INTERPOLATION ORDER "
6010  << PMEInterpOrder << "\n";
6011  iout << iINFO << "PME GRID DIMENSIONS "
6012  << PMEGridSizeX << " "
6013  << PMEGridSizeY << " "
6014  << PMEGridSizeZ << "\n";
6015  iout << iINFO << "PME MAXIMUM GRID SPACING "
6016  << PMEGridSpacing << "\n";
6017  if ( PMEBarrier ) {
6018  iout << iINFO << "PME BARRIER ENABLED\n";
6019  }
6020  if ( PMEOffload ) {
6021  iout << iINFO << "PME RECIPROCAL SUM OFFLOADED TO GPU\n";
6022  }
6023  iout << endi;
6024  if ( useDPME ) iout << iINFO << "USING OLD DPME CODE\n";
6025 #ifdef NAMD_FFTW
6026  else if ( FFTWUseWisdom ) { // handle FFTW wisdom
6027 #ifdef NAMD_FFTW_3
6028  iout << iINFO << "Attempting to read FFTW data from system" <<"\n" <<endi;
6029  fftwf_import_system_wisdom();
6030 #endif
6031  if (! opts.defined("FFTWWisdomFile")) {
6032  strcpy(FFTWWisdomFile,"FFTW_NAMD_");
6033  strcat(FFTWWisdomFile,NAMD_VERSION);
6034  strcat(FFTWWisdomFile,"_");
6035  strcat(FFTWWisdomFile,NAMD_PLATFORM);
6036 #ifdef NAMD_FFTW_3
6037  strcat(FFTWWisdomFile,"_FFTW3");
6038 #endif
6039  strcat(FFTWWisdomFile,".txt");
6040  }
6041 
6042  iout << iINFO << "Attempting to read FFTW data from "
6043  << FFTWWisdomFile << "\n" << endi;
6044  FILE *wisdom_file = fopen(FFTWWisdomFile,"r");
6045  if ( wisdom_file ) {
6046 #ifdef NAMD_FFTW_3
6047  fftwf_import_wisdom_from_file(wisdom_file);
6048 #else
6049  fftw_import_wisdom_from_file(wisdom_file);
6050 #endif
6051  fclose(wisdom_file);
6052  }
6053  int nrp = 1;
6054 
6055  // rules based on work available
6056  int minslices = PMEMinSlices;
6057  int dimx = PMEGridSizeX;
6058  int nrpx = ( dimx + minslices - 1 ) / minslices;
6059  if ( nrpx > nrp ) nrp = nrpx;
6060  int dimy = PMEGridSizeY;
6061  int nrpy = ( dimy + minslices - 1 ) / minslices;
6062  if ( nrpy > nrp ) nrp = nrpy;
6063 
6064  // rules based on processors available
6065  int nrpp = CkNumPes();
6066  // if ( nrpp > 32 ) nrpp = 32; // cap to limit messages
6067  if ( nrpp < nrp ) nrp = nrpp;
6068 
6069  // user override
6070  int nrps = PMEProcessors;
6071  if ( nrps > CkNumPes() ) nrps = CkNumPes();
6072  if ( nrps > 0 ) nrp = nrps;
6073 
6074  // make sure there aren't any totally empty processors
6075  int bx = ( dimx + nrp - 1 ) / nrp;
6076  int nrpbx = ( dimx + bx - 1 ) / bx;
6077  int by = ( dimy + nrp - 1 ) / nrp;
6078  int nrpby = ( dimy + by - 1 ) / by;
6079  nrp = ( nrpby > nrpbx ? nrpby : nrpbx );
6080  if ( bx != ( dimx + nrp - 1 ) / nrp )
6081  NAMD_bug("Error in selecting number of PME processors.");
6082  if ( by != ( dimy + nrp - 1 ) / nrp )
6083  NAMD_bug("Error in selecting number of PME processors.");
6084 
6085  // numGridPes = nrpbx;
6086  // numTransPes = nrpby;
6087  // numRecipPes = nrp;
6088  int block2 = (PMEGridSizeY + nrp - 1) / nrp;
6089  int block2_min = PMEGridSizeY % block2;
6090  if ( ! block2_min ) block2_min = block2;
6091  int dim3 = 2 * (PMEGridSizeZ/2 + 1);
6092 
6093  int n[3]; n[0] = PMEGridSizeX; n[1] = PMEGridSizeY; n[2] = PMEGridSizeZ;
6094  fftw_complex *work = new fftw_complex[n[0]];
6095  float *grid1 = (float *) fftwf_malloc(sizeof(float) *n[1]*dim3);
6096  float *grid2 = (float *) fftwf_malloc(sizeof(float) *n[0]*block2*dim3*2);
6097  iout << iINFO << "Optimizing 6 FFT steps. 1..." << endi;
6098 #ifdef NAMD_FFTW_3
6099  int fftwFlags = FFTWPatient ? FFTW_PATIENT : FFTWEstimate ? FFTW_ESTIMATE : FFTW_MEASURE ;
6100  int planLineSizes[1];
6101  planLineSizes[0]=n[2];
6102  int nx= n[0];
6103  int ny=block2;
6104  int sizeLines=nx*ny;
6105  int zdim = dim3;
6106  int nz=zdim;
6107  int xStride=block2 * dim3 / 2;
6108  fftwf_destroy_plan(
6109  fftwf_plan_many_dft_r2c(1, planLineSizes, sizeLines,
6110  (float *) grid2, NULL, 1,
6111  dim3,
6112  (fftwf_complex *) grid2,
6113  NULL, 1,
6114  dim3/2,
6115  fftwFlags));
6116 
6117  iout << " 2..." << endi;
6118  fftwf_destroy_plan(
6119  fftwf_plan_many_dft_c2r(1, planLineSizes, sizeLines,
6120  (fftwf_complex *) grid2,
6121  NULL, 1,
6122  dim3/2,
6123  (float *) grid2, NULL, 1,
6124  dim3,
6125  fftwFlags));
6126  iout << " 3..." << endi;
6127  sizeLines=nz;
6128  planLineSizes[0]=block2;
6129  fftwf_destroy_plan(fftwf_plan_many_dft(1, planLineSizes, sizeLines,
6130  (fftwf_complex *) grid2, NULL,
6131  sizeLines, 1,
6132  (fftwf_complex *) grid2, NULL,
6133  sizeLines, 1,
6134  FFTW_FORWARD,
6135  fftwFlags));
6136  iout << " 4..." << endi;
6137  fftwf_destroy_plan(fftwf_plan_many_dft(1, planLineSizes, sizeLines,
6138  (fftwf_complex *) grid2, NULL,
6139  sizeLines, 1,
6140  (fftwf_complex *) grid2, NULL,
6141  sizeLines, 1,
6142  FFTW_FORWARD,
6143  fftwFlags));
6144  iout << " 5..." << endi;
6145  sizeLines=ny*nz;
6146  planLineSizes[0]=n[0];
6147  fftwf_destroy_plan(fftwf_plan_many_dft(1, planLineSizes, sizeLines,
6148  (fftwf_complex *) grid2, NULL,
6149  sizeLines, 1,
6150  (fftwf_complex *) grid2, NULL,
6151  sizeLines, 1,
6152  FFTW_FORWARD,
6153  fftwFlags));
6154  iout << " 6..." << endi;
6155  fftwf_destroy_plan(fftwf_plan_many_dft(1, planLineSizes, sizeLines,
6156  (fftwf_complex *) grid2, NULL,
6157  sizeLines, 1,
6158  (fftwf_complex *) grid2, NULL,
6159  sizeLines, 1,
6160  FFTW_BACKWARD,
6161  fftwFlags));
6162 
6163 #else
6164  rfftwnd_destroy_plan( rfftwnd_create_plan_specific(
6165  2, n+1, FFTW_REAL_TO_COMPLEX,
6166  ( FFTWEstimate ? FFTW_ESTIMATE : FFTW_MEASURE )
6167  | FFTW_IN_PLACE | FFTW_USE_WISDOM, grid1, 1, 0, 0) );
6168  iout << " 2..." << endi;
6169  fftw_destroy_plan( fftw_create_plan_specific(n[0], FFTW_REAL_TO_COMPLEX,
6170  ( FFTWEstimate ? FFTW_ESTIMATE : FFTW_MEASURE )
6171  | FFTW_IN_PLACE | FFTW_USE_WISDOM, (fftw_complex *) grid2,
6172  block2*dim3/2, work, 1) );
6173  iout << " 3..." << endi;
6174  fftw_destroy_plan( fftw_create_plan_specific(n[0], FFTW_REAL_TO_COMPLEX,
6175  ( FFTWEstimate ? FFTW_ESTIMATE : FFTW_MEASURE )
6176  | FFTW_IN_PLACE | FFTW_USE_WISDOM, (fftw_complex *) grid2,
6177  block2_min*dim3/2, work, 1) );
6178  iout << " 4..." << endi;
6179  fftw_destroy_plan( fftw_create_plan_specific(n[0], FFTW_COMPLEX_TO_REAL,
6180  ( FFTWEstimate ? FFTW_ESTIMATE : FFTW_MEASURE )
6181  | FFTW_IN_PLACE | FFTW_USE_WISDOM, (fftw_complex *) grid2,
6182  block2*dim3/2, work, 1) );
6183  iout << " 5..." << endi;
6184  fftw_destroy_plan( fftw_create_plan_specific(n[0], FFTW_COMPLEX_TO_REAL,
6185  ( FFTWEstimate ? FFTW_ESTIMATE : FFTW_MEASURE )
6186  | FFTW_IN_PLACE | FFTW_USE_WISDOM, (fftw_complex *) grid2,
6187  block2_min*dim3/2, work, 1) );
6188  iout << " 6..." << endi;
6189  rfftwnd_destroy_plan( rfftwnd_create_plan_specific(
6190  2, n+1, FFTW_COMPLEX_TO_REAL,
6191  ( FFTWEstimate ? FFTW_ESTIMATE : FFTW_MEASURE )
6192  | FFTW_IN_PLACE | FFTW_USE_WISDOM, grid1, 1, 0, 0) );
6193 #endif
6194  iout << " Done.\n" << endi;
6195  delete [] work;
6196  fftwf_free(grid1);
6197  fftwf_free(grid2);
6198 
6199 #ifdef NAMD_FFTW_3
6200  FFTWWisdomString = fftwf_export_wisdom_to_string();
6201 #else
6202  FFTWWisdomString = fftw_export_wisdom_to_string();
6203 #endif
6204 
6205  if ( FFTWWisdomString && (CmiNumPartitions() == 1) ) {
6206  iout << iINFO << "Writing FFTW data to "
6207  << FFTWWisdomFile << "\n" << endi;
6208  wisdom_file = fopen(FFTWWisdomFile,"w");
6209  if ( wisdom_file ) {
6210 #ifdef NAMD_FFTW_3
6211  fftwf_export_wisdom_to_file(wisdom_file);
6212 #else
6213  fftw_export_wisdom_to_file(wisdom_file);
6214 #endif
6215  fclose(wisdom_file);
6216  }
6217  }
6218  }
6219 #endif
6220  iout << endi;
6221  }
6222  if (fullDirectOn)
6223  {
6224  iout << iINFO << "DIRECT FULL ELECTROSTATIC CALCULATIONS ACTIVE\n";
6225  iout << endi;
6226  }
6227 
6228  // MSM configure
6229  if (MSMOn)
6230  {
6231  // check MSMQuality
6232  enum { LO=0, MEDLO, MED, MEDHI, HI };
6233 
6234  // MSMApprox
6235  enum { CUBIC=0, QUINTIC, QUINTIC2,
6236  SEPTIC, SEPTIC3, NONIC, NONIC4, C1HERMITE, NUM_APPROX };
6237 
6238  // MSMSplit
6239  enum { TAYLOR2=0, TAYLOR3, TAYLOR4,
6240  TAYLOR5, TAYLOR6, TAYLOR7, TAYLOR8, NUM_SPLIT };
6241 
6242  if (MSMApprox || MSMSplit) { // take these definitions
6243  if (MSMApprox < 0 || MSMApprox >= NUM_APPROX) {
6244  NAMD_die("MSM: unknown approximation requested (MSMApprox)");
6245  }
6246  if (MSMSplit < 0 || MSMSplit >= NUM_SPLIT) {
6247  NAMD_die("MSM: unknown splitting requested (MSMSplit)");
6248  }
6249  }
6250  else { // otherwise use MSMQuality to set MSMApprox and MSMSplit
6251  switch (MSMQuality) {
6252  case LO:
6253  MSMApprox = CUBIC;
6254  MSMSplit = TAYLOR2;
6255  break;
6256  case MEDLO:
6257  MSMApprox = C1HERMITE;
6258  MSMSplit = TAYLOR3;
6259  break;
6260  case MED:
6261  MSMApprox = QUINTIC;
6262  MSMSplit = TAYLOR3;
6263  break;
6264  case MEDHI:
6265  MSMApprox = SEPTIC;
6266  MSMSplit = TAYLOR4;
6267  break;
6268  case HI:
6269  MSMApprox = NONIC;
6270  MSMSplit = TAYLOR5;
6271  break;
6272  default:
6273  NAMD_die("MSM: unknown quality requested (MSMQuality)");
6274  }
6275  }
6276 
6277  iout << iINFO
6278  << "MULTILEVEL SUMMATION METHOD (MSM) FOR ELECTROSTATICS ACTIVE\n";
6279  if (MsmSerialOn) {
6280  iout << iINFO
6281  << "PERFORMING SERIAL MSM CALCULATION FOR LONG-RANGE PART\n";
6282  }
6283  const char *approx_str, *split_str;
6284  switch (MSMApprox) {
6285  case CUBIC: approx_str = "C1 CUBIC"; break;
6286  case QUINTIC: approx_str = "C1 QUINTIC"; break;
6287  case QUINTIC2: approx_str = "C2 QUINTIC"; break;
6288  case SEPTIC: approx_str = "C1 SEPTIC"; break;
6289  case SEPTIC3: approx_str = "C3 SEPTIC"; break;
6290  case NONIC: approx_str = "C1 NONIC"; break;
6291  case NONIC4: approx_str = "C4 NONIC"; break;
6292  case C1HERMITE:approx_str = "C1 HERMITE"; break;
6293  default: approx_str = "UNKNOWN"; break;
6294  }
6295  switch (MSMSplit) {
6296  case TAYLOR2: split_str = "C2 TAYLOR"; break;
6297  case TAYLOR3: split_str = "C3 TAYLOR"; break;
6298  case TAYLOR4: split_str = "C4 TAYLOR"; break;
6299  case TAYLOR5: split_str = "C5 TAYLOR"; break;
6300  case TAYLOR6: split_str = "C6 TAYLOR"; break;
6301  case TAYLOR7: split_str = "C7 TAYLOR"; break;
6302  case TAYLOR8: split_str = "C8 TAYLOR"; break;
6303  default: split_str = "UNKNOWN"; break;
6304  }
6305  iout << iINFO
6306  << "MSM WITH " << approx_str << " INTERPOLATION "
6307  << "AND " << split_str << " SPLITTING\n"
6308  << endi;
6309 
6310  } // end MSM configure
6311  if (FMMOn)
6312  {
6313 #ifdef FMM_SOLVER
6314  iout << iINFO << "FAST MULTIPOLE METHOD (FMM) FOR ELECTROSTATICS ACTIVE\n";
6315  iout << iINFO << "PERFORMING SERIAL FMM CALCULATION\n";
6316  iout << iINFO << "FMM LEVELS = " << FMMLevels << "\n";
6317  iout << iINFO << "FMM PADDING = " << FMMPadding << " ANGSTROMS\n";
6318  iout << endi;
6319 #else
6320  NAMD_die("Must link to FMM library to use FMM\n");
6321 #endif
6322  }
6323 
6324  if ( FMAOn || PMEOn || MSMOn || fullDirectOn || GBISOn || FMMOn )
6325  {
6326  iout << iINFO << "FULL ELECTROSTATIC EVALUATION FREQUENCY "
6327  << fullElectFrequency << "\n";
6328  iout << endi;
6329 
6330  if ( ( outputEnergies % fullElectFrequency ) &&
6331  ( fullElectFrequency % outputEnergies ) )
6332  NAMD_die("Either outputEnergies must be a multiple of fullElectFrequency or vice versa.\n");
6333  }
6334 
6335  if (MTSAlgorithm == NAIVE)
6336  {
6337  iout << iINFO << "USING NAIVE (CONSTANT FORCE) MTS SCHEME.\n" << endi;
6338  }
6339  if (MTSAlgorithm == VERLETI )
6340  {
6341  iout << iINFO << "USING VERLET I (r-RESPA) MTS SCHEME.\n" << endi;
6342  }
6343 
6344  if (longSplitting == SHARP)
6345  iout << iINFO << "SHARP SPLITTING OF LONG RANGE ELECTROSTATICS\n";
6346  else if (longSplitting == XPLOR)
6347  iout << iINFO << "XPLOR SPLITTING OF LONG RANGE ELECTROSTATICS\n";
6348  else if (longSplitting == C1)
6349  iout << iINFO << "C1 SPLITTING OF LONG RANGE ELECTROSTATICS\n";
6350  else if (longSplitting == C2)
6351  iout << iINFO << "C2 SPLITTING OF LONG RANGE ELECTROSTATICS\n";
6352 
6353  if (splitPatch == SPLIT_PATCH_POSITION)
6354  iout << iINFO << "PLACING ATOMS IN PATCHES BY POSITION\n";
6355  else if (splitPatch == SPLIT_PATCH_HYDROGEN)
6356  iout << iINFO << "PLACING ATOMS IN PATCHES BY HYDROGEN GROUPS\n";
6357 
6358  iout << endi;
6359 
6360  if (mollyOn)
6361  {
6362  iout << iINFO << "SLOW FORCE MOLLIFICATION : \n";
6363  iout << iINFO << " ERROR TOLERANCE : " << mollyTol << "\n";
6364  iout << iINFO << " MAX ITERATIONS : " << mollyIter << "\n";
6365  iout << endi;
6366  }
6367 
6368  if (rigidBonds != RIGID_NONE)
6369  {
6370  iout << iINFO << "RIGID BONDS TO HYDROGEN : ";
6371  if (rigidBonds == RIGID_ALL) iout << "ALL\n";
6372  if (rigidBonds == RIGID_WATER) iout << "WATER\n";
6373  iout << iINFO << " ERROR TOLERANCE : " << rigidTol << "\n";
6374  iout << iINFO << " MAX ITERATIONS : " << rigidIter << "\n";
6375  if (useSettle) iout << iINFO << "RIGID WATER USING SETTLE ALGORITHM\n";
6376  iout << endi;
6377  }
6378 
6379 
6380  if (nonbondedFrequency != 1)
6381  {
6382  iout << iINFO << "NONBONDED FORCES EVALUATED EVERY " << nonbondedFrequency << " STEPS\n";
6383  }
6384 
6385  iout << iINFO << "RANDOM NUMBER SEED "
6386  << randomSeed << "\n";
6387 
6388  iout << endi;
6389 
6390  iout << iINFO << "USE HYDROGEN BONDS? ";
6391  if (HydrogenBonds)
6392  {
6393  iout << "YES\n" << endi;
6394  iout << iINFO << "USE ANTECEDENT ATOMS? ";
6395  iout << (useAntecedent ? "YES" : "NO");
6396  iout << "\nHB DIST CUT, ON, OFF ";
6397  iout << daCutoffDist << " , " << daOnDist << " , " << daOffDist;
6398  iout << "\nHB ANGLE CUT, ON, OFF ";
6399  iout << dhaCutoffAngle << " , " << dhaOnAngle << " , ";
6400  iout << dhaOffAngle;
6401  iout << "\nHB ATT, REP exponents ";
6402  iout << distAttExp << " , " << distRepExp;
6403  iout << "\nHB AA, HA exponents ";
6404  iout << aaAngleExp << " , " << haAngleExp;
6405  iout << "\n" << endi;
6406  }
6407  else
6408  {
6409  iout << "NO\n" << endi;
6410  }
6411 
6412 // If this is AMBER, then print AMBER options
6413 
6414  if (amberOn)
6415  { iout << iINFO << "Using AMBER format force field!\n";
6416  current = config->find("parmfile");
6417  iout << iINFO << "AMBER PARM FILE " << current->data << '\n';
6418  if (opts.defined("coordinates"))
6419  { current = config->find("coordinates");
6420  iout << iINFO << "COORDINATE PDB " << current->data << '\n';
6421  }
6422  else
6423  { current = config->find("ambercoor");
6424  iout << iINFO << "AMBER COORDINATE FILE " << current->data << '\n';
6425  }
6426  if (readExclusions)
6427  iout << iINFO << "Exclusions will be read from PARM file!\n";
6428  else
6429  iout << iINFO << "Exclusions in PARM file will be ignored!\n";
6430  iout << iINFO << "SCNB (VDW SCALING) " << vdwscale14 << "\n" << endi;
6431  }
6432  else if(gromacsOn)
6433  {
6434  iout << iINFO << "Using GROMACS format force field!\n";
6435 
6436  current = config->find("grotopfile");
6437  // it should be defined, but, just in case...
6438  if (current == NULL)
6439  NAMD_die("no GROMACS topology file defined!?");
6440  iout << iINFO << "GROMACS TOPO FILE " << current->data << '\n';
6441 
6442  // XXX handle the two types of coordinates more gracefully
6443  current = config->find("grocoorfile");
6444  if (current == NULL) {
6445  current = config->find("coordinates");
6446  if (current == NULL) {
6447  NAMD_die("no coordinate file defined!?");
6448  }
6449  }
6450  iout << iINFO << "GROMACS COOR FILE " << current->data << '\n'
6451  << endi;
6452 
6453  }
6454  else {
6455  if ( !usePluginIO ) {
6456  if ( current = config->find("coordinates") )
6457  iout << iINFO << "COORDINATE PDB " << current->data << '\n' << endi;
6458  }
6459 
6460  current = config->find("structure");
6461 
6462  iout << iINFO << "STRUCTURE FILE "
6463  << current->data << "\n" << endi;
6464 
6465  if (cosAngles)
6466  {
6467  iout << iINFO << "COSANGLES ON. SOME ANGLES WILL BE COSINE-BASED\n" << endi;
6468  }
6469 
6470  //****** BEGIN CHARMM/XPLOR type changes
6471  if (paraTypeXplorOn)
6472  {
6473  iout << iINFO << "PARAMETER file: XPLOR format! (default) \n" << endi;
6474  }
6475  else if (paraTypeCharmmOn)
6476  {
6477  iout << iINFO << "PARAMETER file: CHARMM format! \n" << endi;
6478  }
6479  //****** END CHARMM/XPLOR type changes
6480 
6481  current = config->find("parameters");
6482 
6483  while (current != NULL)
6484  {
6485  iout << iINFO << "PARAMETERS "
6486  << current->data << "\n" << endi;
6487  current = current->next;
6488  }
6489  }
6490 
6491  iout << iINFO << "USING " <<
6492  ( vdwGeometricSigma ? "GEOMETRIC" : "ARITHMETIC" ) <<
6493  " MEAN TO COMBINE L-J SIGMA PARAMETERS\n" << endi;
6494 
6495  if (opts.defined("bincoordinates"))
6496  {
6497  current = config->find("bincoordinates");
6498 
6499  iout << iINFO << "BINARY COORDINATES "
6500  << current->data << "\n";
6501  }
6502 
6503 #ifdef NAMD_AVXTILES
6504  iout << iINFO << "MIXED PRECISION AVX-512 TILES OPTIMIZATIONS: ";
6505  if (useAVXTiles) iout << "ENABLED\n";
6506  else iout << "DISABLED\n";
6507 #endif
6508 
6509 #ifdef MEM_OPT_VERSION
6510  if (opts.defined("binrefcoords"))
6511  {
6512  current = config->find("binrefcoords");
6513 
6514  iout << iINFO << "BINARY REF COORDS "
6515  << current->data << "\n";
6516  }
6517 #endif
6518 
6519  if (firstTimestep)
6520  {
6521  iout << iINFO << "FIRST TIMESTEP "
6522  << firstTimestep << "\n" << endi;
6523  }
6524 }
6525 /* END OF FUNCTION initialize_config_data */
6526 
6527 
6528 /****************************************************************/
6529 /* */
6530 /* FUNCTION parse_mgrid_params */
6531 /* */
6532 /* */
6533 /****************************************************************/
6534 void SimParameters::parse_mgrid_params(ConfigList *config)
6535 {
6536  StringList *current;
6537 
6538  mgridforcelist.clear();
6539  char *key = new char[81];
6540  char *valstr = new char[256];
6541  // If the old gridforce commands are still in use, parse them too.
6542  if (gridforceOn) {
6543  mgridforceOn = TRUE;
6544  const char *default_key = MGRIDFORCEPARAMS_DEFAULTKEY;
6545  MGridforceParams* mgfp = NULL;
6546  mgfp = mgridforcelist.find_key(default_key);
6547  if (mgfp != NULL) {
6548  iout << iINFO << "MGRIDFORCEPOTFILE key "
6549  << key << " redefined for file " << valstr << "\n" << endi;
6550  } else {
6551  mgfp = mgridforcelist.add(default_key);
6552  }
6553  mgfp->gridforceVolts = gridforceVolts;
6554  mgfp->gridforceScale = gridforceScale;
6555 
6556  parse_mgrid_string_param(config,"gridforcefile",&(mgfp->gridforceFile));
6557  parse_mgrid_string_param(config,"gridforcecol",&(mgfp->gridforceCol));
6558  parse_mgrid_string_param(config,"gridforcechargecol",&(mgfp->gridforceQcol));
6559  parse_mgrid_string_param(config,"gridforcepotfile",&(mgfp->gridforceVfile));
6560 
6561  mgfp->gridforceCont[0] = gridforceContA1;
6562  mgfp->gridforceCont[1] = gridforceContA2;
6563  mgfp->gridforceCont[2] = gridforceContA3;
6564  mgfp->gridforceVOffset = gridforceVOffset;
6565 
6566  mgfp->gridforceLite = gridforceLite;
6567  mgfp->gridforceCheckSize = gridforcechecksize;
6568  }
6569 
6570  // Create multigrid parameter structures
6571  current = config->find("mgridforcepotfile");
6572  while (current != NULL) {
6573  int curlen = strlen(current->data);
6574  // iout << iINFO << "MGRIDFORCEPOTFILE " << current->data
6575  // << " " << curlen << "\n" << endi;
6576  sscanf(current->data,"%80s%255s",key,valstr);
6577 
6578  MGridforceParams* mgfp = NULL;
6579  mgfp = mgridforcelist.find_key(key);
6580  if ( mgfp != NULL) {
6581  iout << iINFO << "MGRIDFORCEPOTFILE key "
6582  << key << " redefined for file " << valstr << "\n" << endi;
6583  } else {
6584  mgfp = mgridforcelist.add(key);
6585  }
6586  int fnamelen = strlen(valstr);
6587  mgfp->gridforceVfile = new char[fnamelen+1];
6588  strncpy(mgfp->gridforceVfile,valstr,fnamelen+1);
6589  mgfp->gridforceScale.x =
6590  mgfp->gridforceScale.y =
6591  mgfp->gridforceScale.z = 1.;
6592  mgfp->gridforceVOffset.x =
6593  mgfp->gridforceVOffset.y =
6594  mgfp->gridforceVOffset.z = 0.;
6595 
6596  current = current->next;
6597  }
6598 
6599  current = config->find("mgridforcefile");
6600  while (current != NULL) {
6601  int curlen = strlen(current->data);
6602  // iout << iINFO << "MGRIDFORCEFILE " << current->data
6603  // << " " << curlen << "\n" << endi;
6604  sscanf(current->data,"%80s%255s",key,valstr);
6605 
6606  MGridforceParams* mgfp = NULL;
6607  mgfp = mgridforcelist.find_key(key);
6608  if ( mgfp == NULL) {
6609  iout << iINFO << "MGRIDFORCEFILE no key "
6610  << key << " defined for file " << valstr << "\n" << endi;
6611  } else {
6612  int fnamelen = strlen(valstr);
6613  if (mgfp->gridforceFile != NULL) {
6614  delete [] mgfp->gridforceFile;
6615  }
6616  mgfp->gridforceFile = new char[fnamelen+1];
6617  strncpy(mgfp->gridforceFile,valstr,fnamelen+1);
6618  }
6619 
6620  current = current->next;
6621  }
6622 
6623  current = config->find("mgridforcevolts");
6624  while (current != NULL) {
6625  // iout << iINFO << "MGRIDFORCEVOLTS " << current->data << "\n"
6626  // << endi;
6627  int curlen = strlen(current->data);
6628  sscanf(current->data,"%80s%255s",key,valstr);
6629 
6630  MGridforceParams* mgfp = NULL;
6631  mgfp = mgridforcelist.find_key(key);
6632  if ( mgfp == NULL) {
6633  iout << iINFO << "MGRIDFORCEVOLTS no key "
6634  << key << " defined for file " << valstr << "\n" << endi;
6635  } else {
6636  int boolval = MGridforceParamsList::atoBool(valstr);
6637  if (boolval == -1) {
6638  iout << iINFO << "MGRIDFORCEVOLTS key "
6639  << key << " boolval " << valstr << " badly defined" << endi;
6640  } else {
6641  mgfp->gridforceVolts = (boolval == 1);
6642  }
6643  }
6644 
6645  current = current->next;
6646  }
6647 
6648  current = config->find("mgridforcescale");
6649  while (current != NULL) {
6650  // iout << iINFO << "MGRIDFORCESCALE " << current->data
6651  // << "\n" << endi;
6652  int curlen = strlen(current->data);
6653  int nread;
6654  sscanf(current->data,"%80s%n",key,&nread);
6655  char *val = current->data + nread + 1;
6656 
6657  MGridforceParams* mgfp = NULL;
6658  mgfp = mgridforcelist.find_key(key);
6659  if ( mgfp == NULL) {
6660  iout << iINFO << "MGRIDFORCESCALE no key "
6661  << key << " defined for vector " << val << "\n" << endi;
6662  } else {
6663  mgfp->gridforceScale.set(val);
6664  }
6665 
6666  current = current->next;
6667  }
6668 
6669  current = config->find("mgridforcevoff");
6670  while (current != NULL) {
6671  // iout << iINFO << "MGRIDFORCEVOFF " << current->data
6672  // << "\n" << endi;
6673  int curlen = strlen(current->data);
6674  int nread;
6675  sscanf(current->data,"%80s%n",key,&nread);
6676  char *val = current->data + nread + 1;
6677 
6678  MGridforceParams* mgfp = NULL;
6679  mgfp = mgridforcelist.find_key(key);
6680  if ( mgfp == NULL) {
6681  iout << iINFO << "MGRIDFORCEVOFF no key "
6682  << key << " defined for vector " << val << "\n" << endi;
6683  } else {
6684  mgfp->gridforceVOffset.set(val);
6685  }
6686 
6687  current = current->next;
6688  }
6689 
6690  current = config->find("mgridforcecol");
6691  while (current != NULL) {
6692  // iout << iINFO << "MGRIDFORCECOL " << current->data
6693  // << "\n" << endi;
6694  int curlen = strlen(current->data);
6695  sscanf(current->data,"%80s%255s",key,valstr);
6696 
6697  MGridforceParams* mgfp = NULL;
6698  mgfp = mgridforcelist.find_key(key);
6699  if ( mgfp == NULL) {
6700  iout << iINFO << "MGRIDFORCECOL no key "
6701  << key << " defined for file " << valstr << "\n" << endi;
6702  } else {
6703  int collen = strlen(valstr);
6704  if (mgfp->gridforceCol != NULL) {
6705  delete [] mgfp->gridforceCol;
6706  }
6707  mgfp->gridforceCol = new char[collen+1];
6708  strncpy(mgfp->gridforceCol,valstr,collen+1);
6709  }
6710 
6711  current = current->next;
6712  }
6713 
6714  current = config->find("mgridforcechargecol");
6715  while (current != NULL) {
6716  // iout << iINFO << "MGRIDFORCECHARGECOL " << current->data << "\n"
6717  // << endi;
6718  int curlen = strlen(current->data);
6719  sscanf(current->data,"%80s%255s",key,valstr);
6720 
6721  MGridforceParams* mgfp = NULL;
6722  mgfp = mgridforcelist.find_key(key);
6723  if ( mgfp == NULL) {
6724  iout << iINFO << "MGRIDFORCECHARGECOL no key "
6725  << key << " defined for file " << valstr << "\n" << endi;
6726  } else {
6727  int collen = strlen(valstr);
6728  if (mgfp->gridforceQcol != NULL) {
6729  delete [] mgfp->gridforceQcol;
6730  }
6731  mgfp->gridforceQcol = new char[collen+1];
6732  strncpy(mgfp->gridforceQcol,valstr,collen+1);
6733  }
6734 
6735  current = current->next;
6736  }
6737 
6738  current = config->find("mgridforcecont1");
6739  while (current != NULL) {
6740  // iout << iINFO << "MGRIDFORCECONT1 " << current->data
6741  // << "\n" << endi;
6742  int curlen = strlen(current->data);
6743  sscanf(current->data,"%80s%255s",key,valstr);
6744 
6745  MGridforceParams* mgfp = NULL;
6746  mgfp = mgridforcelist.find_key(key);
6747  if ( mgfp == NULL) {
6748  iout << iINFO << "MGRIDFORCECONT1 no key "
6749  << key << " defined for file " << valstr << "\n" << endi;
6750  } else {
6751  int boolval = MGridforceParamsList::atoBool(valstr);
6752  if (boolval == -1) {
6753  iout << iINFO << "MGRIDFORCECONT1 key "
6754  << key << " boolval " << valstr << " badly defined" << endi;
6755  } else {
6756  mgfp->gridforceCont[0] = (boolval == 1);
6757  }
6758  }
6759 
6760  current = current->next;
6761  }
6762 
6763  current = config->find("mgridforcecont2");
6764  while (current != NULL) {
6765  // iout << iINFO << "MGRIDFORCECONT2 " << current->data
6766  // << "\n" << endi;
6767  int curlen = strlen(current->data);
6768  sscanf(current->data,"%80s%255s",key,valstr);
6769 
6770  MGridforceParams* mgfp = NULL;
6771  mgfp = mgridforcelist.find_key(key);
6772  if ( mgfp == NULL) {
6773  iout << iINFO << "MGRIDFORCECONT2 no key "
6774  << key << " defined for file " << valstr << "\n" << endi;
6775  } else {
6776  int boolval = MGridforceParamsList::atoBool(valstr);
6777  if (boolval == -1) {
6778  iout << iINFO << "MGRIDFORCECONT2 key "
6779  << key << " boolval " << valstr << " badly defined" << endi;
6780  } else {
6781  mgfp->gridforceCont[1] = (boolval == 1);
6782  }
6783  }
6784 
6785  current = current->next;
6786  }
6787  current = config->find("mgridforcecont3");
6788  while (current != NULL) {
6789  // iout << iINFO << "MGRIDFORCECONT3 " << current->data
6790  // << "\n" << endi;
6791  int curlen = strlen(current->data);
6792  sscanf(current->data,"%80s%255s",key,valstr);
6793 
6794  MGridforceParams* mgfp = NULL;
6795  mgfp = mgridforcelist.find_key(key);
6796  if ( mgfp == NULL) {
6797  iout << iINFO << "MGRIDFORCECONT3 no key "
6798  << key << " defined for file " << valstr << "\n" << endi;
6799  NAMD_die("MGRIDFORCE error");
6800  } else {
6801  int boolval = MGridforceParamsList::atoBool(valstr);
6802  if (boolval == -1) {
6803  iout << iINFO << "MGRIDFORCECONT3 key "
6804  << key << " boolval " << valstr << " badly defined" << endi;
6805  } else {
6806  mgfp->gridforceCont[2] = (boolval == 1);
6807  }
6808  }
6809 
6810  current = current->next;
6811  }
6812 
6813  current = config->find("mgridforcelite");
6814  while (current != NULL) {
6815  // iout << iINFO << "MGRIDFORCELITE " << current->data << "\n"
6816  // << endi;
6817  int curlen = strlen(current->data);
6818  sscanf(current->data,"%80s%255s",key,valstr);
6819 
6820  MGridforceParams* mgfp = NULL;
6821  mgfp = mgridforcelist.find_key(key);
6822  if ( mgfp == NULL) {
6823  iout << iINFO << "MGRIDFORCELITE no key "
6824  << key << " defined for file " << valstr << "\n" << endi;
6825  } else {
6826  int boolval = MGridforceParamsList::atoBool(valstr);
6827  if (boolval == -1) {
6828  iout << iINFO << "MGRIDFORCELITE key "
6829  << key << " boolval " << valstr << " badly defined" << endi;
6830  } else {
6831  mgfp->gridforceLite = (boolval == 1);
6832  }
6833  }
6834 
6835  current = current->next;
6836  }
6837 
6838  current = config->find("mgridforcechecksize");
6839  while (current != NULL) {
6840  // iout << iINFO << "MGRIDFORCELITE " << current->data << "\n"
6841  // << endi;
6842  int curlen = strlen(current->data);
6843  sscanf(current->data,"%80s%255s",key,valstr);
6844 
6845  MGridforceParams* mgfp = NULL;
6846  mgfp = mgridforcelist.find_key(key);
6847  if ( mgfp == NULL) {
6848  iout << iINFO << "MGRIDFORCECHECKSIZE no key "
6849  << key << " defined for file " << valstr << "\n" << endi;
6850  } else {
6851  int boolval = MGridforceParamsList::atoBool(valstr);
6852  if (boolval == -1) {
6853  iout << iINFO << "MGRIDFORCECHECKSIZE key "
6854  << key << " boolval " << valstr << " badly defined" << endi;
6855  } else {
6856  mgfp->gridforceCheckSize = (boolval == 1);
6857  }
6858  }
6859 
6860  current = current->next;
6861  }
6862 
6863  delete [] valstr;
6864  delete [] key;
6865 
6866  // Fill in default values for optional items
6867 
6868  MGridforceParams* params = mgridforcelist.get_first();
6869 
6870  while (params != NULL) {
6871  if (params->gridforceFile == NULL) {
6872  char errmsg[255];
6873  sprintf(errmsg,"Value undefined for gridforceFile for key %s\n",
6874  params->gridforceKey);
6875  NAMD_die(errmsg);
6876  }
6877  if (params->gridforceCol == NULL) {
6878  char errmsg[255];
6879  sprintf(errmsg,"Value undefined for gridforceCol for key %s\n",
6880  params->gridforceKey);
6881  NAMD_die(errmsg);
6882  }
6883  params = params->next;
6884  }
6885 
6886 }
6887 
6888 void SimParameters::parse_mgrid_string_param(ConfigList *cl,
6889  const char *fieldname,
6890  char **dest)
6891 {
6892  StringList *vallist = cl->find(fieldname);
6893  char *val = NULL;
6894 
6895  if (vallist != NULL) {
6896  val = vallist->data;
6897  } else {
6898  return;
6899  }
6900 
6901  int len = 0;
6902  if (val == NULL) {
6903  *dest = NULL;
6904  } else {
6905  len = strlen(val);
6906  if (len == 0) {
6907  *dest = NULL;
6908  } else {
6909  *dest = new char[len+1];
6910  strncpy(*dest,val,len+1);
6911  }
6912  }
6913 }
6914 
6915 //This function is used to create directories when outputing into
6916 //multiple files, i.e. used for Parallel IO. -Chao Mei
6917 void SimParameters::create_output_directories(const char *dirname){
6918  //output files organization:
6919  //$outputFilename/$dirname/$outputproc_rank
6920 
6921  //Step 1: create $outputFilename if necessary
6922  int baselen = strlen(outputFilename);
6923  char *filename = new char[baselen+32];
6924  memset(filename, 0, baselen+32);
6925  strcpy(filename, outputFilename);
6926  if(access(filename, F_OK)!=0) {
6927  int ret = MKDIR(filename);
6928  if(ret!=0) {
6929  char errmsg[512];
6930  sprintf(errmsg, "Error in creating top-level directory %s!", filename);
6931  NAMD_die(errmsg);
6932  }
6933  }
6934 
6935  //Step 2: create $dirname if necessary
6936  strcat(filename, PATHSEPSTR);
6937  strcat(filename, dirname);
6938  //check if the directory exists or not
6939  if(access(filename, F_OK)!=0) {
6940  int ret = MKDIR(filename);
6941  if(ret!=0) {
6942  char errmsg[512];
6943  sprintf(errmsg, "Error in creating middle-level directory %s!", filename);
6944  NAMD_die(errmsg);
6945  }
6946  }
6947 
6948  //step 3: create $outputproc_rank if necessary
6949  char tmpstr[256];
6950  for(int i=0; i<numoutputprocs; i++) {
6951  memset(tmpstr, 0, 256);
6952  sprintf(tmpstr, "%s%s%d", filename, PATHSEPSTR, i);
6953  if(access(tmpstr, F_OK)!=0) {
6954  int ret = MKDIR(tmpstr);
6955  if(ret!=0) {
6956  char errmsg[512];
6957  sprintf(errmsg, "Error in creating last-level directory %s!", tmpstr);
6958  NAMD_die(errmsg);
6959  }
6960  }
6961  }
6962 }
6963 
6964 /****************************************************************/
6965 /* */
6966 /* FUNCTION print_mgrid_params */
6967 /* */
6968 /* */
6969 /****************************************************************/
6970 #define BoolToString(b) ((b) ? "TRUE" : "FALSE")
6971 
6972 void SimParameters::print_mgrid_params()
6973 {
6974  const MGridforceParams* params = mgridforcelist.get_first();
6975 
6976  while (params != NULL) {
6977  iout << iINFO << "MGRIDFORCE key " << params->gridforceKey << "\n" << endi;
6978  iout << iINFO << " Potfile " << params->gridforceVfile
6979  << "\n" << endi;
6980  iout << iINFO << " Scale " << params->gridforceScale
6981  << "\n" << endi;
6982  iout << iINFO << " File " << params->gridforceFile
6983  << "\n" << endi;
6984  iout << iINFO << " Col " << params->gridforceCol
6985  << "\n" << endi;
6986 
6987  const char *qcol_msg = "Use atom charge";
6988  if (params->gridforceQcol != NULL) {
6989  qcol_msg = params->gridforceQcol;
6990  }
6991  iout << iINFO << " ChargeCol " << qcol_msg
6992  << "\n" << endi;
6993  iout << iINFO << " VOffset " << params->gridforceVOffset
6994  << "\n" << endi;
6995  iout << iINFO << " Continuous K1 "
6996  << BoolToString(params->gridforceCont[0])
6997  << "\n" << endi;
6998  iout << iINFO << " Continuous K2 "
6999  << BoolToString(params->gridforceCont[1])
7000  << "\n" << endi;
7001  iout << iINFO << " Continuous K3 "
7002  << BoolToString(params->gridforceCont[2])
7003  << "\n" << endi;
7004  iout << iINFO << " Volts "
7005  << BoolToString(params->gridforceVolts)
7006  << "\n" << endi;
7007  iout << iINFO << " Gridforce-Lite "
7008  << BoolToString(params->gridforceLite)
7009  << "\n" << endi;
7010  iout << iINFO << " Gridforce-CheckSize "
7011  << BoolToString(params->gridforceCheckSize)
7012  << "\n" << endi;
7013  params = params->next;
7014  }
7015 }
7016 
7017 
7018 /****************************************************************/
7019 /* */
7020 /* FUNCTION send_SimParameters */
7021 /* */
7022 /* This function is used by the master process to broadcast*/
7023 /* the parameter data to all the other nodes. It just builds */
7024 /* a message with all the relevant data and broadcasts it to */
7025 /* the other nodes. The routine receive_SimParameters is used */
7026 /* by all the other nodes to receive this message. */
7027 /* */
7028 /****************************************************************/
7029 
7031 
7032 {
7033  /*MOStream *msg = com_obj->newOutputStream(ALLBUTME, SIMPARAMSTAG, BUFSIZE);
7034  if ( msg == NULL )
7035  {
7036  NAMD_die("memory allocation failed in SimParameters::send_SimParameters");
7037  }*/
7038 
7039  msg->put(sizeof(SimParameters),(char*)this);
7040  if ( FFTWWisdomString ) {
7041  int fftwlen = strlen(FFTWWisdomString) + 1;
7042  msg->put(fftwlen);
7043  msg->put(fftwlen,FFTWWisdomString);
7044  }
7045  if ( tclBCScript ) {
7046  int tcllen = strlen(tclBCScript) + 1;
7047  msg->put(tcllen);
7048  msg->put(tcllen,tclBCScript);
7049  }
7050 
7051 #ifdef MEM_OPT_VERSION
7052  int filelen = strlen(binAtomFile)+1;
7053  msg->put(filelen);
7054  msg->put(filelen, binAtomFile);
7055 
7056  filelen = strlen(binCoorFile)+1;
7057  msg->put(filelen);
7058  msg->put(filelen, binCoorFile);
7059 
7060  if(binVelFile) {
7061  filelen = strlen(binVelFile)+1;
7062  msg->put(filelen);
7063  msg->put(filelen, binVelFile);
7064  }
7065 
7066  if(binRefFile) {
7067  filelen = strlen(binRefFile)+1;
7068  msg->put(filelen);
7069  msg->put(filelen, binRefFile);
7070  }
7071 #endif
7072 
7073  mgridforcelist.pack_data(msg);
7074 
7075  msg->end();
7076 }
7077 /* END OF FUNCITON send_SimParameters */
7078 
7079 /****************************************************************/
7080 /* */
7081 /* FUNCTION receive_SimParameters */
7082 /* */
7083 /* This function is used by all the child nodes to */
7084 /* receive the simulation parameters from the master node. */
7085 /* */
7086 /****************************************************************/
7087 
7089 
7090 {
7091  msg->get(sizeof(SimParameters),(char*)this);
7092  if ( FFTWWisdomString ) {
7093  int fftwlen;
7094  msg->get(fftwlen);
7095  FFTWWisdomString = new char[fftwlen];
7096  msg->get(fftwlen,FFTWWisdomString);
7097 #ifdef NAMD_FFTW
7098 #ifdef NAMD_FFTW_3
7099  fftwf_import_wisdom_from_string(FFTWWisdomString);
7100 #else
7101  fftw_import_wisdom_from_string(FFTWWisdomString);
7102 #endif
7103 #endif
7104  }
7105  if ( tclBCScript ) {
7106  int tcllen;
7107  msg->get(tcllen);
7108  tclBCScript = new char[tcllen];
7109  msg->get(tcllen,tclBCScript);
7110  }
7111 
7112 #ifdef MEM_OPT_VERSION
7113  int filelen;
7114  msg->get(filelen);
7115  binAtomFile = new char[filelen];
7116  msg->get(filelen, binAtomFile);
7117 
7118  msg->get(filelen);
7119  binCoorFile = new char[filelen];
7120  msg->get(filelen, binCoorFile);
7121 
7122  if(binVelFile) {
7123  msg->get(filelen);
7124  binVelFile = new char[filelen];
7125  msg->get(filelen, binVelFile);
7126  }
7127 
7128  if(binRefFile) {
7129  msg->get(filelen);
7130  binRefFile = new char[filelen];
7131  msg->get(filelen, binRefFile);
7132  }
7133 #endif
7134 
7135 
7136  // The simParameters bit copy above put illegal values in the list pointers
7137  // So this resets everything so that unpacking will work.
7138  mgridforcelist.clear();
7139  mgridforcelist.unpack_data(msg);
7140 
7141  delete msg;
7142 }
7143 /* END OF FUNCTION receive_SimParameters */
7144 
7145 
7146 //fepb IDWS
7148  if ( alchLambdaIDWS >= 0. ) {
7149  const BigReal lambda2 = ( (step / alchIDWSFreq) % 2 == 1 ) ? alchLambda2 : alchLambdaIDWS;
7150  return lambda2;
7151  } else {
7152  return alchLambda2;
7153  }
7154 }
7155 
7156 /* Return true if IDWS is active, else return false. */
7158  if (alchLambdaIDWS < 0.) return 0;
7159  if (alchLambdaIDWS > 1.) {
7160  NAMD_die("alchLambdaIDWS should be either in the range [0.0, 1.0], or negative (disabled).\n");
7161  }
7162  /*
7163  * The internal parameter alchIDWSFreq determines the number of steps of MD
7164  * before each switch of the value of alchLambda2. At most this occurs every
7165  * time the energy is evaluated and thus the default is the greater of
7166  * fullElectFrequency and nonbondedFrequency. However, this choice fails to
7167  * report alternating values if output is printed less often than every step
7168  * (which is almost certainly true). Thus the frequency is reset to match
7169  * alchOutFreq or, if that is zero, outputEnergies. Note that, if
7170  * alchOutFreq > 0 but != outputEnergies, then the data going to stdout
7171  * are likely not useful since the comparison value is difficult to infer.
7172  */
7173  if ( alchOutFreq % fullElectFrequency != 0 ) {
7174  NAMD_die("For IDWS, alchOutFreq must be a multiple of fullElectFrequency.\n");
7175  }
7176  alchIDWSFreq = fullElectFrequency > 0 ? fullElectFrequency : nonbondedFrequency;
7177  if ( !alchOutFreq && outputEnergies > alchIDWSFreq ) alchIDWSFreq = outputEnergies;
7178  if ( alchOutFreq > alchIDWSFreq ) alchIDWSFreq = alchOutFreq;
7179  if ( alchOutFreq && alchOutFreq != outputEnergies) {
7180  iout << iWARN << "alchOutFreq and outputEnergies do not match. IDWS ouput"
7181  << " to stdout may not be useful!\n" << endi;
7182  }
7183  return 1;
7184 }
7185 //fepe IDWS
7186 
7187 //fepb BKR
7189  /*Get lambda at the current step.
7190 
7191  If alchLambdaFreq = 0, return alchLambda. For positive values of
7192  alchLambdaFreq, apply a linear stepwise schedule from alchLambda to
7193  alchLambda2:
7194 
7195  l(t) = l + (l2 - l)*[dn / (N - n0)]*{floor[(n - n0)/dn] + 1}
7196 
7197  n - the current time step
7198  n0 - step at which switching begins (default = 0)
7199  N - total steps in the simulation
7200  dn - alchLambdaFreq (increment frequency, in steps)
7201  l/l2 - alchLambda/alchLambda2
7202 
7203  Note that each step _begins_ by incrementing alchLambda and then integrates
7204  in time. This means that the first and last switch steps may not behave as
7205  immediately expected - at step 0, alchLambda is NOT evaluated and at step N
7206  no step occurs because alchLambda2 has already been reached.
7207  */
7208  if ( alchLambdaFreq > 0 && step >= alchEquilSteps ) {
7209  if ( step == N ) {
7210  return alchLambda2;
7211  }
7212  else {
7213  const int timeOrigin = firstTimestep + alchEquilSteps;
7214  const BigReal alchLambdaDelta = getLambdaDelta();
7215  const BigReal increment = (step - timeOrigin) / BigReal(alchLambdaFreq);
7216  return alchLambda + alchLambdaDelta*(floor(increment) + 1);
7217  }
7218  }
7219  else {
7220  return alchLambda;
7221  }
7222 }
7223 
7225  // Increment by which Lambda changes.
7226  return ((alchLambda2 - alchLambda)*alchLambdaFreq
7227  / BigReal(N - firstTimestep - alchEquilSteps));
7228 }
7229 
7231  // Convenience function for staggered lambda scaling
7232  return (lambda <= alchElecLambdaStart ? 0.
7233  : (lambda - alchElecLambdaStart) / (1. - alchElecLambdaStart));
7234 }
7235 
7236 /*
7237  * Modifications for WCA decomposition of van der Waal interactions.
7238  *
7239  * WCA requires that repulsive and attractive components of the vdW
7240  * forces be treated separately. To keep the code clean, the same scaling
7241  * function is always used and simply has its behavior modified. However,
7242  * the new repluslive scaling only ever gets used when alchWCAOn.
7243  */
7245  // Convenience function for staggered lambda scaling
7246  if ( alchWCAOn ) {
7247  // Read this with the alias alchRepLambdaEnd --> alchAttLambdaStart.
7248  // The second condition is needed when attractive interactions are inactive
7249  // for the whole range, otherwise lambda = 0/1 are incorrect.
7250  if ( lambda < alchRepLambdaEnd || alchRepLambdaEnd == 1.0 ) {
7251  return 0.0;
7252  } else if ( lambda >= alchVdwLambdaEnd ) {
7253  return 1.0;
7254  } else {
7255  return (lambda - alchRepLambdaEnd) / (alchVdwLambdaEnd - alchRepLambdaEnd);
7256  }
7257  } else {
7258  return (lambda >= alchVdwLambdaEnd ? 1. : lambda / alchVdwLambdaEnd);
7259  }
7260 }
7261 
7263  // Convenience function for staggered lambda scaling
7264  return (lambda >= alchRepLambdaEnd ? 1. : lambda / alchRepLambdaEnd);
7265 }
7266 
7268  // Convenience function for staggered lambda scaling
7269  return (lambda >= alchBondLambdaEnd ? 1. : lambda / alchBondLambdaEnd);
7270 }
7271 //fepe
#define LDBAL_HYBRID
Definition: SimParameters.h:63
#define BoolToString(b)
#define SCALED14
Definition: SimParameters.h:43
std::ostream & iINFO(std::ostream &s)
Definition: InfoStream.C:81
void end(void)
Definition: MStream.C:176
BigReal getLambdaDelta(void)
#define XPLOR
Definition: SimParameters.h:55
int istrueinparseopts(const char *name)
void receive_SimParameters(MIStream *)
#define QMSCHEMEZ2
Definition: Molecule.h:140
Bool defined(const char *name)
Definition: ParseOptions.C:913
#define SHARP
Definition: SimParameters.h:54
#define QMSCHEMERCD
Definition: Molecule.h:138
Bool units(const char *name, Units units)
#define PRESSUREFACTOR
Definition: common.h:49
int atobool(const char *s)
#define LDBSTRAT_REFINEONLY
Definition: SimParameters.h:67
#define VERLETI
Definition: SimParameters.h:50
#define DebugM(x, y)
Definition: Debug.h:59
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
BigReal z
Definition: Vector.h:66
#define RIGID_WATER
Definition: SimParameters.h:79
#define FALSE
Definition: common.h:118
#define SCRIPT_PARSE_VECTOR(NAME, VAR)
void scriptSet(const char *, const char *)
std::ostream & iWARN(std::ostream &s)
Definition: InfoStream.C:82
MIStream * get(char &data)
Definition: MStream.h:29
#define ONETHREE
Definition: SimParameters.h:41
BigReal getRepLambda(const BigReal)
#define QMFormatMOPAC
Definition: Molecule.h:130
#define iout
Definition: InfoStream.h:51
int optionalB(const char *newname, const char *parent, const char *msg, int *ptr, int defalt)
#define fftwf_free
Definition: SimParameters.C:40
#define PATHSEP
Definition: SimParameters.C:60
#define C1
Definition: SimParameters.h:56
#define LDBSTRAT_DEFAULT
Definition: SimParameters.h:65
int require(const char *newname, const char *parent, const char *msg, BigReal *ptr, BigReal defalt)
#define QMCHRGCHELPG
Definition: Molecule.h:135
#define QMFormatORCA
Definition: Molecule.h:129
void initialize_config_data(ConfigList *, char *&cwd)
#define MAX_SCRIPT_PARAM_SIZE
#define QMFormatUSR
Definition: Molecule.h:131
#define QMSCHEMEZ3
Definition: Molecule.h:141
#define QMSCHEMEZ1
Definition: Molecule.h:139
#define QMSCHEMECS
Definition: Molecule.h:137
#define NAIVE
Definition: SimParameters.h:49
static int atoBool(const char *s)
Bool set(const ConfigList &configlist)
Definition: ParseOptions.C:642
#define SCRIPT_PARSE_STRING(NAME, VAR)
#define LDBAL_NONE
Definition: SimParameters.h:61
#define LDBSTRAT_OLD
Definition: SimParameters.h:68
#define SCRIPT_PARSE_INT(NAME, VAR)
void NAMD_bug(const char *err_msg)
Definition: common.C:129
#define ONETWO
Definition: SimParameters.h:40
#define SPLIT_PATCH_HYDROGEN
Definition: SimParameters.h:73
void set(Vector A, Vector B, Vector C)
Definition: Lattice.h:31
static ComputeCUDAMgr * getComputeCUDAMgr()
BigReal getBondLambda(const BigReal)
#define WAT_SWM4
Definition: common.h:192
#define QMCHRGMULLIKEN
Definition: Molecule.h:134
#define STRINGNULL
Definition: common.h:128
#define MGRIDFORCEPARAMS_DEFAULTKEY
#define fftwf_malloc
Definition: SimParameters.C:39
BigReal getCurrentLambda2(const int)
#define C2
Definition: SimParameters.h:57
static void pme_select()
BigReal x
Definition: Vector.h:66
dim3 gridSize
void readExtendedSystem(const char *filename, Lattice *latptr=0)
#define NONE
Definition: SimParameters.h:39
void NAMD_die(const char *err_msg)
Definition: common.C:85
#define LDBAL_CENTRALIZED
Definition: SimParameters.h:62
static void select(void)
static void nonbonded_select()
Bool set(const char *s)
Definition: Vector.h:228
#define WAT_TIP3
Definition: common.h:190
#define ONEFOUR
Definition: SimParameters.h:42
char * getfromparseopts(const char *name, char *outbuf)
#define PARSE_MULTIPLES
Definition: ParseOptions.h:40
#define LDBSTRAT_COMPREHENSIVE
Definition: SimParameters.h:66
#define CHDIR
Definition: SimParameters.C:58
StringList * next
Definition: ConfigList.h:49
MGridforceParams * next
char * data
Definition: ConfigList.h:48
int optional(const char *newname, const char *parent, const char *msg, BigReal *ptr, BigReal defalt)
#define CKLOOP_CTRL_PME_FORWARDFFT
Definition: SimParameters.h:94
BigReal y
Definition: Vector.h:66
BigReal getCurrentLambda(const int)
__thread DeviceCUDA * deviceCUDA
Definition: DeviceCUDA.C:22
#define SCRIPT_PARSE_BOOL(NAME, VAR)
Bool get(const char *name, int *val)
Definition: ParseOptions.C:998
StringList * find(const char *name) const
Definition: ConfigList.C:341
static void select(void)
Definition: ComputePme.C:6364
#define RIGID_ALL
Definition: SimParameters.h:78
Range range(const char *name)
#define WAT_TIP4
Definition: common.h:191
BigReal getVdwLambda(const BigReal)
MOStream * put(char data)
Definition: MStream.h:112
#define XXXBIGREAL
#define SPLIT_PATCH_POSITION
Definition: SimParameters.h:72
Bool check_consistency(void)
Definition: ParseOptions.C:391
int b_p() const
Definition: Lattice.h:274
bool one_device_per_node()
Definition: DeviceCUDA.C:402
#define RIGID_NONE
Definition: SimParameters.h:77
#define SCRIPT_PARSE_MOD_FLOAT(NAME, VAR, MOD)
int a_p() const
Definition: Lattice.h:273
#define MKDIR(X)
Definition: SimParameters.C:59
#define TRUE
Definition: common.h:119
int issetinparseopts(const char *name)
#define PATHSEPSTR
Definition: SimParameters.C:61
BigReal getElecLambda(const BigReal)
#define PARSE_STRING
Definition: ParseOptions.h:38
double BigReal
Definition: common.h:114
void send_SimParameters(MOStream *)
int c_p() const
Definition: Lattice.h:275
#define QMCHRGNONE
Definition: Molecule.h:133
#define SCRIPT_PARSE_FLOAT(NAME, VAR)