NAMD
Public Member Functions | Friends | List of all members
NamdState Class Reference

#include <NamdState.h>

Public Member Functions

 NamdState (void)
 
 ~NamdState ()
 
int configFileInit (char *)
 
int configListInit (ConfigList *)
 
int loadStructure (const char *, const char *, int)
 
int status ()
 
void useController (Controller *controllerPtr)
 
void runController (void)
 
const ControllergetController () const
 

Friends

class Namd
 
class Node
 
class Controller
 
class ScriptTcl
 

Detailed Description

Definition at line 22 of file NamdState.h.

Constructor & Destructor Documentation

◆ NamdState()

NamdState::NamdState ( void  )

Definition at line 38 of file NamdState.C.

39 {
40  configList = NULL;
41  simParameters = NULL;
42  parameters = NULL;
43  molecule = NULL;
44  pdb = NULL;
45 }

◆ ~NamdState()

NamdState::~NamdState ( )
inline

Definition at line 43 of file NamdState.h.

43 {}

Member Function Documentation

◆ configFileInit()

int NamdState::configFileInit ( char *  )

◆ configListInit()

int NamdState::configListInit ( ConfigList cfgList)

Definition at line 127 of file NamdState.C.

References DebugM, SimParameters::genCompressedPsf, SimParameters::lattice, loadStructure(), NAMD_die(), ConfigList::okay(), RIGID_ALL, RIGID_NONE, and SimParameters::rigidBonds.

127  {
128  configList = cfgList;
129  if (!configList->okay()) {
130  NAMD_die("Simulation config file is incomplete or contains errors.");
131  }
132  DebugM(1,"NamdState::configFileInit configList okay\n");
133 
134  char *currentdir = 0;
135  simParameters = new SimParameters(configList,currentdir);
136  fflush(stdout);
137  lattice = simParameters->lattice;
138 
139  //Check features that are not supported in the memory optimized
140  //version. --Chao Mei
141 #ifdef MEM_OPT_VERSION
142  checkMemOptCompatibility();
143 #endif
144 
145  //Check rigidBonds type when generating the compressed psf files.
146  if(simParameters->genCompressedPsf) {
147  if(simParameters->rigidBonds == RIGID_NONE){
148  //default to RIGID_ALL
149  simParameters->rigidBonds = RIGID_ALL;
150  }
151  }
152 
153  //name the masterPe thread for use in profiling tools
154  pthread_setname_np(
155 #if ! defined(__APPLE__)
156  pthread_self(),
157 #endif
158  "NAMD masterPe");
159 
160  return loadStructure(0,0,0);
161 }
#define DebugM(x, y)
Definition: Debug.h:75
int loadStructure(const char *, const char *, int)
Definition: NamdState.C:163
void NAMD_die(const char *err_msg)
Definition: common.C:147
#define RIGID_ALL
Definition: SimParameters.h:80
Bool okay(void)
Definition: ConfigList.h:120
#define RIGID_NONE
Definition: SimParameters.h:79

◆ getController()

const Controller& NamdState::getController ( ) const
inline

Definition at line 51 of file NamdState.h.

Referenced by colvarproxy_namd::update_accelMD_info().

51  {
52  return (*controller);
53  }

◆ loadStructure()

int NamdState::loadStructure ( const char *  molFilename,
const char *  pdbFilename,
int  reload 
)

Definition at line 163 of file NamdState.C.

References Molecule::alchDroppedAngles, Molecule::alchDroppedDihedrals, Molecule::alchDroppedImpropers, SimParameters::alchOn, SimParameters::amberOn, Molecule::atomcharge(), Molecule::atommass(), Molecule::build_alch_unpert_bond_lists(), Molecule::build_constant_forces(), Molecule::build_constorque_params(), Molecule::build_constraint_params(), Molecule::build_exPressure_atoms(), Molecule::build_extra_bonds(), Molecule::build_fep_flags(), Molecule::build_fixed_atoms(), Molecule::build_go_arrays(), Molecule::build_go_params(), Molecule::build_go_sigmas(), Molecule::build_go_sigmas2(), Molecule::build_gridforce_params(), Molecule::build_langevin_params(), Molecule::build_molecule(), Molecule::build_movdrag_params(), Molecule::build_rotdrag_params(), Molecule::build_ss_flags(), Molecule::build_stirred_atoms(), SimParameters::comMove, compress_molecule_info(), Molecule::compute_LJcorrection(), Molecule::compute_LJcorrection_alternative(), SimParameters::consForceOn, SimParameters::consTorqueOn, SimParameters::constraintsOn, StringList::data, SimParameters::dcdSelectionOn, Molecule::dcdSelectionParams, DebugM, Molecule::delete_alch_bonded(), SimParameters::drudeDamping, SimParameters::drudeOn, endi(), SimParameters::excludeFromPressure, BackEnd::exit(), SimParameters::extraBondsOn, ConfigList::find(), SimParameters::fixedAtomsOn, Molecule::freeBFactorData(), Molecule::freeOccupancyData(), dcd_params::frequency, SimParameters::genCompressedPsf, Molecule::getBFactorData(), Molecule::getOccupancyData(), PluginIOMgr::getPlugin(), SimParameters::goForcesOn, SimParameters::goMethod, SimParameters::gromacsOn, AmberParm7Reader::Ambertoppar::HasData, iINFO(), iout, iWARN(), SimParameters::langevinDamping, SimParameters::langevinHydrogen, SimParameters::langevinOn, SimParameters::lesOn, SimParameters::LJcorrection, SimParameters::LJcorrectionAlt, Molecule::maxHydrogenGroupSize, Molecule::maxMigrationGroupSize, SimParameters::mgridforceOn, SimParameters::minimizeCGOn, SimParameters::monteCarloPressureOn, SimParameters::movDragOn, NAMD_bug(), NAMD_die(), PDB::num_atoms(), Molecule::num_deg_freedom(), Molecule::numAngles, numatoms, Molecule::numAtoms, Molecule::numBonds, Molecule::numConsForce, Molecule::numConstraints, Molecule::numCrossterms, Molecule::numDihedrals, Molecule::numDrudeAtoms, Molecule::numExclusions, Molecule::numFepFinal, Molecule::numFepInitial, Molecule::numFixedAtoms, Molecule::numFixedGroups, Molecule::numFixedRigidBonds, Molecule::numGridforceGrids, Molecule::numHydrogenGroups, Molecule::numImpropers, SimParameters::numinputprocs, Molecule::numLonepairs, Molecule::numMigrationGroups, Molecule::numMultipleDihedrals, Molecule::numMultipleImpropers, SimParameters::numoutputprocs, SimParameters::numoutputwrts, Molecule::numRigidBonds, Molecule::numStirredAtoms, SimParameters::oldParmReader, SimParameters::pairInteractionOn, SimParameters::pairInteractionSelf, SimParameters::paraTypeCharmmOn, SimParameters::paraTypeXplorOn, Molecule::parse_dcd_selection_params(), Molecule::prepare_qm(), SimParameters::pressureProfileAtomTypes, Molecule::print_atoms(), Molecule::print_bonds(), Molecule::print_exclusions(), Parameters::print_param_summary(), SimParameters::qmForcesOn, SimParameters::qmParamPDB, SimParameters::qmParamPDBDefined, SimParameters::qmReplaceAll, read_binary_coors(), Ambertoppar::readparm(), AmberParm7Reader::readparm(), SimParameters::rigidBonds, SimParameters::rotDragOn, SimParameters::sdScaling, Molecule::set_qm_replaceAll(), SimParameters::soluteScalingOn, SimParameters::stirOn, Molecule::suspiciousAlchBonds, SimParameters::tCoupleOn, SimParameters::useCompressedPsf, SimParameters::usePluginIO, SimParameters::vdwscale14, and Lattice::volume().

