8 #include "MdCommandManager.h" 9 #include "MdSimulation.h" 11 #include <mcMd/commands/MdCommandFactory.h> 13 #include <util/format/Str.h> 14 #include <util/format/Dbl.h> 24 simulationPtr_(&simulation),
25 systemPtr_(&simulation.system())
35 simulationPtr_(&simulation),
54 if (name ==
"READ_CONFIG") {
59 if (name ==
"THERMALIZE") {
66 if (name ==
"SIMULATE") {
70 bool isContinuation =
false;
73 if (name ==
"CONTINUE") {
75 UTIL_THROW(
"Attempt to continue simulation when iStep_ == 0");
80 bool isContinuation =
true;
83 if (name ==
"ANALYZE_CONFIGS") {
85 in >> min >> max >> filename;
87 <<
Str(filename, 20) << std::endl;
90 if (name ==
"WRITE_CONFIG") {
95 if (name ==
"WRITE_PARAM") {
100 if (name ==
"SET_CONFIG_IO") {
101 std::string classname;
106 if (name ==
"ANALYZE_TRAJECTORY") {
107 std::string classname;
108 std::string filename;
110 in >> min >> max >> classname >> filename;
112 <<
" " <<
Str(filename, 15)
116 if (name ==
"GENERATE_MOLECULES") {
127 Label capacityLabel(
"Capacities:");
129 for (
int iSpecies = 0; iSpecies < nSpecies; ++iSpecies) {
130 in >> capacities[iSpecies];
131 Log::file() <<
" " << capacities[iSpecies];
133 Label diameterLabel(
"Diameters:");
135 for (
int iType=0; iType < nAtomType; iType++) {
136 in >> diameters[iType];
145 if (name ==
"SET_PAIR") {
146 std::string paramName;
147 int typeId1, typeId2;
149 in >> paramName >> typeId1 >> typeId2 >> value;
151 <<
" " << typeId1 <<
" " << typeId2
152 <<
" " << value << std::endl;
154 .
set(paramName, typeId1, typeId2, value);
158 if (name ==
"SET_BOND") {
159 std::string paramName;
162 in >> paramName >> typeId >> value;
163 Log::file() <<
" " << paramName <<
" " << typeId
164 <<
" " << value << std::endl;
169 if (name ==
"SET_ANGLE") {
170 std::string paramName;
173 in >> paramName >> typeId >> value;
174 Log::file() <<
" " << paramName <<
" " << typeId
175 <<
" " << value << std::endl;
180 if (name ==
"SET_DIHEDRAL") {
181 std::string paramName;
184 in >> paramName >> typeId >> value;
185 Log::file() <<
" " << paramName <<
" " << typeId
186 <<
" " << value << std::endl;
190 #endif // ifndef UTIL_MPI Include this file to include all MD potentials at once.
Manager for Command objects in an MdSimulation.
DihedralPotential & dihedralPotential() const
Return DihedralPotential by reference.
virtual void set(std::string name, int i, int j, double value)=0
Modify a parameter, identified by a string.
void generateMolecules(Array< int > const &capacities, Array< double > const &diameters)
Generate molecules for all species.
Vector removeDriftVelocity()
Subtract average velocity from all atomic velocities.
void simulate(int endStep, bool isContinuation=false)
Run an MD simulation of specified length.
void analyzeConfigs(int min, int max, std::string basename)
Read and analyze a sequence of configuration files.
void setConfigIo(std::string &classname)
Create a new configuration file reader/writer.
Wrapper for a double precision number, for formatted ostream output.
virtual bool readStandardCommand(std::string command, std::istream &in)
Attempt to read one of the standard built-in commands.
void analyzeTrajectory(int min, int max, std::string classname, std::string filename)
Read and analyze a trajectory file.
MdPairPotential & pairPotential() const
Return MdPairPotential by reference.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
Utility classes for scientific computation.
void setBoltzmannVelocities(double temperature)
Set all velocities to Boltzmann distributed random values.
virtual void set(std::string name, int type, double value)=0
Modify an interaction parameter, identified by a string.
virtual Util::Factory< Command > * newDefaultFactory() const
Create and return pointer to a new MdCommandFactory object.
AnglePotential & anglePotential() const
Return AnglePotential by reference.
Wrapper for an int, for formatted ostream output.
MdSimulation & simulation() const
Get parent MdSimulation by reference.
virtual ~MdCommandManager()
Destructor.
CommandFactory for an MdSimulation.
virtual void set(std::string name, int type, double value)=0
Modify an interaction parameter, identified by a string.
A label string in a file format.
static std::ostream & file()
Get log ostream by reference.
Boundary & boundary() const
Get the Boundary by reference.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
int nSpecies() const
Get the number of Species in this Simulation.
MdCommandManager(MdSimulation &simulation)
Constructor.
MdSystem & system() const
Get associated MdSystem by reference.
virtual void set(std::string name, int type, double value)=0
Modify an interaction parameter, identified by a string.
Wrapper for a std::string, for formatted ostream output.
A System for Molecular Dynamics simulation.
void allocate(int capacity)
Allocate the underlying C array.
virtual void readConfig(std::istream &in)
Read system configuration from file.
int nAtomType() const
Get the number of atom types.
void writeConfig(std::ostream &out)
Write system configuration to a specified ostream.
BondPotential & bondPotential() const
Return BondPotential by reference.
A molecular dynamics simulation of a single MdSystem.
void writeParam(std::string filename)
Open output, write and close an output parameter file.