8 #include "McCommandManager.h" 9 #include "McSimulation.h" 11 #include <mcMd/commands/McCommandFactory.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 ==
"SET_CONFIG_IO") {
55 std::string classname;
60 if (name ==
"READ_CONFIG") {
65 if (name ==
"SIMULATE") {
68 Log::file() <<
" " << endStep << std::endl;
69 bool isContinuation =
false;
72 if (name ==
"CONTINUE") {
74 UTIL_THROW(
"Attempt to continue when iStep() == 0");
79 bool isContinuation =
true;
82 if (name ==
"ANALYZE_CONFIGS") {
84 in >> min >> max >> filename;
86 <<
" " << filename << std::endl;
89 if (name ==
"ANALYZE_TRAJECTORY") {
90 std::string classname;
93 in >> min >> max >> classname >> filename;
95 <<
" " <<
Str(filename, 15)
99 if (name ==
"WRITE_CONFIG") {
104 if (name ==
"WRITE_PARAM") {
106 Log::file() <<
" " << filename << std::endl;
109 if (name ==
"GENERATE_MOLECULES") {
120 Label capacityLabel(
"Capacities:");
123 for (
int iSpecies = 0; iSpecies < nSpecies; ++iSpecies) {
124 in >> capacities[iSpecies];
125 Log::file() <<
" " << capacities[iSpecies];
127 Label diameterLabel(
"Diameters:");
130 for (
int iType=0; iType < nAtomType; iType++) {
131 in >> diameters[iType];
139 if (name ==
"DEFORM_CELL") {
149 for (
int iSpec=0; iSpec < nSpecies; ++iSpec) {
151 for ( ; molIter.
notEnd(); ++molIter) {
152 molIter->begin(atomIter);
153 for ( ; atomIter.
notEnd(); ++atomIter) {
154 Vector cartPosition, genPosition;
155 cartPosition = atomIter->position();
157 atomIter->position() = genPosition;
167 for (
int iSpec=0; iSpec < nSpecies; ++iSpec) {
169 for ( ; molIter.
notEnd(); ++molIter) {
170 molIter->begin(atomIter);
171 for ( ; atomIter.
notEnd(); ++atomIter) {
172 Vector cartPosition, genPosition;
173 genPosition = atomIter->position();
175 atomIter->position() = cartPosition;
193 if (name ==
"SET_PAIR") {
194 std::string paramName;
195 int typeId1, typeId2;
197 in >> paramName >> typeId1 >> typeId2 >> value;
199 <<
" " << typeId1 <<
" " << typeId2
200 <<
" " << value << std::endl;
202 .
set(paramName, typeId1, typeId2, value);
206 if (name ==
"SET_BOND") {
207 std::string paramName;
210 in >> paramName >> typeId >> value;
211 Log::file() <<
" " << paramName <<
" " << typeId
212 <<
" " << value << std::endl;
217 if (name ==
"SET_ANGLE") {
218 std::string paramName;
221 in >> paramName >> typeId >> value;
222 Log::file() <<
" " << paramName <<
" " << typeId
223 <<
" " << value << std::endl;
228 if (name ==
"SET_DIHEDRAL") {
229 std::string paramName;
232 in >> paramName >> typeId >> value;
233 Log::file() <<
" " << paramName <<
" " << typeId
234 <<
" " << value << std::endl;
237 #endif // ifdef SIMP_DIHEDRAL 238 #endif // ifndef UTIL_MPI Manager for Command objects in an MdSimulation.
A System for use in a Markov chain Monte Carlo simulation.
McSimulation & simulation() const
Get parent McSimulation by reference.
A Vector is a Cartesian vector.
virtual void set(std::string name, int i, int j, double value)=0
Modify a parameter, identified by a string.
void buildCellList()
Build the CellList with current configuration.
virtual Util::Factory< Command > * newDefaultFactory() const
Create and return pointer to a new McCommandFactory object.
void begin(int speciesId, MoleculeIterator &iterator)
Initialize an iterator for molecules of one species in this System.
Include this file to include all MC potential energy classes at once.
bool notEnd() const
Is the current pointer not at the end of the array?
BondPotential & bondPotential() const
Return the BondPotential by reference.
void analyzeConfigs(int min, int max, std::string basename)
Read and analyze a sequence of configuration files.
virtual bool readStandardCommand(std::string command, std::istream &in)
Attempt to read one of the standard commands.
void setConfigIo(std::string &classname)
Create a new configuration file reader/writer.
virtual void generateMolecules(Array< int > const &capacities, Array< double > const &diameters)
Generate molecules for all species.
virtual void readConfig(std::istream &in)
Read system configuration from file.
A Monte-Carlo simulation of one McSystem.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
bool notEnd() const
Is the current pointer not at the end of the PArray?
Utility classes for scientific computation.
virtual void set(std::string name, int type, double value)=0
Modify an interaction parameter, identified by a string.
Wrapper for an int, for formatted ostream output.
Forward iterator for an Array or a C array.
Forward iterator for a PArray.
void transformGenToCart(const Vector &Rg, Vector &Rc) const
Transform Vector of generalized coordinates to Cartesian Vector.
CommandFactory for an McSimulation.
virtual ~McCommandManager()
Destructor.
McCommandManager(McSimulation &simulation)
Constructor.
McPairPotential & pairPotential() const
Return the McPairPotential by reference.
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.
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.
McSystem & system() const
Get associated McSystem by reference.
AnglePotential & anglePotential() const
Return AnglePotential by reference.
void allocate(int capacity)
Allocate the underlying C array.
void analyzeTrajectory(int min, int max, std::string classname, std::string filename)
Read and analyze a trajectory file.
int nAtomType() const
Get the number of atom types.
void writeConfig(std::ostream &out)
Write system configuration to a specified ostream.
void simulate(int endStep, bool isContinuation=false)
Run an MC simulation of specified length.
void writeParam(std::string filename)
Open output, write and close an output parameter file.
void transformCartToGen(const Vector &Rc, Vector &Rg) const
Transform Cartesian Vector to scaled / generalized coordinates.
DihedralPotential & dihedralPotential() const
Return the DihedralPotential by reference.