Referenced by configListInit(), and Node::reloadStructure().

163  {
164 
165  StringList *molInfoFilename;
166  // If it's AMBER force field, read the AMBER style files;
167  // if it's GROMACS, read the GROMACS files;
168  // Otherwise read the CHARMM style files
169 
170  if (simParameters->amberOn) {
171  if (simParameters->oldParmReader) {
172  iout << iWARN << "You are using the old AMBER parm/parm7 reader, which does not support CMAP in ff19SB and will silently skip it.\n" << endi;
173  if ( reload ) NAMD_die("Molecular structure reloading not supported for Amber input files.\n");
174  StringList *parmFilename = configList->find("parmfile");
175  molInfoFilename = parmFilename;
176  StringList *coorFilename = configList->find("ambercoor");
177  // "amber" is a temporary data structure, which records all
178  // the data from the parm file. After copying them into
179  // molecule, parameter and pdb structures, it will be deleted.
180  Ambertoppar *amber;
181  amber = new Ambertoppar;
182  if (amber->readparm(parmFilename->data))
183  { parameters = new Parameters(amber, simParameters->vdwscale14);
184  molecule = new Molecule(simParameters, parameters, amber);
185  if (coorFilename != NULL)
186  pdb = new PDB(coorFilename->data,amber);
187  delete amber;
188  }
189  else
190  NAMD_die("Failed to read AMBER parm file!");
191  parameters->print_param_summary();
192  } else {
193  if ( reload ) NAMD_die("Molecular structure reloading not supported for Amber input files.\n");
194  StringList *parmFilename = configList->find("parmfile");
195  molInfoFilename = parmFilename;
196  StringList *coorFilename = configList->find("ambercoor");
198  if (amber.HasData) {
199  parameters = new Parameters(&amber, simParameters->vdwscale14);
200  molecule = new Molecule(simParameters, parameters, &amber);
201  if (coorFilename != NULL)
202  pdb = new PDB(coorFilename->data,&amber);
203  } else {
204  NAMD_die("Failed to read AMBER parm file!");
205  }
206  parameters->print_param_summary();
207  }
208  }
209  else if (simParameters->gromacsOn) {
210  if ( reload ) NAMD_die("Molecular structure reloading not supported for Gromacs input files.\n");
211  StringList *topFilename = configList->find("grotopfile");
212  molInfoFilename = topFilename;
213  StringList *coorFilename = configList->find("grocoorfile");
214  // "gromacsFile" is a temporary data structure, which records all
215  // the data from the topology file. After copying it into the
216  // molecule and parameter and pdb, it will be deleted.
217  GromacsTopFile *gromacsFile;
218  gromacsFile = new GromacsTopFile(topFilename->data);
219  parameters = new Parameters(gromacsFile,simParameters->minimizeCGOn);
220  if (coorFilename != NULL)
221  pdb = new PDB(coorFilename->data,gromacsFile);
222 
223  molecule = new Molecule(simParameters, parameters, gromacsFile);
224  // XXX does Molecule(needAll,these,arguments)?
225 
226  delete gromacsFile; // XXX unimplemented
227 
228  // XXX add error handling when the file doesn't exist
229  // XXX make sure the right things happen when the parameters are
230  // not even specified.
231  // NAMD_die("Failed to read AMBER parm file!");
232  parameters->print_param_summary();
233  }
234  else if (simParameters->usePluginIO){
235 #ifdef MEM_OPT_VERSION
236  NAMD_die("Using plugin IO is not supported in memory optimized version!");
237 #else
238  if ( pdbFilename ) {
239  NAMD_bug("NamdState::loadStructure pdbFilename non-null with usePluginIO\n");
240  }
241 
242  PluginIOMgr *pIOMgr = new PluginIOMgr();
243 
244  iout << iWARN << "Plugin-based I/O is still in development and may still have bugs\n" << endi;
245 
246  molfile_plugin_t *pIOHandle = pIOMgr->getPlugin();
247  if (pIOHandle == NULL) {
248  NAMD_die("ERROR: Failed to match requested plugin type");
249  }
250  if ( pIOHandle->open_file_read == NULL )
251  NAMD_die("ERROR: Selected plugin type cannot open files");
252  if ( pIOHandle->read_structure == NULL )
253  NAMD_die("ERROR: Selected plugin type cannot read structures");
254  if ( pIOHandle->read_next_timestep == NULL )
255  NAMD_die("ERROR: Selected plugin type cannot read coordinates");
256 
257  StringList *moleculeFilename = configList->find("structure");
258  molInfoFilename = moleculeFilename;
259  if ( ! molFilename ) molFilename = moleculeFilename->data;
260  if ( ! reload ) {
261  StringList *parameterFilename = configList->find("parameters");
262  //****** BEGIN CHARMM/XPLOR type changes
263  // For AMBER use different constructor based on parm_struct!!! -JCP
264  parameters = new Parameters(simParameters, parameterFilename);
265  parameters->print_param_summary();
266  }
267 
268  int numAtoms = 0;
269  //TODO: not sure about the name field in the handler
270  void *plgFile = pIOHandle->open_file_read(molFilename,
271  pIOHandle->name, &numAtoms);
272  if(plgFile == NULL) {
273  NAMD_die("ERROR: Opening structure file failed!");
274  }
275 
276  double fileReadTime = CmiWallTimer();
277  molecule = new Molecule(simParameters, parameters, pIOHandle, plgFile, numAtoms);
278  iout << iINFO << "TIME FOR LOAD MOLECULE STRUCTURE INFORMATION: " << CmiWallTimer() - fileReadTime << "\n" << endi;
279 
280  /* If we are only generating compressed molecule information, the PDB object is not needed */
281  if(!simParameters->genCompressedPsf) {
282  fileReadTime = CmiWallTimer();
283  //get the occupancy data from the Molecule object and then free it
284  //as it is stored in the Molecule object.
285  pdb = new PDB(pIOHandle, plgFile, molecule->numAtoms, molecule->getOccupancyData(), molecule->getBFactorData());
286  molecule->freeOccupancyData();
287  molecule->freeBFactorData();
288  iout << iINFO << "TIME FOR LOADING ATOMS' COORDINATES INFORMATION: " << CmiWallTimer() - fileReadTime << "\n" << endi;
289  }
290 
291  pIOHandle->close_file_read(plgFile);
292  delete pIOMgr;
293 #endif
294  }
295  else
296  {
297  StringList *moleculeFilename = configList->find("structure");
298  molInfoFilename = moleculeFilename;
299  if ( ! molFilename ) molFilename = moleculeFilename->data;
300  if ( ! reload ) {
301  StringList *parameterFilename = configList->find("parameters");
302  //****** BEGIN CHARMM/XPLOR type changes
303  // For AMBER use different constructor based on parm_struct!!! -JCP
304  parameters = new Parameters(simParameters, parameterFilename);
305  //****** END CHARMM/XPLOR type changes
306 
307  parameters->print_param_summary();
308  }
309 
310  double fileReadTime = CmiWallTimer();
311  molecule = new Molecule(simParameters, parameters, (char*)molFilename, configList);
312  iout << iINFO << "TIME FOR READING PSF FILE: " << CmiWallTimer() - fileReadTime << "\n" << endi;
313 }
314 
315  fflush(stdout);
316 
317 #ifdef MEM_OPT_VERSION
318  //upon knowing the number of atoms, it's good time to estimate the number of
319  //input/output processors if their value is not set
320  if(simParameters->numinputprocs==0){
321  int numatoms = molecule->numAtoms;
322  long estval = (sizeof(InputAtom)+2*sizeof(int)+1)*((long)(numatoms));
323  int numprocs = estval>>26; //considering every input proc consumes about 64M.
324  if(numprocs==0){
325  numprocs=1;
326  }else if(numprocs>CkNumPes()){
327  numprocs=CkNumPes();
328  }
329  simParameters->numinputprocs=numprocs;
330  }
331  if(simParameters->numoutputprocs==0){
332  int numatoms = molecule->numAtoms;
333  long estval = (sizeof(Vector)*2)*((long)(numatoms));
334  int numprocs = estval>>26; //considering every input proc consumes about 64M.
335  if(numprocs==0){
336  numprocs=1;
337  }else if(numprocs>CkNumPes()){
338  numprocs=CkNumPes();
339  }
340  simParameters->numoutputprocs=numprocs;
341  }
342  //check the number of output procs that simultaneously write to a file
343  if(simParameters->numoutputwrts > simParameters->numoutputprocs) {
344  simParameters->numoutputwrts = simParameters->numoutputprocs;
345  }
346 
347  if (simParameters->fixedAtomsOn){
348  double fileReadTime = CmiWallTimer();
349  molecule->load_fixed_atoms(configList->find("fixedAtomListFile"));
350  iout << iINFO << "TIME FOR READING FIXED ATOMS FILE: " << CmiWallTimer() - fileReadTime << "\n" << endi;
351  }
352 
353  if (simParameters->constraintsOn){
354  double fileReadTime = CmiWallTimer();
355  molecule->load_constrained_atoms(configList->find("consAtomListFile"));
356  iout << iINFO << "TIME FOR READING CONSTRAINED ATOMS FILE: " << CmiWallTimer() - fileReadTime << "\n" << endi;
357  }
358 #else
359  if (simParameters->extraBondsOn) {
360  //The extra bonds building will be executed in read_compressed_psf in
361  //the memory optimized version, so avoid calling this function in the
362  //memory optimized run.
363  if(!simParameters->useCompressedPsf)
364  molecule->build_extra_bonds(parameters, configList->find("extraBondsFile"));
365  }
366 
367  if (simParameters->monteCarloPressureOn) {
368  // build molecule and atom index in each molecule
369  molecule->build_molecule();
370  }
371 
372  if(simParameters->genCompressedPsf) {
373  double fileReadTime = CmiWallTimer();
374  compress_molecule_info(molecule, molInfoFilename->data, parameters, simParameters, configList);
375  iout << "Finished compressing molecule information, which takes " << CmiWallTimer()-fileReadTime <<"(s)\n"<<endi;
376  BackEnd::exit();
377  }
378 
379  //If using plugin-based IO, the PDB object is already created!
380  StringList *coordinateFilename = NULL;
381  if(!simParameters->usePluginIO) {
382  //In the memory opt version, the coordinates of atoms
383  //are read during startup in parallel with a bincoordinates input
384  //-Chao Mei
385  double fileReadTime = CmiWallTimer();
386  if ( pdbFilename ) {
387  iout << iINFO << "Reading pdb file " << pdbFilename << "\n" << endi;
388  pdb = new PDB(pdbFilename);
389  } else {
390  coordinateFilename = configList->find("coordinates");
391  if (coordinateFilename != NULL) {
392  iout << iINFO << "Reading pdb file " << coordinateFilename->data << "\n" << endi;
393  pdb = new PDB(coordinateFilename->data);
394  }
395  }
396  if (pdb->num_atoms() != molecule->numAtoms) {
397  NAMD_die("Number of pdb and psf atoms are not the same!");
398  }
399  iout << iINFO << "TIME FOR READING PDB FILE: " << CmiWallTimer() - fileReadTime << "\n" << endi;
400  iout << iINFO << "\n" << endi;
401  }
402 
403  // If constraints are active, build the parameters necessary
404  if (simParameters->constraintsOn)
405  {
406  StringList *consRefFile = configList->find("consref");
407  StringList *consKFile = configList->find("conskfile");
408 
409  if (coordinateFilename != NULL) {
410  if(strcasecmp(coordinateFilename->data, consRefFile->data)==0)
411  consRefFile = NULL;
412  if(strcasecmp(coordinateFilename->data, consKFile->data)==0)
413  consKFile = NULL;
414  }
415 
416  molecule->build_constraint_params(consRefFile, consKFile,
417  configList->find("conskcol"),
418  pdb,
419  NULL);
420  }
421 #endif
422  //CkPrintf ("DEBUG--check if StirOn to build stir params..\n");
423 
424  if (simParameters->stirOn)
425  {
426  //CkPrintf ("DEBUG--now to build stir params..\n");
427 
428  molecule->build_stirred_atoms(configList->find("stirFilename"),
429  configList->find("stirredAtomsCol"),
430  pdb,
431  NULL);
432  }
433 
434 
435 #ifndef MEM_OPT_VERSION
436  if (simParameters->fixedAtomsOn)
437  {
438  molecule->build_fixed_atoms(configList->find("fixedatomsfile"),
439  configList->find("fixedatomscol"),
440  pdb,
441  NULL);
442  }
443 #endif
444 
445  /* BEGIN gf */
446  if (simParameters->mgridforceOn)
447  {
448 
449  molecule->build_gridforce_params(configList->find("gridforcefile"),
450  configList->find("gridforcecol"),
451  configList->find("gridforcechargecol"),
452  configList->find("gridforcepotfile"),
453  pdb,
454  NULL);
455  }
456  /* END gf */
457 
458  // If constant forces are active, read the forces necessary
459  if (simParameters->consForceOn) {
460  char *filename = NULL;
461  if (configList->find("consforcefile"))
462  filename = configList->find("consforcefile")->data;
463  molecule->build_constant_forces(filename);
464  }
465 
466 
467  // If user defined DCD active, read the atoms necessary
468  if (simParameters->dcdSelectionOn) {
469  // initialize
470  for(int i=0;i<16;i++)
471  molecule->dcdSelectionParams[i].frequency=0;
472  molecule->parse_dcd_selection_params(configList);
473  }
474 
475  if (simParameters->excludeFromPressure) {
476  molecule->build_exPressure_atoms(
477  configList->find("excludeFromPressureFile"),
478  configList->find("excludeFromPressureCol"),
479  pdb, NULL);
480  }
481 
482  // If moving drag is active, build the parameters necessary
483  if (simParameters->movDragOn) {
484  molecule->build_movdrag_params(configList->find("movDragFile"),
485  configList->find("movDragCol"),
486  configList->find("movDragVelFile"),
487  pdb,
488  NULL);
489  }
490 
491  // If rotating drag is active, build the parameters necessary
492  if (simParameters->rotDragOn) {
493  molecule->build_rotdrag_params(configList->find("rotDragFile"),
494  configList->find("rotDragCol"),
495  configList->find("rotDragAxisFile"),
496  configList->find("rotDragPivotFile"),
497  configList->find("rotDragVelFile"),
498  configList->find("rotDragVelCol"),
499  pdb,
500  NULL);
501  }
502 
503  // If "constant" torque is active, build the parameters necessary
504  if (simParameters->consTorqueOn) {
505  molecule->build_constorque_params(configList->find("consTorqueFile"),
506  configList->find("consTorqueCol"),
507  configList->find("consTorqueAxisFile"),
508  configList->find("consTorquePivotFile"),
509  configList->find("consTorqueValFile"),
510  configList->find("consTorqueValCol"),
511  pdb,
512  NULL);
513  }
514 
515 #ifndef MEM_OPT_VERSION
516  // If langevin dynamics or temperature coupling are active, build
517  // the parameters necessary
518  if (simParameters->langevinOn)
519  {
520  if (simParameters->langevinDamping == 0.0) {
521  molecule->build_langevin_params(configList->find("langevinfile"),
522  configList->find("langevincol"),
523  pdb,
524  NULL);
525  } else {
526  molecule->build_langevin_params(simParameters->langevinDamping,
527  simParameters->drudeDamping,
528  simParameters->langevinHydrogen);
529  }
530  }
531  else if (simParameters->tCoupleOn)
532  {
533  // Temperature coupling uses the same parameters, but with different
534  // names . . .
535  molecule->build_langevin_params(configList->find("tcouplefile"),
536  configList->find("tcouplecol"),
537  pdb,
538  NULL);
539  }
540 
541  // Modifications for alchemical fep
542  // identify the mutant atoms for fep simulation
543  if (simParameters->alchOn) {
544  molecule->build_fep_flags(configList->find("alchfile"),
545  configList->find("alchcol"), pdb, NULL, "alch" );
546  molecule->delete_alch_bonded();
547  if (simParameters->sdScaling) {
548  if (configList->find("unperturbedBondFile") == NULL) {
549  NAMD_die("Input file for Shobana's bond terms is required with sdScaling on");
550  }
551  molecule->build_alch_unpert_bond_lists(configList->find("unperturbedBondFile")->data);
552  }
553  }
554 //fepe
555 
556  if (simParameters->lesOn) {
557  if (simParameters->alchOn) NAMD_bug("FEP/TI and LES are incompatible!");
558  molecule->build_fep_flags(configList->find("lesfile"),
559  configList->find("lescol"), pdb, NULL, "les");
560  }
561  if (simParameters->soluteScalingOn) {
562  molecule->build_ss_flags(configList->find("soluteScalingFile"),
563  configList->find("soluteScalingCol"), pdb, NULL);
564  }
565  if (simParameters->pairInteractionOn) {
566  molecule->build_fep_flags(configList->find("pairInteractionFile"),
567  configList->find("pairInteractionCol"), pdb, NULL, "pairInteraction");
568  }
569  if (simParameters->pressureProfileAtomTypes > 1) {
570  molecule->build_fep_flags(configList->find("pressureProfileAtomTypesFile"),
571  configList->find("pressureProfileAtomTypesCol"), pdb, NULL,
572  "pressureProfileAtomTypes");
573  }
574 
575  #ifdef OPENATOM_VERSION
576  if (simParameters->openatomOn) {
577  molecules->build_qmmm_flags(configList->find("openatomPdbFile",
578  configList->find("openatomPdbCol"), pdb, NULL, "openatomPdb")
579  }
580  #endif // OPENATOM_VERSION
581 
582  if (simParameters->qmForcesOn){
583 
584 #ifdef MEM_OPT_VERSION
585  NAMD_die("QM forces are not supported in memory-optimized builds.");
586 #endif
587 
588 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
589  NAMD_die("QM forces are not compatible with CUDA at this time");
590 #endif
591 
592  molecule->set_qm_replaceAll(simParameters->qmReplaceAll);
593 
594  if (simParameters->qmParamPDBDefined)
595  molecule->prepare_qm(simParameters->qmParamPDB,
596  parameters, configList);
597  else if (pdbFilename)
598  molecule->prepare_qm(pdbFilename,
599  parameters, configList);
600  else
601  molecule->prepare_qm(configList->find("coordinates")->data,
602  parameters, configList);
603 
604  }
605 
606 
607  if (simParameters->LJcorrection) {
608  molecule->compute_LJcorrection();
609  } else if (simParameters->LJcorrectionAlt) {
611  }
612 #endif
613 
614  // JLai checks to see if Go Forces are turned on
615  if (simParameters->goForcesOn) {
616 #ifdef MEM_OPT_VERSION
617  NAMD_die("Go forces are not supported in memory-optimized builds.");
618 #else
619  StringList *moleculeFilename = configList->find("structure");
620  StringList *parameterFilename = configList->find("parameters");
621  StringList *goFilename = configList->find("goParameters");
622  StringList *goStructureFilename = configList->find("goCoordinates");
623 
624  // Added by JLai -- 1.10.12 -- Code to build the Go parameters (from within the Go molecule instead of the parameters object)
625  molecule->build_go_params(goFilename);
626  // Added by JLai -- 6.3.11 -- flag to switch between the different goMethodologies
627  int goMethod = simParameters->goMethod;
628  if (goMethod == 1) { // should probably replace with switch statement
629  iout << iINFO << "Using Go method matrix\n" << endi;
630  molecule->build_go_sigmas(goStructureFilename, NULL);
631  } else if (goMethod == 2) {
632  iout << iINFO << "Using Go method jump table\n" << endi;
633  molecule->build_go_sigmas2(goStructureFilename, NULL);
634  } else if (goMethod == 3) {
635  iout << iINFO << "Using Go method lowmem\n" << endi;
636  molecule->build_go_arrays(goStructureFilename, NULL);
637  } else {
638  NAMD_die("Failed to read goMethod variable in NamdState.C");
639  }
640 #endif
641  }
642  // End of Go code -- JLai
643 
644 #ifndef MEM_OPT_VERSION
645  iout << iINFO << "****************************\n";
646  iout << iINFO << "STRUCTURE SUMMARY:\n";
647  iout << iINFO << molecule->numAtoms << " ATOMS\n";
648  iout << iINFO << molecule->numBonds << " BONDS\n";
649  iout << iINFO << molecule->numAngles << " ANGLES\n";
650  iout << iINFO << molecule->numDihedrals << " DIHEDRALS\n";
651  iout << iINFO << molecule->numImpropers << " IMPROPERS\n";
652  iout << iINFO << molecule->numCrossterms << " CROSSTERMS\n";
653  iout << iINFO << molecule->numExclusions << " EXCLUSIONS\n";
654 
655  //****** BEGIN CHARMM/XPLOR type changes
656  if ((molecule->numMultipleDihedrals) && (simParameters->paraTypeXplorOn))
657  {
658  iout << iINFO << molecule->numMultipleDihedrals
659  << " DIHEDRALS WITH MULTIPLE PERIODICITY (BASED ON PSF FILE)\n";
660  }
661  if ((molecule->numMultipleDihedrals) && (simParameters->paraTypeCharmmOn))
662  {
663  iout << iINFO << molecule->numMultipleDihedrals
664  << " DIHEDRALS WITH MULTIPLE PERIODICITY IGNORED (BASED ON PSF FILE) \n";
665  iout << iINFO
666  << " CHARMM MULTIPLICITIES BASED ON PARAMETER FILE INFO! \n";
667  }
668  //****** END CHARMM/XPLOR type changes
669 
670  if (molecule->numMultipleImpropers)
671  {
672  iout << iINFO << molecule->numMultipleImpropers
673  << " IMPROPERS WITH MULTIPLE PERIODICITY\n";
674  }
675 
676  if (simParameters->constraintsOn)
677  {
678  iout << iINFO << molecule->numConstraints << " CONSTRAINTS\n";
679  }
680 
681  if (simParameters->consForceOn)
682  iout << iINFO << molecule->numConsForce << " CONSTANT FORCES\n";
683 
684  if (simParameters->stirOn)
685  iout << iINFO << molecule->numStirredAtoms << " STIRRED ATOMS\n";
686 
687  if (simParameters->fixedAtomsOn)
688  {
689  iout << iINFO << molecule->numFixedAtoms << " FIXED ATOMS\n";
690  }
691 
692  if (simParameters->rigidBonds)
693  {
694  iout << iINFO << molecule->numRigidBonds << " RIGID BONDS\n";
695  }
696 
697  if (simParameters->fixedAtomsOn && simParameters->rigidBonds)
698  {
699  iout << iINFO << molecule->numFixedRigidBonds <<
700  " RIGID BONDS BETWEEN FIXED ATOMS\n";
701  }
702 
703  /* BEGIN gf */
704  if (simParameters->mgridforceOn)
705  {
706  int i;
707  iout << iINFO << molecule->numGridforceGrids
708  << " GRIDS ACTIVE\n";
709  }
710  /* END gf */
711 
712 //Modifications for alchemical fep
713  if (simParameters->alchOn) {
714  iout << iINFO << "ALCH: "
715  << molecule->numFepInitial <<
716  " ATOMS TO DISAPPEAR IN FINAL STATE\n";
717  iout << iINFO << "ALCH: "
718  << molecule->numFepFinal <<
719  " ATOMS TO APPEAR IN FINAL STATE\n";
720  if (molecule->suspiciousAlchBonds) {
721  iout << iWARN << "ALCH: SUSPICIOUS BONDS BETWEEN INITIAL AND " <<
722  "FINAL GROUPS WERE FOUND" << "\n" << endi;
723  }
724  if (molecule->alchDroppedAngles) {
725  iout << iINFO << "ALCH: "
726  << molecule->alchDroppedAngles <<
727  " ANGLES LINKING INITIAL AND FINAL ATOMS DELETED\n";
728  }
729  if (molecule->alchDroppedDihedrals) {
730  iout << iINFO << "ALCH: "
731  << molecule->alchDroppedDihedrals <<
732  " DIHEDRALS LINKING INITIAL AND FINAL ATOMS DELETED\n";
733  }
734  if (molecule->alchDroppedImpropers) {
735  iout << iINFO << "ALCH: "
736  << molecule->alchDroppedImpropers <<
737  " IMPROPERS LINKING INITIAL AND FINAL ATOMS DELETED\n";
738  }
739  }
740 //fepe
741 
742  if (simParameters->lesOn) {
743  iout << iINFO << molecule->numFepInitial <<
744  " LOCALLY ENHANCED ATOMS ENABLED\n";
745  }
746 
747  if (simParameters->soluteScalingOn) {
748  iout << iINFO << " SOLUTE SCALING ENABLED\n";
749  }
750 
751  if (simParameters->pairInteractionOn) {
752  iout << iINFO << "PAIR INTERACTION GROUP 1 CONTAINS "
753  << molecule->numFepInitial << " ATOMS\n";
754  if (!simParameters->pairInteractionSelf) {
755  iout << iINFO << "PAIR INTERACTION GROUP 2 CONTAINS "
756  << molecule->numFepFinal << " ATOMS\n";
757  }
758  }
759 
760 #if 1
761  if (molecule->numLonepairs != 0) {
762  iout << iINFO << molecule->numLonepairs << " LONE PAIRS\n";
763  }
764  if (molecule->numDrudeAtoms != 0) {
765  iout << iINFO << molecule->numDrudeAtoms << " DRUDE ATOMS\n";
766  }
767  iout << iINFO << molecule->num_deg_freedom(1)
768  << " DEGREES OF FREEDOM\n";
769  if (simParameters->drudeOn) {
770  int g_bond = 3 * molecule->numDrudeAtoms;
771  int g_com = molecule->num_deg_freedom(1) - g_bond;
772  iout << iINFO << g_com << " DRUDE COM DEGREES OF FREEDOM\n";
773  iout << iINFO << g_bond << " DRUDE BOND DEGREES OF FREEDOM\n";
774  }
775 #endif
776 #if 0
777  {
778  // Copied from Controller::printEnergies()
779  int64 numAtoms = molecule->numAtoms;
780  int64 numDegFreedom = 3 * numAtoms;
781  int numLonepairs = molecule->numLonepairs;
782  int numFixedAtoms = molecule->numFixedAtoms;
783  if ( numFixedAtoms ) numDegFreedom -= 3 * numFixedAtoms;
784  if ( ! ( numFixedAtoms || molecule->numConstraints
785  || simParameters->comMove || simParameters->langevinOn ) ) {
786  numDegFreedom -= 3;
787  }
788  if (numLonepairs) numDegFreedom -= 3 * numLonepairs;
789  int numRigidBonds = molecule->numRigidBonds;
790  int numFixedRigidBonds = molecule->numFixedRigidBonds;
791  // numLonepairs is subtracted here because all lonepairs have a rigid bond
792  // to oxygen, but all of the LP degrees of freedom are dealt with above
793  numDegFreedom -= ( numRigidBonds - numFixedRigidBonds - numLonepairs);
794  iout << iINFO << numDegFreedom << " DEGREES OF FREEDOM\n";
795  }
796 #endif
797 
798  iout << iINFO << molecule->numHydrogenGroups << " HYDROGEN GROUPS\n";
799  iout << iINFO << molecule->maxHydrogenGroupSize
800  << " ATOMS IN LARGEST HYDROGEN GROUP\n";
801  iout << iINFO << molecule->numMigrationGroups << " MIGRATION GROUPS\n";
802  iout << iINFO << molecule->maxMigrationGroupSize
803  << " ATOMS IN LARGEST MIGRATION GROUP\n";
804  if (simParameters->fixedAtomsOn)
805  {
806  iout << iINFO << molecule->numFixedGroups <<
807  " HYDROGEN GROUPS WITH ALL ATOMS FIXED\n";
808  }
809 
810  {
811  BigReal totalMass = 0;
812  BigReal totalCharge = 0;
813  int i;
814  for ( i = 0; i < molecule->numAtoms; ++i ) {
815  totalMass += molecule->atommass(i);
816  totalCharge += molecule->atomcharge(i);
817  }
818  iout << iINFO << "TOTAL MASS = " << totalMass << " amu\n";
819  iout << iINFO << "TOTAL CHARGE = " << totalCharge << " e\n";
820 
821  BigReal volume = lattice.volume();
822  if ( volume ) {
823  iout << iINFO << "MASS DENSITY = "
824  << ((totalMass/volume) / 0.6022) << " g/cm^3\n";
825  iout << iINFO << "ATOM DENSITY = "
826  << (molecule->numAtoms/volume) << " atoms/A^3\n";
827  }
828  }
829 
830  iout << iINFO << "*****************************\n";
831  iout << endi;
832  fflush(stdout);
833 
834  StringList *binCoordinateFilename = configList->find("bincoordinates");
835  if ( binCoordinateFilename && ! reload ) {
836  read_binary_coors(binCoordinateFilename->data, pdb);
837  }
838 
839  DebugM(4, "::configFileInit() - printing Molecule Information\n");
840 
841  molecule->print_atoms(parameters);
842  molecule->print_bonds(parameters);
843  molecule->print_exclusions();
844  fflush(stdout);
845 #endif
846 
847  DebugM(4, "::configFileInit() - done printing Molecule Information\n");
848  DebugM(1, "::configFileInit() - done\n");
849 
850  return(0);
851 }
Real atomcharge(int anum) const
Definition: Molecule.h:1117
int numFixedGroups
Definition: Molecule.h:637
void build_gridforce_params(StringList *, StringList *, StringList *, StringList *, PDB *, char *)
Definition: Molecule.C:6534
int suspiciousAlchBonds
Definition: Molecule.h:591
DCDParams dcdSelectionParams[16]
Definition: Molecule.h:481
std::ostream & iINFO(std::ostream &s)
Definition: InfoStream.C:81
int frequency
Definition: common.h:262
Definition: PDB.h:36
int alchDroppedDihedrals
Definition: Molecule.h:593
int numBonds
Definition: Molecule.h:588
void print_bonds(Parameters *)
Definition: Molecule.C:5521
Bool monteCarloPressureOn
void build_extra_bonds(Parameters *parameters, StringList *file)
void print_exclusions()
Definition: Molecule.C:5558
int numHydrogenGroups
Definition: Molecule.h:633
molfile_plugin_t * getPlugin()
Definition: PluginIOMgr.h:22
static void exit(int status=0)
Definition: BackEnd.C:277
Definition: Vector.h:72
Bool excludeFromPressure
static int numatoms
Definition: ScriptTcl.C:65
int alchDroppedImpropers
Definition: Molecule.h:594
#define DebugM(x, y)
Definition: Debug.h:75
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
void build_molecule()
Definition: Molecule.C:3291
int numGridforceGrids
Definition: Molecule.h:624
std::ostream & iWARN(std::ostream &s)
Definition: InfoStream.C:82
void freeOccupancyData()
Definition: Molecule.h:1099
#define iout
Definition: InfoStream.h:51
int num_atoms(void)
Definition: PDB.C:323
Bool pairInteractionOn
Molecule stores the structural information for the system.
Definition: Molecule.h:175
void build_go_arrays(StringList *, char *)
Definition: GoMolecule.C:951
int numFepFinal
Definition: Molecule.h:642
BigReal vdwscale14
void print_param_summary()
Definition: Parameters.C:6478
void build_langevin_params(BigReal coupling, BigReal drudeCoupling, Bool doHydrogen)
int numMultipleImpropers
Definition: Molecule.h:671
int numMultipleDihedrals
Definition: Molecule.h:669
int numLonepairs
Number of lone pairs.
Definition: Molecule.h:609
const float * getBFactorData()
Definition: Molecule.h:1101
void NAMD_bug(const char *err_msg)
Definition: common.C:195
void compute_LJcorrection_alternative()
void read_binary_coors(char *fname, PDB *pdbobj)
Definition: NamdOneTools.C:34
int numFixedRigidBonds
Definition: Molecule.h:639
BigReal langevinDamping
void build_constraint_params(StringList *, StringList *, StringList *, PDB *, char *)
GoChoices goMethod
void build_constorque_params(StringList *, StringList *, StringList *, StringList *, StringList *, StringList *, PDB *, char *)
int numFepInitial
Definition: Molecule.h:641
void set_qm_replaceAll(Bool newReplaceAll)
Definition: Molecule.h:851
int numFixedAtoms
Definition: Molecule.h:630
void prepare_qm(const char *pdbFileName, Parameters *params, ConfigList *cfgList)
Definition: MoleculeQM.C:110
NAMD_HOST_DEVICE BigReal volume(void) const
Definition: Lattice.h:293
int numAngles
Definition: Molecule.h:589
void build_stirred_atoms(StringList *, StringList *, PDB *, char *)
const float * getOccupancyData()
Definition: Molecule.h:1097
int numAtoms
Definition: Molecule.h:585
int numStirredAtoms
Definition: Molecule.h:631
int numCrossterms
Definition: Molecule.h:596
void NAMD_die(const char *err_msg)
Definition: common.C:147
int numConsForce
Definition: Molecule.h:645
Real atommass(int anum) const
Definition: Molecule.h:1107
void build_ss_flags(const StringList *ssfile, const StringList *sscol, PDB *initial_pdb, const char *cwd)
void build_rotdrag_params(StringList *, StringList *, StringList *, StringList *, StringList *, StringList *, PDB *, char *)
int maxMigrationGroupSize
Definition: Molecule.h:636
int numDihedrals
Definition: Molecule.h:590
void build_fep_flags(StringList *, StringList *, PDB *, char *, const char *)
int numImpropers
Definition: Molecule.h:595
int numConstraints
Definition: Molecule.h:622
void build_alch_unpert_bond_lists(char *)
void compress_molecule_info(Molecule *mol, char *psfFileName, Parameters *param, SimParameters *simParam, ConfigList *cfgList)
Definition: CompressPsf.C:436
void build_fixed_atoms(StringList *, StringList *, PDB *, char *)
void compute_LJcorrection()
int pressureProfileAtomTypes
void print_atoms(Parameters *)
Definition: Molecule.C:5475
int maxHydrogenGroupSize
Definition: Molecule.h:634
char * data
Definition: ConfigList.h:48
int numMigrationGroups
Definition: Molecule.h:635
void build_go_sigmas(StringList *, char *)
Definition: GoMolecule.C:578
void delete_alch_bonded(void)
int64_t num_deg_freedom(int isInitialReport=0) const
Definition: Molecule.h:552
void build_exPressure_atoms(StringList *, StringList *, PDB *, char *)
Bool pairInteractionSelf
void build_constant_forces(char *)
Bool qmParamPDBDefined
Ambertoppar readparm(const char *filename)
int numDrudeAtoms
Number of Drude particles.
Definition: Molecule.h:610
int alchDroppedAngles
Definition: Molecule.h:592
StringList * find(const char *name) const
Definition: ConfigList.C:341
void build_movdrag_params(StringList *, StringList *, StringList *, PDB *, char *)
char qmParamPDB[NAMD_FILENAME_BUFFER_SIZE]
BigReal drudeDamping
int readparm(char *)
Definition: parm.C:151
int numRigidBonds
Definition: Molecule.h:638
int64_t int64
Definition: common.h:39
void freeBFactorData()
Definition: Molecule.h:1103
double BigReal
Definition: common.h:123
void parse_dcd_selection_params(ConfigList *configList)
void build_go_params(StringList *)
Definition: GoMolecule.C:80
void build_go_sigmas2(StringList *, char *)
Definition: GoMolecule.C:748
int numExclusions
Definition: Molecule.h:599

◆ runController()

void NamdState::runController ( void  )

Definition at line 83 of file NamdState.C.

References Controller::run().

Referenced by Node::run().

84 {
85  controller->run();
86 }
void run(void)
Definition: Controller.C:341

◆ status()

int NamdState::status ( )

Definition at line 48 of file NamdState.C.

References DebugM.

49 {
50  int ret=0;
51  if (configList != NULL) {
52  DebugM(1, "Config List exists\n");
53  } else ret++;
54 
55  if (simParameters != NULL) {
56  DebugM(1, "SimParameters exists\n");
57  }
58  else ret++;
59 
60  if (parameters != NULL) {
61  DebugM(1,"Parameters exists\n");
62  }
63  else ret++;
64 
65  if (molecule != NULL) {
66  DebugM(1, "Molecule exists\n");
67  }
68  else ret++;
69 
70  if (pdb != NULL) {
71  DebugM(1,"PDB exists \n");
72  }
73  else ret++;
74 
75  return(ret);
76 }
#define DebugM(x, y)
Definition: Debug.h:75

◆ useController()

void NamdState::useController ( Controller controllerPtr)

Definition at line 78 of file NamdState.C.

79 {
80  controller=controllerPtr;
81 }

Friends And Related Function Documentation

◆ Controller

friend class Controller
friend

Definition at line 25 of file NamdState.h.

◆ Namd

friend class Namd
friend

Definition at line 23 of file NamdState.h.

◆ Node

friend class Node
friend

Definition at line 24 of file NamdState.h.

◆ ScriptTcl

friend class ScriptTcl
friend

Definition at line 45 of file NamdState.h.


The documentation for this class was generated from the following files: