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 ( void  )

Definition at line 35 of file NamdState.C.

36 {
37  configList = NULL;
38  simParameters = NULL;
39  parameters = NULL;
40  molecule = NULL;
41  pdb = NULL;
42 }
NamdState::~NamdState ( )
inline

Definition at line 43 of file NamdState.h.

43 {}

Member Function Documentation

int NamdState::configFileInit ( char *  )
int NamdState::configListInit ( ConfigList cfgList)

Definition at line 124 of file NamdState.C.

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

124  {
125  configList = cfgList;
126  if (!configList->okay()) {
127  NAMD_die("Simulation config file is incomplete or contains errors.");
128  }
129  DebugM(1,"NamdState::configFileInit configList okay\n");
130 
131  char *currentdir = 0;
132  simParameters = new SimParameters(configList,currentdir);
133  fflush(stdout);
134  lattice = simParameters->lattice;
135 
136  //Check features that are not supported in the memory optimized
137  //version. --Chao Mei
138 #ifdef MEM_OPT_VERSION
139  checkMemOptCompatibility();
140 #endif
141 
142  //Check rigidBonds type when generating the compressed psf files.
143  if(simParameters->genCompressedPsf) {
144  if(simParameters->rigidBonds == RIGID_NONE){
145  //default to RIGID_ALL
146  simParameters->rigidBonds = RIGID_ALL;
147  }
148  }
149 
150  return loadStructure(0,0,0);
151 }
#define DebugM(x, y)
Definition: Debug.h:59
int loadStructure(const char *, const char *, int)
Definition: NamdState.C:153
void NAMD_die(const char *err_msg)
Definition: common.C:85
#define RIGID_ALL
Definition: SimParameters.h:78
Bool okay(void)
Definition: ConfigList.h:120
#define RIGID_NONE
Definition: SimParameters.h:77
const Controller& NamdState::getController ( ) const
inline

Definition at line 51 of file NamdState.h.

51  {
52  return (*controller);
53  }
int NamdState::loadStructure ( const char *  molFilename,
const char *  pdbFilename,
int  reload 
)

Definition at line 153 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_movdrag_params(), Molecule::build_rotdrag_params(), Molecule::build_ss_flags(), Molecule::build_stirred_atoms(), SimParameters::comMove, compress_molecule_info(), Molecule::compute_LJcorrection(), SimParameters::consForceOn, SimParameters::consTorqueOn, SimParameters::constraintsOn, StringList::data, DebugM, Molecule::delete_alch_bonded(), SimParameters::drudeDamping, SimParameters::drudeOn, endi(), SimParameters::excludeFromPressure, BackEnd::exit(), SimParameters::extraBondsOn, ConfigList::find(), SimParameters::fixedAtomsOn, Molecule::freeBFactorData(), Molecule::freeOccupancyData(), 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, Molecule::maxHydrogenGroupSize, Molecule::maxMigrationGroupSize, SimParameters::mgridforceOn, SimParameters::minimizeCGOn, 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::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(), parm::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().

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

Definition at line 80 of file NamdState.C.

References Controller::run().

Referenced by Node::run().

81 {
82  controller->run();
83 }
void run(void)
Definition: Controller.C:268
int NamdState::status ( )

Definition at line 45 of file NamdState.C.

References DebugM.

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

Definition at line 75 of file NamdState.C.

76 {
77  controller=controllerPtr;
78 }

Friends And Related Function Documentation

friend class Controller
friend

Definition at line 25 of file NamdState.h.

friend class Namd
friend

Definition at line 23 of file NamdState.h.

friend class Node
friend

Definition at line 24 of file NamdState.h.

friend class ScriptTcl
friend

Definition at line 45 of file NamdState.h.


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