59#include "brains/Register.hpp"
62#include "brains/Thermo.hpp"
63#include "brains/Velocitizer.hpp"
65#include "io/DumpWriter.hpp"
71int main(
int argc,
char* argv[]) {
73 std::string inputFileName;
74 std::string outputFileName;
77 if (cmdline_parser(argc, argv, &args_info) != 0) {
87 inputFileName = args_info.
inputs[0];
89 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
90 "No input file name was specified on the command line");
91 painCave.severity = OPENMD_ERROR;
100 if (!outputFileName.compare(inputFileName)) {
101 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
102 "Input and Output File names should be different!");
103 painCave.severity = OPENMD_ERROR;
104 painCave.isFatal = 1;
115 std::unique_ptr<Velocitizer> veloSet {std::make_unique<Velocitizer>(info)};
120 veloSet->removeComDrift();
121 forceMan->calcForces();
123 RealType instPE = thermo.getPotential();
124 RealType instKE = thermo.getKinetic();
132 if (writer == NULL) {
133 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
134 "error in creating DumpWriter");
135 painCave.severity = OPENMD_ERROR;
136 painCave.isFatal = 1;
144 if (temperature < 0.0) {
145 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
146 "Temperatures must be positive numbers.");
147 painCave.severity = OPENMD_ERROR;
148 painCave.isFatal = 1;
152 veloSet->randomize(temperature);
160 if (charge_temperature < 0.0) {
161 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
162 "Temperatures must be positive numbers.");
163 painCave.severity = OPENMD_ERROR;
164 painCave.isFatal = 1;
168 veloSet->randomizeChargeVelocity(charge_temperature);
174 RealType epsilon = 1e-6;
175 RealType lambda = 0.0;
177 if (energy < instPE) {
178 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
179 "Energy must be larger than current potential energy.");
180 painCave.severity = OPENMD_ERROR;
181 painCave.isFatal = 1;
184 if (instKE >= epsilon) {
185 lambda = sqrt((energy - instPE) / instKE);
186 veloSet->scale(lambda);
192 veloSet->randomize(10.0);
193 instKE = thermo.getKinetic();
194 lambda = sqrt((energy - instPE) / instKE);
195 veloSet->scale(lambda);
204 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
205 "A new OpenMD file called \"%s\" has been generated.\n",
206 outputFileName.c_str());
207 painCave.isFatal = 0;
208 painCave.severity = OPENMD_INFO;
void cmdline_parser_print_help(void)
Print the help.
ForceManager is responsible for calculating both the short range (bonded) interactions and long range...
The only responsibility of SimCreator is to parse the meta-data file and create a SimInfo instance ba...
SimInfo * createSim(const std::string &mdFileName, bool loadInitCoords=true)
Setup Simulation.
One of the heavy-weight classes of OpenMD, SimInfo maintains objects and variables relating to the cu...
SnapshotManager * getSnapshotManager()
Returns the snapshot manager.
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.
Where the command line options are stored.
double chargetemperature_arg
charge temperature (K).
unsigned int chargetemperature_given
Whether chargetemperature was given.
unsigned inputs_num
unamed options number
unsigned int energy_given
Whether energy was given.
char * output_arg
output file name.
char ** inputs
unamed options (options without names)
char * input_arg
input dump file.
double temperature_arg
temperature (in Kelvin (default='300').
double energy_arg
energy (kcal/mol).
unsigned int temperature_given
Whether temperature was given.
unsigned int input_given
Whether input was given.
The header file for the command line option parser generated by GNU Gengetopt version 2....