51     if (configList != NULL) {
    52       DebugM(1, 
"Config List exists\n");
    55     if (simParameters != NULL) {
    56       DebugM(1, 
"SimParameters exists\n");
    60     if (parameters != NULL) {
    61       DebugM(1,
"Parameters exists\n");
    65     if (molecule != NULL) {
    66       DebugM(1, 
"Molecule exists\n");
    80   controller=controllerPtr;
    90 #ifdef MEM_OPT_VERSION    93 void NamdState::checkMemOptCompatibility(){
    95         iout << 
"In the memory optimized version, the compression of molecule information is not supported! "    96                 << 
"Please use the non-memory optimized version.\n" <<
endi;
    97         NAMD_die(
"MEMOPT: unsupported usage");
   101         iout << 
iWARN << 
"langevinDamping MUST NOT BE 0.0 IF LANGEVIN IS"   102             <<
" TURNED ON IN MEMORY OPTIMIZED VERSION\n" <<
endi;
   103         NAMD_die(
"MEMOPT: unsupported feature");
   106         NAMD_die(
"MEMOPT: tCouple is not supported in memory optimized version");
   108         NAMD_die(
"MEMOPT: pairInteractionOn could not be enabled in memory optimized version");
   110         iout << 
iWARN << 
"ALCH: AUTOMATIC DELETION OF BONDED INTERACTIONS "   111         << 
"BETWEEN INITIAL AND FINAL GROUPS IS NOT SUPPORTED IN MEMORY "   112         << 
"OPTIMISED VERSION - MANUAL PROCESSING IS NECESSARY\n" << 
endi;
   113         NAMD_die(
"MEMOPT: unsupported feature");
   116         NAMD_die(
"MEMOPT: alchThermIntOn could not be enabled in memory optimized version");
   117     if(simParameters->
lesOn)
   118         NAMD_die(
"MEMOPT: lesOn could not be enabled in memory optimized version");
   120         NAMD_die(
"MEMOPT: soluteScalingOn could not be enabled in memory optimized version");
   122         NAMD_die(
"MEMOPT: lonepairs could not be enabled in memory optimized version");
   128   configList = cfgList;
   129   if (!configList->
okay()) {
   130     NAMD_die(
"Simulation config file is incomplete or contains errors.");
   132   DebugM(1,
"NamdState::configFileInit configList okay\n");
   134   char *currentdir = 0;
   137   lattice = simParameters->
lattice;
   141 #ifdef MEM_OPT_VERSION   142   checkMemOptCompatibility();
   155 #
if ! defined(__APPLE__)
   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");
   175       molInfoFilename = parmFilename;
   184         molecule = 
new Molecule(simParameters, parameters, amber);
   185         if (coorFilename != NULL)
   186           pdb = 
new PDB(coorFilename->
data,amber);
   190         NAMD_die(
"Failed to read AMBER parm file!");
   193       if ( reload ) 
NAMD_die(
"Molecular structure reloading not supported for Amber input files.\n");
   195       molInfoFilename = parmFilename;
   200         molecule = 
new Molecule(simParameters, parameters, &amber);
   201         if (coorFilename != NULL)
   202           pdb = 
new PDB(coorFilename->
data,&amber);
   204         NAMD_die(
"Failed to read AMBER parm file!");
   210     if ( reload ) 
NAMD_die(
"Molecular structure reloading not supported for Gromacs input files.\n");
   212     molInfoFilename = topFilename;
   220     if (coorFilename != NULL)
   221       pdb = 
new PDB(coorFilename->
data,gromacsFile);
   223     molecule = 
new Molecule(simParameters, parameters, gromacsFile);
   235 #ifdef MEM_OPT_VERSION             236         NAMD_die(
"Using plugin IO is not supported in memory optimized version!");
   239       NAMD_bug(
"NamdState::loadStructure pdbFilename non-null with usePluginIO\n");
   244     iout << 
iWARN << 
"Plugin-based I/O is still in development and may still have bugs\n" << 
endi;
   246     molfile_plugin_t *pIOHandle = pIOMgr->
getPlugin();
   247     if (pIOHandle == NULL) {
   248         NAMD_die(
"ERROR: Failed to match requested plugin type");
   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"); 
   258     molInfoFilename = moleculeFilename;
   259     if ( ! molFilename ) molFilename = moleculeFilename->
data;
   264     parameters = 
new Parameters(simParameters, parameterFilename);
   270     void *plgFile = pIOHandle->open_file_read(molFilename, 
   271                                               pIOHandle->name, &numAtoms);
   272     if(plgFile ==  NULL) {
   273         NAMD_die(
"ERROR: Opening structure file failed!");
   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;
   282         fileReadTime = CmiWallTimer();
   288         iout << 
iINFO << 
"TIME FOR LOADING ATOMS' COORDINATES INFORMATION: " << CmiWallTimer() - fileReadTime << 
"\n" << 
endi;
   291     pIOHandle->close_file_read(plgFile);
   298     molInfoFilename = moleculeFilename; 
   299     if ( ! molFilename ) molFilename = moleculeFilename->
data;
   304     parameters = 
new Parameters(simParameters, parameterFilename);
   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;
   317 #ifdef MEM_OPT_VERSION   323     int numprocs = estval>>26; 
   326     }
else if(numprocs>CkNumPes()){
   334     int numprocs = estval>>26; 
   337     }
else if(numprocs>CkNumPes()){
   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;
   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;
   373       double fileReadTime = CmiWallTimer();
   375       iout << 
"Finished compressing molecule information, which takes " << CmiWallTimer()-fileReadTime <<
"(s)\n"<<
endi;
   385       double fileReadTime = CmiWallTimer();
   387         iout << 
iINFO << 
"Reading pdb file " << pdbFilename << 
"\n" << 
endi;
   388         pdb = 
new PDB(pdbFilename);
   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);
   397         NAMD_die(
"Number of pdb and psf atoms are not the same!");
   399       iout << 
iINFO << 
"TIME FOR READING PDB FILE: " << CmiWallTimer() - fileReadTime << 
"\n" << 
endi;
   409           if (coordinateFilename != NULL) {
   410            if(strcasecmp(coordinateFilename->
data, consRefFile->
data)==0)
   412            if(strcasecmp(coordinateFilename->
data, consKFile->
data)==0)
   417                                              configList->
find(
"conskcol"),
   424         if (simParameters->
stirOn)
   429                                        configList->
find(
"stirredAtomsCol"),
   435 #ifndef MEM_OPT_VERSION   439                                         configList->
find(
"fixedatomscol"),
   450                                              configList->
find(
"gridforcecol"),
   451                                              configList->
find(
"gridforcechargecol"),
   452                                              configList->
find(
"gridforcepotfile"),
   460     char *filename = NULL;
   461     if (configList->
find(
"consforcefile"))
   462       filename = configList->
find(
"consforcefile")->
data;
   470           for(
int i=0;i<16;i++)
   477              configList->
find(
"excludeFromPressureFile"),
   478              configList->
find(
"excludeFromPressureCol"),
   485                                          configList->
find(
"movDragCol"),
   486                                          configList->
find(
"movDragVelFile"),
   494                                          configList->
find(
"rotDragCol"),
   495                                          configList->
find(
"rotDragAxisFile"),
   496                                          configList->
find(
"rotDragPivotFile"),
   497                                          configList->
find(
"rotDragVelFile"),
   498                                          configList->
find(
"rotDragVelCol"),
   506                                        configList->
find(
"consTorqueCol"),
   507                                        configList->
find(
"consTorqueAxisFile"),
   508                                        configList->
find(
"consTorquePivotFile"),
   509                                        configList->
find(
"consTorqueValFile"),
   510                                        configList->
find(
"consTorqueValCol"),
   515 #ifndef MEM_OPT_VERSION   522                                             configList->
find(
"langevincol"),
   536                                             configList->
find(
"tcouplecol"),
   543   if (simParameters->
alchOn) {
   545         configList->
find(
"alchcol"), pdb, NULL, 
"alch" );
   548       if (configList->
find(
"unperturbedBondFile") == NULL) {
   549         NAMD_die(
"Input file for Shobana's bond terms is required with sdScaling on");
   556   if (simParameters->
lesOn) {
   557     if (simParameters->
alchOn) 
NAMD_bug(
"FEP/TI and LES are incompatible!");
   559         configList->
find(
"lescol"), pdb, NULL, 
"les");
   563         configList->
find(
"soluteScalingCol"), pdb, NULL);
   567         configList->
find(
"pairInteractionCol"), pdb, NULL, 
"pairInteraction");
   571         configList->
find(
"pressureProfileAtomTypesCol"), pdb, NULL,
   572         "pressureProfileAtomTypes");
   575         #ifdef OPENATOM_VERSION   576         if (simParameters->openatomOn) {
   577           molecules->build_qmmm_flags(configList->
find(
"openatomPdbFile",
   578                 configList->
find(
"openatomPdbCol"), pdb, NULL, 
"openatomPdb")
   580         #endif // OPENATOM_VERSION   584 #ifdef MEM_OPT_VERSION   585             NAMD_die(
"QM forces are not supported in memory-optimized builds.");
   588 #if defined(NAMD_CUDA) || defined(NAMD_HIP)   589            NAMD_die(
"QM forces are not compatible with CUDA at this time");
   596                                           parameters, configList);
   597             else if (pdbFilename)
   599                                           parameters, configList);
   602                                           parameters, configList);
   616 #ifdef MEM_OPT_VERSION   617           NAMD_die(
