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