NamdState Class Reference

#include <NamdState.h>

List of all members.

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 34 of file NamdState.C.

00035 {
00036     configList = NULL;
00037     simParameters = NULL;
00038     parameters = NULL;
00039     molecule = NULL;
00040     pdb = NULL;
00041 }

NamdState::~NamdState (  )  [inline]

Definition at line 43 of file NamdState.h.

00043 {}


Member Function Documentation

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

Definition at line 123 of file NamdState.C.

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

00123                                                  {
00124   configList = cfgList;
00125   if (!configList->okay()) {
00126     NAMD_die("Simulation config file is incomplete or contains errors.");
00127   }
00128   DebugM(1,"NamdState::configFileInit configList okay\n");
00129 
00130   char *currentdir = 0;
00131   simParameters =  new SimParameters(configList,currentdir);
00132   fflush(stdout);
00133   lattice = simParameters->lattice;
00134 
00135  //Check features that are not supported in the memory optimized 
00136  //version.  --Chao Mei
00137 #ifdef MEM_OPT_VERSION
00138   checkMemOptCompatibility();
00139 #endif
00140 
00141   //Check rigidBonds type when generating the compressed psf files.
00142   if(simParameters->genCompressedPsf) {
00143       if(simParameters->rigidBonds == RIGID_NONE){
00144           //default to RIGID_ALL
00145           simParameters->rigidBonds = RIGID_ALL;
00146       }
00147   }
00148 
00149   return loadStructure(0,0,0);
00150 }

const Controller& NamdState::getController (  )  const [inline]

Definition at line 51 of file NamdState.h.

00051                                             {
00052         return (*controller);
00053     }

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

Definition at line 152 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, 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::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(), 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().