"Go forces are not supported in memory-optimized builds.");
   622           StringList *goStructureFilename = configList->
find(
"goCoordinates");
   627           int goMethod = simParameters->
goMethod;
   631           } 
else if (goMethod == 2) {
   634           } 
else if (goMethod == 3) {
   638             NAMD_die(
"Failed to read goMethod variable in NamdState.C");
   644 #ifndef MEM_OPT_VERSION   645         iout << 
iINFO << 
"****************************\n";
   659              << 
" DIHEDRALS WITH MULTIPLE PERIODICITY (BASED ON PSF FILE)\n";
   664          << 
" DIHEDRALS WITH MULTIPLE PERIODICITY IGNORED (BASED ON PSF FILE) \n";
   666          << 
" CHARMM MULTIPLICITIES BASED ON PARAMETER FILE INFO! \n";
   673                          << 
" IMPROPERS WITH MULTIPLE PERIODICITY\n";
   684         if (simParameters->
stirOn)
   700                         " RIGID BONDS BETWEEN FIXED ATOMS\n";
   708                  << 
" GRIDS ACTIVE\n";
   713         if (simParameters->
alchOn) {
   716                " ATOMS TO DISAPPEAR IN FINAL STATE\n";
   719                " ATOMS TO APPEAR IN FINAL STATE\n";
   721              iout << 
iWARN << 
"ALCH: SUSPICIOUS BONDS BETWEEN INITIAL AND " <<
   722              "FINAL GROUPS WERE FOUND" << 
"\n" << 
endi;
   727                  " ANGLES LINKING INITIAL AND FINAL ATOMS DELETED\n";
   732                  " DIHEDRALS LINKING INITIAL AND FINAL ATOMS DELETED\n";
   737                  " IMPROPERS LINKING INITIAL AND FINAL ATOMS DELETED\n";
   742         if (simParameters->
lesOn) {
   744                " LOCALLY ENHANCED ATOMS ENABLED\n";
   748            iout << 
iINFO << 
" SOLUTE SCALING ENABLED\n";
   752            iout << 
iINFO << 
"PAIR INTERACTION GROUP 1 CONTAINS "   755              iout << 
iINFO << 
"PAIR INTERACTION GROUP 2 CONTAINS "   768              << 
" DEGREES OF FREEDOM\n";
   772           iout << 
iINFO << g_com << 
" DRUDE COM DEGREES OF FREEDOM\n";
   773           iout << 
iINFO << g_bond << 
" DRUDE BOND DEGREES OF FREEDOM\n";
   780           int64 numDegFreedom = 3 * numAtoms;
   783           if ( numFixedAtoms ) numDegFreedom -= 3 * numFixedAtoms;
   788     if (numLonepairs) numDegFreedom -= 3 * numLonepairs;
   793     numDegFreedom -= ( numRigidBonds - numFixedRigidBonds - numLonepairs);
   794           iout << 
iINFO << numDegFreedom << 
" DEGREES OF FREEDOM\n";
   800                 << 
" ATOMS IN LARGEST HYDROGEN GROUP\n";
   803                 << 
" ATOMS IN LARGEST MIGRATION GROUP\n";
   807                         " HYDROGEN GROUPS WITH ALL ATOMS FIXED\n";
   814           for ( i = 0; i < molecule->
numAtoms; ++i ) {
   818           iout << 
iINFO << 
"TOTAL MASS = " << totalMass << 
" amu\n"; 
   819           iout << 
iINFO << 
"TOTAL CHARGE = " << totalCharge << 
" e\n"; 
   824               << ((totalMass/volume) / 0.6022) << 
" g/cm^3\n";
   826               << (molecule->
numAtoms/volume) << 
" atoms/A^3\n";
   830         iout << 
iINFO << 
"*****************************\n";
   834   StringList *binCoordinateFilename = configList->
find(
"bincoordinates");
   835   if ( binCoordinateFilename && ! reload ) {
   839   DebugM(4, 
"::configFileInit() - printing Molecule Information\n");
   847   DebugM(4, 
"::configFileInit() - done printing Molecule Information\n");
   848   DebugM(1, 
"::configFileInit() - done\n");
 Real atomcharge(int anum) const
 
void build_gridforce_params(StringList *, StringList *, StringList *, StringList *, PDB *, char *)
 
DCDParams dcdSelectionParams[16]
 
std::ostream & iINFO(std::ostream &s)
 
void print_bonds(Parameters *)
 
Bool monteCarloPressureOn
 
void build_extra_bonds(Parameters *parameters, StringList *file)
 
molfile_plugin_t * getPlugin()
 
static void exit(int status=0)
 
std::ostream & endi(std::ostream &s)
 
std::ostream & iWARN(std::ostream &s)
 
int loadStructure(const char *, const char *, int)
 
Molecule stores the structural information for the system. 
 
void build_go_arrays(StringList *, char *)
 
void print_param_summary()
 
void build_langevin_params(BigReal coupling, BigReal drudeCoupling, Bool doHydrogen)
 
int numLonepairs
Number of lone pairs. 
 
const float * getBFactorData()
 
void NAMD_bug(const char *err_msg)
 
void compute_LJcorrection_alternative()
 
void read_binary_coors(char *fname, PDB *pdbobj)
 
void build_constraint_params(StringList *, StringList *, StringList *, PDB *, char *)
 
void build_constorque_params(StringList *, StringList *, StringList *, StringList *, StringList *, StringList *, PDB *, char *)
 
void set_qm_replaceAll(Bool newReplaceAll)
 
void prepare_qm(const char *pdbFileName, Parameters *params, ConfigList *cfgList)
 
NAMD_HOST_DEVICE BigReal volume(void) const
 
void build_stirred_atoms(StringList *, StringList *, PDB *, char *)
 
const float * getOccupancyData()
 
void NAMD_die(const char *err_msg)
 
Real atommass(int anum) const
 
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
 
void build_fep_flags(StringList *, StringList *, PDB *, char *, const char *)
 
void build_alch_unpert_bond_lists(char *)
 
void compress_molecule_info(Molecule *mol, char *psfFileName, Parameters *param, SimParameters *simParam, ConfigList *cfgList)
 
void build_fixed_atoms(StringList *, StringList *, PDB *, char *)
 
void compute_LJcorrection()
 
int pressureProfileAtomTypes
 
void print_atoms(Parameters *)
 
void useController(Controller *controllerPtr)
 
void build_go_sigmas(StringList *, char *)
 
void delete_alch_bonded(void)
 
int64_t num_deg_freedom(int isInitialReport=0) const
 
void build_exPressure_atoms(StringList *, StringList *, PDB *, char *)
 
void build_constant_forces(char *)
 
Ambertoppar readparm(const char *filename)
 
int numDrudeAtoms
Number of Drude particles. 
 
StringList * find(const char *name) const
 
void build_movdrag_params(StringList *, StringList *, StringList *, PDB *, char *)
 
char qmParamPDB[NAMD_FILENAME_BUFFER_SIZE]
 
int configListInit(ConfigList *)
 
void parse_dcd_selection_params(ConfigList *configList)
 
void build_go_params(StringList *)
 
void build_go_sigmas2(StringList *, char *)