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();
154 #if ! defined (__CYGWIN__) && !defined(WIN64) 157 #
if ! defined(__APPLE__)
174 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;
175 if ( reload )
NAMD_die(
"Molecular structure reloading not supported for Amber input files.\n");
177 molInfoFilename = parmFilename;
186 molecule =
new Molecule(simParameters, parameters, amber);
187 if (coorFilename != NULL)
188 pdb =
new PDB(coorFilename->
data,amber);
192 NAMD_die(
"Failed to read AMBER parm file!");
195 if ( reload )
NAMD_die(
"Molecular structure reloading not supported for Amber input files.\n");
197 molInfoFilename = parmFilename;
202 molecule =
new Molecule(simParameters, parameters, &amber);
203 if (coorFilename != NULL)
204 pdb =
new PDB(coorFilename->
data,&amber);
206 NAMD_die(
"Failed to read AMBER parm file!");
212 if ( reload )
NAMD_die(
"Molecular structure reloading not supported for Gromacs input files.\n");
214 molInfoFilename = topFilename;
222 if (coorFilename != NULL)
223 pdb =
new PDB(coorFilename->
data,gromacsFile);
225 molecule =
new Molecule(simParameters, parameters, gromacsFile);
237 #ifdef MEM_OPT_VERSION 238 NAMD_die(
"Using plugin IO is not supported in memory optimized version!");
241 NAMD_bug(
"NamdState::loadStructure pdbFilename non-null with usePluginIO\n");
246 iout <<
iWARN <<
"Plugin-based I/O is still in development and may still have bugs\n" <<
endi;
248 molfile_plugin_t *pIOHandle = pIOMgr->
getPlugin();
249 if (pIOHandle == NULL) {
250 NAMD_die(
"ERROR: Failed to match requested plugin type");
252 if ( pIOHandle->open_file_read == NULL )
253 NAMD_die(
"ERROR: Selected plugin type cannot open files");
254 if ( pIOHandle->read_structure == NULL )
255 NAMD_die(
"ERROR: Selected plugin type cannot read structures");
256 if ( pIOHandle->read_next_timestep == NULL )
257 NAMD_die(
"ERROR: Selected plugin type cannot read coordinates");
260 molInfoFilename = moleculeFilename;
261 if ( ! molFilename ) molFilename = moleculeFilename->
data;
266 parameters =
new Parameters(simParameters, parameterFilename);
272 void *plgFile = pIOHandle->open_file_read(molFilename,
273 pIOHandle->name, &numAtoms);
274 if(plgFile == NULL) {
275 NAMD_die(
"ERROR: Opening structure file failed!");
278 double fileReadTime = CmiWallTimer();
279 molecule =
new Molecule(simParameters, parameters, pIOHandle, plgFile, numAtoms);
280 iout <<
iINFO <<
"TIME FOR LOAD MOLECULE STRUCTURE INFORMATION: " << CmiWallTimer() - fileReadTime <<
"\n" <<
endi;
284 fileReadTime = CmiWallTimer();
290 iout <<
iINFO <<
"TIME FOR LOADING ATOMS' COORDINATES INFORMATION: " << CmiWallTimer() - fileReadTime <<
"\n" <<
endi;
293 pIOHandle->close_file_read(plgFile);
300 molInfoFilename = moleculeFilename;
301 if ( ! molFilename ) molFilename = moleculeFilename->
data;
306 parameters =
new Parameters(simParameters, parameterFilename);
312 double fileReadTime = CmiWallTimer();
313 molecule =
new Molecule(simParameters, parameters, (
char*)molFilename, configList);
314 iout <<
iINFO <<
"TIME FOR READING PSF FILE: " << CmiWallTimer() - fileReadTime <<
"\n" <<
endi;
319 #ifdef MEM_OPT_VERSION 325 int numprocs = estval>>26;
328 }
else if(numprocs>CkNumPes()){
336 int numprocs = estval>>26;
339 }
else if(numprocs>CkNumPes()){
350 double fileReadTime = CmiWallTimer();
351 molecule->load_fixed_atoms(configList->
find(
"fixedAtomListFile"));
352 iout <<
iINFO <<
"TIME FOR READING FIXED ATOMS FILE: " << CmiWallTimer() - fileReadTime <<
"\n" <<
endi;
356 double fileReadTime = CmiWallTimer();
357 molecule->load_constrained_atoms(configList->
find(
"consAtomListFile"));
358 iout <<
iINFO <<
"TIME FOR READING CONSTRAINED ATOMS FILE: " << CmiWallTimer() - fileReadTime <<
"\n" <<
endi;
375 double fileReadTime = CmiWallTimer();
377 iout <<
"Finished compressing molecule information, which takes " << CmiWallTimer()-fileReadTime <<
"(s)\n"<<
endi;
387 double fileReadTime = CmiWallTimer();
389 iout <<
iINFO <<
"Reading pdb file " << pdbFilename <<
"\n" <<
endi;
390 pdb =
new PDB(pdbFilename);
392 coordinateFilename = configList->
find(
"coordinates");
393 if (coordinateFilename != NULL) {
394 iout <<
iINFO <<
"Reading pdb file " << coordinateFilename->
data <<
"\n" <<
endi;
395 pdb =
new PDB(coordinateFilename->
data);
399 NAMD_die(
"Number of pdb and psf atoms are not the same!");
401 iout <<
iINFO <<
"TIME FOR READING PDB FILE: " << CmiWallTimer() - fileReadTime <<
"\n" <<
endi;
411 if (coordinateFilename != NULL) {
412 if(strcasecmp(coordinateFilename->
data, consRefFile->
data)==0)
414 if(strcasecmp(coordinateFilename->
data, consKFile->
data)==0)
419 configList->
find(
"conskcol"),
426 if (simParameters->
stirOn)
431 configList->
find(
"stirredAtomsCol"),
437 #ifndef MEM_OPT_VERSION 441 configList->
find(
"fixedatomscol"),
452 configList->
find(
"gridforcecol"),
453 configList->
find(
"gridforcechargecol"),
454 configList->
find(
"gridforcepotfile"),
462 char *filename = NULL;
463 if (configList->
find(
"consforcefile"))
464 filename = configList->
find(
"consforcefile")->
data;
472 for(
int i=0;i<16;i++)
479 configList->
find(
"excludeFromPressureFile"),
480 configList->
find(
"excludeFromPressureCol"),
487 configList->
find(
"movDragCol"),
488 configList->
find(
"movDragVelFile"),
496 configList->
find(
"rotDragCol"),
497 configList->
find(
"rotDragAxisFile"),
498 configList->
find(
"rotDragPivotFile"),
499 configList->
find(
"rotDragVelFile"),
500 configList->
find(
"rotDragVelCol"),
508 configList->
find(
"consTorqueCol"),
509 configList->
find(
"consTorqueAxisFile"),
510 configList->
find(
"consTorquePivotFile"),
511 configList->
find(
"consTorqueValFile"),
512 configList->
find(
"consTorqueValCol"),
517 #ifndef MEM_OPT_VERSION 524 configList->
find(
"langevincol"),
538 configList->
find(
"tcouplecol"),
545 if (simParameters->
alchOn) {
547 configList->
find(
"alchcol"), pdb, NULL,
"alch" );
550 if (configList->
find(
"unperturbedBondFile") == NULL) {
551 NAMD_die(
"Input file for Shobana's bond terms is required with sdScaling on");
558 if (simParameters->
lesOn) {
559 if (simParameters->
alchOn)
NAMD_bug(
"FEP/TI and LES are incompatible!");
561 configList->
find(
"lescol"), pdb, NULL,
"les");
565 configList->
find(
"soluteScalingCol"), pdb, NULL);
569 configList->
find(
"pairInteractionCol"), pdb, NULL,
"pairInteraction");
573 configList->
find(
"pressureProfileAtomTypesCol"), pdb, NULL,
574 "pressureProfileAtomTypes");
577 #ifdef OPENATOM_VERSION 578 if (simParameters->openatomOn) {
579 molecules->build_qmmm_flags(configList->
find(
"openatomPdbFile",
580 configList->
find(
"openatomPdbCol"), pdb, NULL,
"openatomPdb")
582 #endif // OPENATOM_VERSION 586 #ifdef MEM_OPT_VERSION 587 NAMD_die(
"QM forces are not supported in memory-optimized builds.");
590 #if defined(NAMD_CUDA) || defined(NAMD_HIP) 591 NAMD_die(
"QM forces are not compatible with CUDA at this time");
598 parameters, configList);
599 else if (pdbFilename)
601 parameters, configList);
604 parameters, configList);
618 #ifdef MEM_OPT_VERSION 619 NAMD_die(
"Go forces are not supported in memory-optimized builds.");
624 StringList *goStructureFilename = configList->
find(
"goCoordinates");
629 int goMethod = simParameters->
goMethod;
633 }
else if (goMethod == 2) {
636 }
else if (goMethod == 3) {
640 NAMD_die(
"Failed to read goMethod variable in NamdState.C");
646 #ifndef MEM_OPT_VERSION 647 iout <<
iINFO <<
"****************************\n";
661 <<
" DIHEDRALS WITH MULTIPLE PERIODICITY (BASED ON PSF FILE)\n";
666 <<
" DIHEDRALS WITH MULTIPLE PERIODICITY IGNORED (BASED ON PSF FILE) \n";
668 <<
" CHARMM MULTIPLICITIES BASED ON PARAMETER FILE INFO! \n";
675 <<
" IMPROPERS WITH MULTIPLE PERIODICITY\n";
686 if (simParameters->
stirOn)
702 " RIGID BONDS BETWEEN FIXED ATOMS\n";
710 <<
" GRIDS ACTIVE\n";
715 if (simParameters->
alchOn) {
718 " ATOMS TO DISAPPEAR IN FINAL STATE\n";
721 " ATOMS TO APPEAR IN FINAL STATE\n";
723 iout <<
iWARN <<
"ALCH: SUSPICIOUS BONDS BETWEEN INITIAL AND " <<
724 "FINAL GROUPS WERE FOUND" <<
"\n" <<
endi;
729 " ANGLES LINKING INITIAL AND FINAL ATOMS DELETED\n";
734 " DIHEDRALS LINKING INITIAL AND FINAL ATOMS DELETED\n";
739 " IMPROPERS LINKING INITIAL AND FINAL ATOMS DELETED\n";
744 if (simParameters->
lesOn) {
746 " LOCALLY ENHANCED ATOMS ENABLED\n";
750 iout <<
iINFO <<
" SOLUTE SCALING ENABLED\n";
754 iout <<
iINFO <<
"PAIR INTERACTION GROUP 1 CONTAINS " 757 iout <<
iINFO <<
"PAIR INTERACTION GROUP 2 CONTAINS " 770 <<
" DEGREES OF FREEDOM\n";
774 iout <<
iINFO << g_com <<
" DRUDE COM DEGREES OF FREEDOM\n";
775 iout <<
iINFO << g_bond <<
" DRUDE BOND DEGREES OF FREEDOM\n";
782 int64 numDegFreedom = 3 * numAtoms;
785 if ( numFixedAtoms ) numDegFreedom -= 3 * numFixedAtoms;
790 if (numLonepairs) numDegFreedom -= 3 * numLonepairs;
795 numDegFreedom -= ( numRigidBonds - numFixedRigidBonds - numLonepairs);
796 iout <<
iINFO << numDegFreedom <<
" DEGREES OF FREEDOM\n";
802 <<
" ATOMS IN LARGEST HYDROGEN GROUP\n";
805 <<
" ATOMS IN LARGEST MIGRATION GROUP\n";
809 " HYDROGEN GROUPS WITH ALL ATOMS FIXED\n";
816 for ( i = 0; i < molecule->
numAtoms; ++i ) {
820 iout <<
iINFO <<
"TOTAL MASS = " << totalMass <<
" amu\n";
821 iout <<
iINFO <<
"TOTAL CHARGE = " << totalCharge <<
" e\n";
826 << ((totalMass/volume) / 0.6022) <<
" g/cm^3\n";
828 << (molecule->
numAtoms/volume) <<
" atoms/A^3\n";
832 iout <<
iINFO <<
"*****************************\n";
836 StringList *binCoordinateFilename = configList->
find(
"bincoordinates");
837 if ( binCoordinateFilename && ! reload ) {
841 DebugM(4,
"::configFileInit() - printing Molecule Information\n");
849 DebugM(4,
"::configFileInit() - done printing Molecule Information\n");
850 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 *)