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