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