00152                                                                                          {
00153 
00154   StringList *molInfoFilename;
00155   // If it's AMBER force field, read the AMBER style files;
00156   // if it's GROMACS, read the GROMACS files;
00157   // Otherwise read the CHARMM style files
00158 
00159   if (simParameters->amberOn) {
00160     if ( reload ) NAMD_die("Molecular structure reloading not supported for Amber input files.\n");
00161     StringList *parmFilename = configList->find("parmfile");
00162     molInfoFilename = parmFilename;
00163     StringList *coorFilename = configList->find("ambercoor");
00164     // "amber" is a temporary data structure, which records all
00165     // the data from the parm file. After copying them into
00166     // molecule, parameter and pdb structures, it will be deleted.
00167     Ambertoppar *amber;
00168     amber = new Ambertoppar;
00169     if (amber->readparm(parmFilename->data))
00170     { parameters = new Parameters(amber, simParameters->vdwscale14);
00171       molecule = new Molecule(simParameters, parameters, amber);
00172       if (coorFilename != NULL)
00173         pdb = new PDB(coorFilename->data,amber);
00174       delete amber;
00175     }
00176     else
00177       NAMD_die("Failed to read AMBER parm file!");
00178     parameters->print_param_summary();
00179   }
00180   else if (simParameters->gromacsOn) {
00181     if ( reload ) NAMD_die("Molecular structure reloading not supported for Gromacs input files.\n");
00182     StringList *topFilename = configList->find("grotopfile");
00183     molInfoFilename = topFilename;
00184     StringList *coorFilename = configList->find("grocoorfile");
00185     // "gromacsFile" is a temporary data structure, which records all
00186     // the data from the topology file. After copying it into the
00187     // molecule and parameter and pdb, it will be deleted.
00188     GromacsTopFile *gromacsFile;
00189     gromacsFile = new GromacsTopFile(topFilename->data);
00190     parameters = new Parameters(gromacsFile,simParameters->minimizeCGOn);
00191     if (coorFilename != NULL)
00192       pdb = new PDB(coorFilename->data,gromacsFile);
00193 
00194     molecule = new Molecule(simParameters, parameters, gromacsFile);
00195     // XXX does Molecule(needAll,these,arguments)?
00196 
00197     delete gromacsFile; // XXX unimplemented
00198 
00199     // XXX add error handling when the file doesn't exist
00200     // XXX make sure the right things happen when the parameters are
00201     // not even specified.
00202     // NAMD_die("Failed to read AMBER parm file!");
00203     parameters->print_param_summary();
00204   }
00205   else if (simParameters->usePluginIO){
00206 #ifdef MEM_OPT_VERSION          
00207         NAMD_die("Using plugin IO is not supported in memory optimized version!");
00208 #else    
00209     if ( pdbFilename ) {
00210       NAMD_bug("NamdState::loadStructure pdbFilename non-null with usePluginIO\n");
00211     }
00212 
00213     PluginIOMgr *pIOMgr = new PluginIOMgr();
00214     
00215     iout << iWARN << "Plugin-based I/O is still in development and may still have bugs\n" << endi;
00216 
00217     molfile_plugin_t *pIOHandle = pIOMgr->getPlugin();
00218     if (pIOHandle == NULL) {
00219         NAMD_die("ERROR: Failed to match requested plugin type");
00220     }
00221     if ( pIOHandle->open_file_read == NULL )
00222        NAMD_die("ERROR: Selected plugin type cannot open files"); 
00223     if ( pIOHandle->read_structure == NULL )
00224        NAMD_die("ERROR: Selected plugin type cannot read structures"); 
00225     if ( pIOHandle->read_next_timestep == NULL )
00226        NAMD_die("ERROR: Selected plugin type cannot read coordinates"); 
00227 
00228     StringList *moleculeFilename = configList->find("structure");
00229     molInfoFilename = moleculeFilename;
00230     if ( ! molFilename ) molFilename = moleculeFilename->data;
00231   if ( ! reload ) {
00232     StringList *parameterFilename = configList->find("parameters");
00233     //****** BEGIN CHARMM/XPLOR type changes
00234     // For AMBER use different constructor based on parm_struct!!!  -JCP
00235     parameters = new Parameters(simParameters, parameterFilename);
00236     parameters->print_param_summary();
00237   }
00238 
00239     int numAtoms = 0;
00240     //TODO: not sure about the name field in the handler
00241     void *plgFile = pIOHandle->open_file_read(molFilename, 
00242                                               pIOHandle->name, &numAtoms);
00243     if(plgFile ==  NULL) {
00244         NAMD_die("ERROR: Opening structure file failed!");
00245     }
00246 
00247     double fileReadTime = CmiWallTimer();
00248     molecule = new Molecule(simParameters, parameters, pIOHandle, plgFile, numAtoms);
00249     iout << iINFO << "TIME FOR LOAD MOLECULE STRUCTURE INFORMATION: " << CmiWallTimer() - fileReadTime << "\n" << endi;
00250 
00251     /* If we are only generating compressed molecule information, the PDB object is not needed */
00252     if(!simParameters->genCompressedPsf) {        
00253         fileReadTime = CmiWallTimer();
00254         //get the occupancy data from the Molecule object and then free it
00255         //as it is stored in the Molecule object.
00256         pdb = new PDB(pIOHandle, plgFile, molecule->numAtoms, molecule->getOccupancyData(), molecule->getBFactorData());
00257         molecule->freeOccupancyData();
00258         molecule->freeBFactorData();
00259         iout << iINFO << "TIME FOR LOADING ATOMS' COORDINATES INFORMATION: " << CmiWallTimer() - fileReadTime << "\n" << endi;
00260     }
00261 
00262     pIOHandle->close_file_read(plgFile);
00263     delete pIOMgr;
00264 #endif    
00265   }
00266   else
00267   { 
00268     StringList *moleculeFilename = configList->find("structure");
00269     molInfoFilename = moleculeFilename; 
00270     if ( ! molFilename ) molFilename = moleculeFilename->data;
00271   if ( ! reload ) {
00272     StringList *parameterFilename = configList->find("parameters");
00273     //****** BEGIN CHARMM/XPLOR type changes
00274     // For AMBER use different constructor based on parm_struct!!!  -JCP
00275     parameters = new Parameters(simParameters, parameterFilename);
00276     //****** END CHARMM/XPLOR type changes    
00277 
00278     parameters->print_param_summary();
00279   }
00280 
00281     double fileReadTime = CmiWallTimer();
00282     molecule = new Molecule(simParameters, parameters, (char*)molFilename, configList);
00283     iout << iINFO << "TIME FOR READING PSF FILE: " << CmiWallTimer() - fileReadTime << "\n" << endi;
00284 }
00285 
00286   fflush(stdout);
00287 
00288 #ifdef MEM_OPT_VERSION
00289   //upon knowing the number of atoms, it's good time to estimate the number of
00290   //input/output processors if their value is not set
00291   if(simParameters->numinputprocs==0){
00292     int numatoms = molecule->numAtoms;
00293     long estval = (sizeof(InputAtom)+2*sizeof(int)+1)*((long)(numatoms));
00294     int numprocs = estval>>26; //considering every input proc consumes about 64M.
00295     if(numprocs==0){
00296         numprocs=1;
00297     }else if(numprocs>CkNumPes()){
00298         numprocs=CkNumPes();
00299     }
00300     simParameters->numinputprocs=numprocs;
00301   }
00302   if(simParameters->numoutputprocs==0){
00303     int numatoms = molecule->numAtoms;
00304     long estval = (sizeof(Vector)*2)*((long)(numatoms));
00305     int numprocs = estval>>26; //considering every input proc consumes about 64M.
00306     if(numprocs==0){
00307       numprocs=1;
00308     }else if(numprocs>CkNumPes()){
00309       numprocs=CkNumPes();
00310     }
00311     simParameters->numoutputprocs=numprocs;    
00312   }
00313   //check the number of output procs that simultaneously write to a file
00314   if(simParameters->numoutputwrts > simParameters->numoutputprocs) {
00315       simParameters->numoutputwrts = simParameters->numoutputprocs;
00316   }
00317 
00318   if (simParameters->fixedAtomsOn){
00319       double fileReadTime = CmiWallTimer();
00320       molecule->load_fixed_atoms(configList->find("fixedAtomListFile"));
00321       iout << iINFO << "TIME FOR READING FIXED ATOMS FILE: " << CmiWallTimer() - fileReadTime << "\n" << endi;
00322   }
00323 
00324   if (simParameters->constraintsOn){
00325       double fileReadTime = CmiWallTimer();
00326       molecule->load_constrained_atoms(configList->find("consAtomListFile"));
00327       iout << iINFO << "TIME FOR READING CONSTRAINED ATOMS FILE: " << CmiWallTimer() - fileReadTime << "\n" << endi;
00328   }
00329 #else
00330   if (simParameters->extraBondsOn) {        
00331     //The extra bonds building will be executed in read_compressed_psf in
00332     //the memory optimized version, so avoid calling this function in the 
00333     //memory optimized run.
00334     if(!simParameters->useCompressedPsf)
00335       molecule->build_extra_bonds(parameters, configList->find("extraBondsFile"));         
00336   }
00337   if(simParameters->genCompressedPsf) {
00338       double fileReadTime = CmiWallTimer();
00339       compress_molecule_info(molecule, molInfoFilename->data, parameters, simParameters, configList);
00340       iout << "Finished compressing molecule information, which takes " << CmiWallTimer()-fileReadTime <<"(s)\n"<<endi;
00341       BackEnd::exit();
00342   }
00343 
00344   //If using plugin-based IO, the PDB object is already created!
00345   StringList *coordinateFilename = NULL;
00346   if(!simParameters->usePluginIO) {
00347       //In the memory opt version, the coordinates of atoms
00348       //are read during startup in parallel with a bincoordinates input
00349       //-Chao Mei
00350       double fileReadTime = CmiWallTimer();
00351       if ( pdbFilename ) {
00352         iout << iINFO << "Reading pdb file " << pdbFilename << "\n" << endi;
00353         pdb = new PDB(pdbFilename);
00354       } else {
00355         coordinateFilename = configList->find("coordinates");    
00356         if (coordinateFilename != NULL) {
00357           iout << iINFO << "Reading pdb file " << coordinateFilename->data << "\n" << endi;
00358           pdb = new PDB(coordinateFilename->data);
00359         }
00360       }
00361       if (pdb->num_atoms() != molecule->numAtoms) {
00362         NAMD_die("Number of pdb and psf atoms are not the same!");
00363       }
00364       iout << iINFO << "TIME FOR READING PDB FILE: " << CmiWallTimer() - fileReadTime << "\n" << endi;
00365       iout << iINFO << "\n" << endi;
00366   }
00367 
00368         //  If constraints are active, build the parameters necessary
00369         if (simParameters->constraintsOn)
00370         {
00371            StringList *consRefFile = configList->find("consref");
00372            StringList *consKFile = configList->find("conskfile");
00373 
00374           if (coordinateFilename != NULL) {
00375            if(strcasecmp(coordinateFilename->data, consRefFile->data)==0)
00376                 consRefFile = NULL;
00377            if(strcasecmp(coordinateFilename->data, consKFile->data)==0)
00378                 consKFile = NULL;
00379           }
00380 
00381            molecule->build_constraint_params(consRefFile, consKFile,
00382                                              configList->find("conskcol"),
00383                                              pdb,
00384                                              NULL);
00385         }
00386 #endif
00387         //CkPrintf ("DEBUG--check if StirOn to build stir params..\n");
00388 
00389         if (simParameters->stirOn)
00390         {       
00391         //CkPrintf ("DEBUG--now to build stir params..\n");
00392           
00393            molecule->build_stirred_atoms(configList->find("stirFilename"),
00394                                        configList->find("stirredAtomsCol"),
00395                                        pdb,
00396                                        NULL);
00397         }
00398 
00399 
00400 #ifndef MEM_OPT_VERSION
00401         if (simParameters->fixedAtomsOn)
00402         {
00403            molecule->build_fixed_atoms(configList->find("fixedatomsfile"),
00404                                         configList->find("fixedatomscol"),
00405                                         pdb,
00406                                         NULL);
00407         }
00408 #endif
00409         
00410         /* BEGIN gf */
00411         if (simParameters->mgridforceOn)
00412         {
00413             molecule->build_gridforce_params(configList->find("gridforcefile"),
00414                                              configList->find("gridforcecol"),
00415                                              configList->find("gridforcechargecol"),
00416                                              configList->find("gridforcepotfile"),
00417                                              pdb,
00418                                              NULL);
00419         }
00420         /* END gf */
00421 
00422         // If constant forces are active, read the forces necessary
00423         if (simParameters->consForceOn) {
00424     char *filename = NULL;
00425     if (configList->find("consforcefile"))
00426       filename = configList->find("consforcefile")->data;
00427     molecule->build_constant_forces(filename);
00428   }
00429 
00430         if (simParameters->excludeFromPressure) {
00431            molecule->build_exPressure_atoms(
00432              configList->find("excludeFromPressureFile"),
00433              configList->find("excludeFromPressureCol"),
00434              pdb, NULL);
00435         }
00436 
00437         // If moving drag is active, build the parameters necessary
00438         if (simParameters->movDragOn) {
00439           molecule->build_movdrag_params(configList->find("movDragFile"),
00440                                          configList->find("movDragCol"),
00441                                          configList->find("movDragVelFile"),
00442                                          pdb,
00443                                          NULL);
00444         }
00445 
00446         // If rotating drag is active, build the parameters necessary
00447         if (simParameters->rotDragOn) {
00448           molecule->build_rotdrag_params(configList->find("rotDragFile"),
00449                                          configList->find("rotDragCol"),
00450                                          configList->find("rotDragAxisFile"),
00451                                          configList->find("rotDragPivotFile"),
00452                                          configList->find("rotDragVelFile"),
00453                                          configList->find("rotDragVelCol"),
00454                                          pdb,
00455                                          NULL);
00456         }
00457 
00458         // If "constant" torque is active, build the parameters necessary
00459         if (simParameters->consTorqueOn) {
00460           molecule->build_constorque_params(configList->find("consTorqueFile"),
00461                                        configList->find("consTorqueCol"),
00462                                        configList->find("consTorqueAxisFile"),
00463                                        configList->find("consTorquePivotFile"),
00464                                        configList->find("consTorqueValFile"),
00465                                        configList->find("consTorqueValCol"),
00466                                        pdb,
00467                                        NULL);
00468         }
00469 
00470 #ifndef MEM_OPT_VERSION
00471         //  If langevin dynamics or temperature coupling are active, build 
00472         //  the parameters necessary
00473         if (simParameters->langevinOn)
00474         {
00475           if (simParameters->langevinDamping == 0.0) {
00476             molecule->build_langevin_params(configList->find("langevinfile"),
00477                                             configList->find("langevincol"),
00478                                             pdb,
00479                                             NULL);
00480           } else {
00481             molecule->build_langevin_params(simParameters->langevinDamping,
00482                                             simParameters->drudeDamping,
00483                                             simParameters->langevinHydrogen);
00484           }
00485         }
00486         else if (simParameters->tCoupleOn)
00487         {
00488            //  Temperature coupling uses the same parameters, but with different
00489            //  names . . .
00490            molecule->build_langevin_params(configList->find("tcouplefile"),
00491                                             configList->find("tcouplecol"),
00492                                             pdb,
00493                                             NULL);
00494   }
00495 
00496   // Modifications for alchemical fep
00497   // identify the mutant atoms for fep simulation
00498   if (simParameters->alchOn) {
00499     molecule->build_fep_flags(configList->find("alchfile"),
00500         configList->find("alchcol"), pdb, NULL, "alch" );
00501     molecule->delete_alch_bonded();
00502     if (simParameters->sdScaling) {
00503       if (configList->find("unperturbedBondFile") == NULL) {
00504         NAMD_die("Input file for Shobana's bond terms is required with sdScaling on");
00505       }
00506       molecule->build_alch_unpert_bond_lists(configList->find("unperturbedBondFile")->data);
00507     }
00508   }
00509 //fepe
00510 
00511   if (simParameters->lesOn) {
00512     if (simParameters->alchOn) NAMD_bug("FEP/TI and LES are incompatible!");
00513     molecule->build_fep_flags(configList->find("lesfile"),
00514         configList->find("lescol"), pdb, NULL, "les");
00515   }
00516   if (simParameters->soluteScalingOn) {
00517     molecule->build_ss_flags(configList->find("soluteScalingFile"),
00518         configList->find("soluteScalingCol"), pdb, NULL);
00519   }
00520   if (simParameters->pairInteractionOn) {
00521     molecule->build_fep_flags(configList->find("pairInteractionFile"),
00522         configList->find("pairInteractionCol"), pdb, NULL, "pairInteraction");
00523   }      
00524   if (simParameters->pressureProfileAtomTypes > 1) {
00525     molecule->build_fep_flags(configList->find("pressureProfileAtomTypesFile"),
00526         configList->find("pressureProfileAtomTypesCol"), pdb, NULL,
00527         "pressureProfileAtomTypes");
00528   }
00529 
00530         #ifdef OPENATOM_VERSION
00531         if (simParameters->openatomOn) {
00532           molecules->build_qmmm_flags(configList->find("openatomPdbFile",
00533                 configList->find("openatomPdbCol"), pdb, NULL, "openatomPdb")
00534         }
00535         #endif // OPENATOM_VERSION
00536 
00537         if (simParameters->qmForcesOn){
00538             
00539 #ifdef MEM_OPT_VERSION
00540             NAMD_die("QM forces are not supported in memory-optimized builds.");
00541 #endif
00542             
00543 #ifdef NAMD_CUDA
00544            NAMD_die("QM forces are not compatible with CUDA at this time");
00545 #endif
00546             
00547             molecule->set_qm_replaceAll(simParameters->qmReplaceAll);
00548             
00549             if (simParameters->qmParamPDBDefined)
00550                 molecule->prepare_qm(simParameters->qmParamPDB,
00551                                           parameters, configList);
00552             else if (pdbFilename)
00553                 molecule->prepare_qm(pdbFilename,
00554                                           parameters, configList);
00555             else
00556                 molecule->prepare_qm(configList->find("coordinates")->data,
00557                                           parameters, configList);
00558             
00559         }
00560         
00561         
00562         if (simParameters->LJcorrection) {
00563           molecule->compute_LJcorrection();
00564         }
00565 #endif
00566 
00567         // JLai checks to see if Go Forces are turned on
00568         if (simParameters->goForcesOn) {
00569 #ifdef MEM_OPT_VERSION
00570           NAMD_die("Go forces are not supported in memory-optimized builds.");
00571 #else
00572           StringList *moleculeFilename = configList->find("structure");
00573           StringList *parameterFilename = configList->find("parameters");
00574           StringList *goFilename = configList->find("goParameters");
00575           StringList *goStructureFilename = configList->find("goCoordinates");
00576           
00577           // Added by JLai -- 1.10.12 -- Code to build the Go parameters (from within the Go molecule instead of the parameters object)
00578           molecule->build_go_params(goFilename);
00579           // Added by JLai -- 6.3.11 -- flag to switch between the different goMethodologies
00580           int goMethod = simParameters->goMethod;
00581           if (goMethod == 1) { // should probably replace with switch statement
00582             iout << iINFO << "Using Go method matrix\n" << endi;
00583             molecule->build_go_sigmas(goStructureFilename, NULL);
00584           } else if (goMethod == 2) {
00585             iout << iINFO << "Using Go method jump table\n" << endi;
00586             molecule->build_go_sigmas2(goStructureFilename, NULL);
00587           } else if (goMethod == 3) {
00588             iout << iINFO << "Using Go method lowmem\n" << endi;
00589             molecule->build_go_arrays(goStructureFilename, NULL);
00590           } else {
00591             NAMD_die("Failed to read goMethod variable in NamdState.C");
00592           }
00593 #endif
00594         }
00595         // End of Go code -- JLai
00596 
00597 #ifndef MEM_OPT_VERSION
00598         iout << iINFO << "****************************\n";
00599         iout << iINFO << "STRUCTURE SUMMARY:\n";
00600         iout << iINFO << molecule->numAtoms << " ATOMS\n";
00601         iout << iINFO << molecule->numBonds << " BONDS\n";
00602         iout << iINFO << molecule->numAngles << " ANGLES\n";
00603         iout << iINFO << molecule->numDihedrals << " DIHEDRALS\n";
00604         iout << iINFO << molecule->numImpropers << " IMPROPERS\n";
00605         iout << iINFO << molecule->numCrossterms << " CROSSTERMS\n";
00606         iout << iINFO << molecule->numExclusions << " EXCLUSIONS\n";
00607 
00608         //****** BEGIN CHARMM/XPLOR type changes
00609         if ((molecule->numMultipleDihedrals) && (simParameters->paraTypeXplorOn))
00610         {
00611                 iout << iINFO << molecule->numMultipleDihedrals 
00612              << " DIHEDRALS WITH MULTIPLE PERIODICITY (BASED ON PSF FILE)\n";
00613         }
00614         if ((molecule->numMultipleDihedrals) && (simParameters->paraTypeCharmmOn))
00615         {
00616                 iout << iINFO << molecule->numMultipleDihedrals 
00617          << " DIHEDRALS WITH MULTIPLE PERIODICITY IGNORED (BASED ON PSF FILE) \n";
00618                 iout << iINFO  
00619          << " CHARMM MULTIPLICITIES BASED ON PARAMETER FILE INFO! \n";
00620         }
00621         //****** END CHARMM/XPLOR type changes
00622 
00623         if (molecule->numMultipleImpropers)
00624         {
00625                 iout << iINFO << molecule->numMultipleImpropers 
00626                          << " IMPROPERS WITH MULTIPLE PERIODICITY\n";
00627         }
00628         
00629         if (simParameters->constraintsOn)
00630         {
00631            iout << iINFO << molecule->numConstraints << " CONSTRAINTS\n";
00632         }
00633 
00634         if (simParameters->consForceOn)
00635           iout << iINFO << molecule->numConsForce << " CONSTANT FORCES\n";
00636 
00637         if (simParameters->stirOn)
00638           iout << iINFO << molecule->numStirredAtoms << " STIRRED ATOMS\n";
00639 
00640         if (simParameters->fixedAtomsOn)
00641         {
00642            iout << iINFO << molecule->numFixedAtoms << " FIXED ATOMS\n";
00643         }
00644 
00645         if (simParameters->rigidBonds)
00646         {
00647            iout << iINFO << molecule->numRigidBonds << " RIGID BONDS\n";
00648         }
00649 
00650         if (simParameters->fixedAtomsOn && simParameters->rigidBonds)
00651         {
00652            iout << iINFO << molecule->numFixedRigidBonds <<
00653                         " RIGID BONDS BETWEEN FIXED ATOMS\n";
00654         }
00655         
00656         /* BEGIN gf */
00657         if (simParameters->mgridforceOn)
00658         {
00659             int i;
00660             iout << iINFO << molecule->numGridforceGrids 
00661                  << " GRIDS ACTIVE\n";
00662         }
00663         /* END gf */
00664 
00665 //Modifications for alchemical fep
00666         if (simParameters->alchOn) {
00667           iout << iINFO << "ALCH: " 
00668                << molecule->numFepInitial <<
00669                " ATOMS TO DISAPPEAR IN FINAL STATE\n";
00670            iout << iINFO << "ALCH: " 
00671                <<  molecule->numFepFinal <<
00672                " ATOMS TO APPEAR IN FINAL STATE\n";
00673            if (molecule->suspiciousAlchBonds) {
00674              iout << iWARN << "ALCH: SUSPICIOUS BONDS BETWEEN INITIAL AND " <<
00675              "FINAL GROUPS WERE FOUND" << "\n" << endi;
00676            }
00677            if (molecule->alchDroppedAngles) {
00678              iout << iINFO << "ALCH: " 
00679                  << molecule->alchDroppedAngles <<
00680                  " ANGLES LINKING INITIAL AND FINAL ATOMS DELETED\n";
00681            }
00682            if (molecule->alchDroppedDihedrals) {
00683              iout << iINFO << "ALCH: "
00684                  << molecule->alchDroppedDihedrals <<
00685                  " DIHEDRALS LINKING INITIAL AND FINAL ATOMS DELETED\n";
00686            }
00687            if (molecule->alchDroppedImpropers) {
00688              iout << iINFO << "ALCH: "
00689                  << molecule->alchDroppedImpropers <<
00690                  " IMPROPERS LINKING INITIAL AND FINAL ATOMS DELETED\n";
00691            }
00692         }
00693 //fepe
00694 
00695         if (simParameters->lesOn) {
00696            iout << iINFO << molecule->numFepInitial <<
00697                " LOCALLY ENHANCED ATOMS ENABLED\n";
00698         }
00699 
00700         if (simParameters->soluteScalingOn) {
00701            iout << iINFO << " SOLUTE SCALING ENABLED\n";
00702         }
00703        
00704         if (simParameters->pairInteractionOn) {
00705            iout << iINFO << "PAIR INTERACTION GROUP 1 CONTAINS "
00706                 <<  molecule->numFepInitial << " ATOMS\n";
00707            if (!simParameters->pairInteractionSelf) {
00708              iout << iINFO << "PAIR INTERACTION GROUP 2 CONTAINS "
00709                   <<  molecule->numFepFinal << " ATOMS\n";
00710            }
00711         }
00712            
00713 #if 1
00714         if (molecule->numLonepairs != 0) {
00715           iout << iINFO << molecule->numLonepairs << " LONE PAIRS\n";
00716         }
00717         if (molecule->numDrudeAtoms != 0) {
00718           iout << iINFO << molecule->numDrudeAtoms << " DRUDE ATOMS\n";
00719         }
00720         iout << iINFO << molecule->num_deg_freedom(1)
00721              << " DEGREES OF FREEDOM\n";
00722         if (simParameters->drudeOn) {
00723           int g_bond = 3 * molecule->numDrudeAtoms;
00724           int g_com = molecule->num_deg_freedom(1) - g_bond;
00725           iout << iINFO << g_com << " DRUDE COM DEGREES OF FREEDOM\n";
00726           iout << iINFO << g_bond << " DRUDE BOND DEGREES OF FREEDOM\n";
00727         }
00728 #endif
00729 #if 0
00730         {
00731           // Copied from Controller::printEnergies()
00732           int64 numAtoms = molecule->numAtoms;
00733           int64 numDegFreedom = 3 * numAtoms;
00734     int numLonepairs = molecule->numLonepairs;
00735           int numFixedAtoms = molecule->numFixedAtoms;
00736           if ( numFixedAtoms ) numDegFreedom -= 3 * numFixedAtoms;
00737           if ( ! ( numFixedAtoms || molecule->numConstraints
00738                 || simParameters->comMove || simParameters->langevinOn ) ) {
00739             numDegFreedom -= 3;
00740           }
00741     if (numLonepairs) numDegFreedom -= 3 * numLonepairs;
00742           int numRigidBonds = molecule->numRigidBonds;
00743           int numFixedRigidBonds = molecule->numFixedRigidBonds;
00744     // numLonepairs is subtracted here because all lonepairs have a rigid bond
00745     // to oxygen, but all of the LP degrees of freedom are dealt with above
00746     numDegFreedom -= ( numRigidBonds - numFixedRigidBonds - numLonepairs);
00747           iout << iINFO << numDegFreedom << " DEGREES OF FREEDOM\n";
00748         }
00749 #endif
00750 
00751         iout << iINFO << molecule->numHydrogenGroups << " HYDROGEN GROUPS\n";
00752         iout << iINFO << molecule->maxHydrogenGroupSize
00753                 << " ATOMS IN LARGEST HYDROGEN GROUP\n";
00754         iout << iINFO << molecule->numMigrationGroups << " MIGRATION GROUPS\n";
00755         iout << iINFO << molecule->maxMigrationGroupSize
00756                 << " ATOMS IN LARGEST MIGRATION GROUP\n";
00757         if (simParameters->fixedAtomsOn)
00758         {
00759            iout << iINFO << molecule->numFixedGroups <<
00760                         " HYDROGEN GROUPS WITH ALL ATOMS FIXED\n";
00761         }
00762 
00763         {
00764           BigReal totalMass = 0;
00765           BigReal totalCharge = 0;
00766           int i;
00767           for ( i = 0; i < molecule->numAtoms; ++i ) {
00768             totalMass += molecule->atommass(i);
00769             totalCharge += molecule->atomcharge(i);
00770           }
00771           iout << iINFO << "TOTAL MASS = " << totalMass << " amu\n"; 
00772           iout << iINFO << "TOTAL CHARGE = " << totalCharge << " e\n"; 
00773 
00774           BigReal volume = lattice.volume();
00775           if ( volume ) {
00776             iout << iINFO << "MASS DENSITY = "
00777               << ((totalMass/volume) / 0.6022) << " g/cm^3\n";
00778             iout << iINFO << "ATOM DENSITY = "
00779               << (molecule->numAtoms/volume) << " atoms/A^3\n";
00780           }
00781         }
00782 
00783         iout << iINFO << "*****************************\n";
00784         iout << endi;
00785         fflush(stdout);
00786 
00787   StringList *binCoordinateFilename = configList->find("bincoordinates");
00788   if ( binCoordinateFilename && ! reload ) {
00789     read_binary_coors(binCoordinateFilename->data, pdb);
00790   }
00791 
00792   DebugM(4, "::configFileInit() - printing Molecule Information\n");
00793 
00794   molecule->print_atoms(parameters);
00795   molecule->print_bonds(parameters);
00796   molecule->print_exclusions();
00797   fflush(stdout);
00798 #endif
00799 
00800   DebugM(4, "::configFileInit() - done printing Molecule Information\n");
00801   DebugM(1, "::configFileInit() - done\n");
00802 
00803   return(0);
00804 }

void NamdState::runController ( void   ) 

Definition at line 79 of file NamdState.C.

References Controller::run().

Referenced by Node::run().

00080 {
00081   controller->run();
00082 }

int NamdState::status (  ) 

Definition at line 44 of file NamdState.C.

References DebugM.

00045 {
00046     int ret=0;
00047     if (configList != NULL) {
00048       DebugM(1, "Config List exists\n");
00049     } else ret++;
00050 
00051     if (simParameters != NULL) {
00052       DebugM(1, "SimParameters exists\n");
00053     }
00054     else ret++;
00055 
00056     if (parameters != NULL) {
00057       DebugM(1,"Parameters exists\n");
00058     }
00059     else ret++;
00060 
00061     if (molecule != NULL) {
00062       DebugM(1, "Molecule exists\n");
00063     }
00064     else ret++;
00065 
00066     if (pdb != NULL) {
00067       DebugM(1,"PDB exists \n");
00068     }
00069     else ret++;
00070     
00071     return(ret);
00072 }

void NamdState::useController ( Controller controllerPtr  ) 

Definition at line 74 of file NamdState.C.

00075 {
00076   controller=controllerPtr;
00077 }


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:

Generated on 4 Jun 2020 for NAMD by  doxygen 1.6.1