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