56#include "brains/Register.hpp"
59#include "brains/Thermo.hpp"
60#include "brains/Velocitizer.hpp"
62#include "io/DumpWriter.hpp"
68int main(
int argc,
char* argv[]) {
70 std::string inputFileName;
71 std::string outputFileName;
74 if (cmdline_parser(argc, argv, &args_info) != 0) {
75 cmdline_parser_print_help();
84 inputFileName = args_info.
inputs[0];
86 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
87 "No input file name was specified on the command line");
88 painCave.severity = OPENMD_ERROR;
97 if (!outputFileName.compare(inputFileName)) {
98 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
99 "Input and Output File names should be different!");
100 painCave.severity = OPENMD_ERROR;
101 painCave.isFatal = 1;
114 std::unique_ptr<Velocitizer> veloSet {std::make_unique<Velocitizer>(info)};
119 veloSet->removeComDrift();
120 forceMan->calcForces();
122 RealType instPE = thermo.getPotential();
123 RealType instKE = thermo.getKinetic();
131 if (writer == NULL) {
132 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
133 "error in creating DumpWriter");
134 painCave.severity = OPENMD_ERROR;
135 painCave.isFatal = 1;
143 if (temperature < 0.0) {
144 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
145 "Temperatures must be positive numbers.");
146 painCave.severity = OPENMD_ERROR;
147 painCave.isFatal = 1;
151 veloSet->randomize(temperature);
159 if (charge_temperature < 0.0) {
160 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
161 "Temperatures must be positive numbers.");
162 painCave.severity = OPENMD_ERROR;
163 painCave.isFatal = 1;
167 veloSet->randomizeChargeVelocity(charge_temperature);
173 RealType epsilon = 1e-6;
174 RealType lambda = 0.0;
176 if (energy < instPE) {
177 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
178 "Energy must be larger than current potential energy.");
179 painCave.severity = OPENMD_ERROR;
180 painCave.isFatal = 1;
183 if (instKE >= epsilon) {
184 lambda = sqrt((energy - instPE) / instKE);
185 veloSet->scale(lambda);
191 veloSet->randomize(10.0);
192 instKE = thermo.getKinetic();
193 lambda = sqrt((energy - instPE) / instKE);
194 veloSet->scale(lambda);
203 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
204 "A new OpenMD file called \"%s\" has been generated.\n",
205 outputFileName.c_str());
206 painCave.isFatal = 0;
207 painCave.severity = OPENMD_INFO;
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....