45#include "io/Globals.hpp"
52#include "io/ParamConstraint.hpp"
54#include "utils/simError.h"
58 flucQpars_ =
new FluctuatingChargeParameters();
59 rnemdPars_ =
new RNEMD::RNEMDParameters();
60 lightPars_ =
new Perturbations::LightParameters();
61 minimizerPars_ =
new MinimizerParameters();
63 DefineParameter(ForceField,
"forceField");
65 DefineOptionalParameter(TargetTemp,
"targetTemp");
66 DefineOptionalParameter(Ensemble,
"ensemble");
67 DefineOptionalParameter(Dt,
"dt");
68 DefineOptionalParameter(RunTime,
"runTime");
69 DefineOptionalParameter(FinalConfig,
"finalConfig");
70 DefineOptionalParameter(SampleTime,
"sampleTime");
71 DefineOptionalParameter(ResetTime,
"resetTime");
72 DefineOptionalParameter(StatusTime,
"statusTime");
73 DefineOptionalParameter(CutoffRadius,
"cutoffRadius");
74 DefineOptionalParameter(SwitchingRadius,
"switchingRadius");
75 DefineOptionalParameter(TempSet,
"tempSet");
76 DefineOptionalParameter(ThermalTime,
"thermalTime");
77 DefineOptionalParameter(TargetPressure,
"targetPressure");
78 DefineOptionalParameter(TauThermostat,
"tauThermostat");
79 DefineOptionalParameter(TauBarostat,
"tauBarostat");
80 DefineOptionalParameter(LangevinPistonDrag,
"langevinPistonDrag");
81 DefineOptionalParameter(ZconsTime,
"zconsTime");
82 DefineOptionalParameter(ZconsTol,
"zconsTol");
83 DefineOptionalParameter(ZconsForcePolicy,
"zconsForcePolicy");
84 DefineOptionalParameter(Seed,
"seed");
85 DefineOptionalParameter(ZconsGap,
"zconsGap");
86 DefineOptionalParameter(ZconsFixtime,
"zconsFixtime");
87 DefineOptionalParameter(ZconsUsingSMD,
"zconsUsingSMD");
88 DefineOptionalParameter(ThermodynamicIntegrationLambda,
89 "thermodynamicIntegrationLambda");
90 DefineOptionalParameter(ThermodynamicIntegrationK,
91 "thermodynamicIntegrationK");
92 DefineOptionalParameter(ForceFieldVariant,
"forceFieldVariant");
93 DefineOptionalParameter(ForceFieldFileName,
"forceFieldFileName");
94 DefineOptionalParameter(DampingAlpha,
"dampingAlpha");
95 DefineOptionalParameter(SurfaceTension,
"surfaceTension");
96 DefineOptionalParameter(PrintPressureTensor,
"printPressureTensor");
97 DefineOptionalParameter(PrintVirialTensor,
"printVirialTensor");
98 DefineOptionalParameter(ElectricField,
"electricField");
99 DefineOptionalParameter(UniformField,
"uniformField");
101 DefineOptionalParameter(MagneticField,
"magneticField");
102 DefineOptionalParameter(UniformGradientStrength,
"uniformGradientStrength");
103 DefineOptionalParameter(UniformGradientDirection1,
104 "uniformGradientDirection1");
105 DefineOptionalParameter(UniformGradientDirection2,
106 "uniformGradientDirection2");
110 DefineOptionalParameter(TaggedAtomPair,
"taggedAtomPair");
111 DefineOptionalParameter(PrintTaggedPairDistance,
"printTaggedPairDistance");
112 DefineOptionalParameter(SwitchingFunctionType,
"switchingFunctionType");
113 DefineOptionalParameter(HydroPropFile,
"HydroPropFile");
114 DefineOptionalParameter(Viscosity,
"viscosity");
115 DefineOptionalParameter(BeadSize,
"beadSize");
116 DefineOptionalParameter(FrozenBufferRadius,
"frozenBufferRadius");
117 DefineOptionalParameter(LangevinBufferRadius,
"langevinBufferRadius");
118 DefineOptionalParameter(NeighborListNeighbors,
"NeighborListNeighbors");
119 DefineOptionalParameter(UseMultipleTemperatureMethod,
120 "useMultipleTemperatureMethod");
122 "electrostaticSummationMethod");
123 DefineOptionalParameter(MTM_Ce,
"MTM_Ce");
124 DefineOptionalParameter(MTM_G,
"MTM_G");
125 DefineOptionalParameter(MTM_Io,
"MTM_Io");
126 DefineOptionalParameter(MTM_Sigma,
"MTM_Sigma");
127 DefineOptionalParameter(MTM_R,
"MTM_R");
128 DefineOptionalParameter(Alpha,
"alpha");
129 DefineOptionalParameter(ConstraintTime,
"constraintTime");
131 DefineOptionalParameter(PotentialSelection,
"potentialSelection");
133 DefineOptionalParameterWithDefaultValue(
134 UsePeriodicBoundaryConditions,
"usePeriodicBoundaryConditions",
true);
135 DefineOptionalParameterWithDefaultValue(
136 ConserveLinearMomentum,
"conserveLinearMomentum",
true);
137 DefineOptionalParameterWithDefaultValue(
138 ConserveAngularMomentum,
"conserveAngularMomentum",
true);
139 DefineOptionalParameterWithDefaultValue(UseAtomicVirial,
"useAtomicVirial",
141 DefineOptionalParameterWithDefaultValue(UseLongRangeCorrections,
142 "useLongRangeCorrections",
true);
143 DefineOptionalParameterWithDefaultValue(UseInitalTime,
"useInitialTime",
145 DefineOptionalParameterWithDefaultValue(
146 UseIntialExtendedSystemState,
"useInitialExtendedSystemState",
false);
147 DefineOptionalParameterWithDefaultValue(OrthoBoxTolerance,
148 "orthoBoxTolerance", 1E-6);
149 DefineOptionalParameterWithDefaultValue(CutoffMethod,
"cutoffMethod",
151 DefineOptionalParameterWithDefaultValue(
152 ElectrostaticScreeningMethod,
"electrostaticScreeningMethod",
"DAMPED");
153 DefineOptionalParameter(UseSurfaceTerm,
"useSurfaceTerm");
154 DefineOptionalParameter(UseSurfaceTerm,
"useSlabGeometry");
155 DefineOptionalParameterWithDefaultValue(Dielectric,
"dielectric", 80.0);
156 DefineOptionalParameterWithDefaultValue(CompressDumpFile,
157 "compressDumpFile",
false);
158 DefineOptionalParameterWithDefaultValue(PrintHeatFlux,
"printHeatFlux",
160 DefineOptionalParameterWithDefaultValue(OutputForceVector,
161 "outputForceVector",
false);
162 DefineOptionalParameterWithDefaultValue(OutputParticlePotential,
163 "outputParticlePotential",
false);
164 DefineOptionalParameterWithDefaultValue(OutputElectricField,
165 "outputElectricField",
false);
166 DefineOptionalParameterWithDefaultValue(OutputFluctuatingCharges,
167 "outputFluctuatingCharges",
false);
168 DefineOptionalParameterWithDefaultValue(OutputSitePotential,
169 "outputSitePotential",
false);
170 DefineOptionalParameterWithDefaultValue(OutputDensity,
"outputDensity",
172 DefineOptionalParameterWithDefaultValue(SkinThickness,
"skinThickness",
174 DefineOptionalParameterWithDefaultValue(
175 StatFileFormat,
"statFileFormat",
176 "TIME|TOTAL_ENERGY|POTENTIAL_ENERGY|KINETIC_ENERGY|TEMPERATURE|"
179 "CONSERVED_QUANTITY");
180 DefineOptionalParameterWithDefaultValue(StatFilePrecision,
181 "statFilePrecision", 8);
182 DefineOptionalParameterWithDefaultValue(UseSphericalBoundaryConditions,
183 "useSphericalBoundaryConditions",
185 DefineOptionalParameterWithDefaultValue(AccumulateBoxDipole,
186 "accumulateBoxDipole",
false);
187 DefineOptionalParameterWithDefaultValue(AccumulateBoxQuadrupole,
188 "accumulateBoxQuadrupole",
false);
189 DefineOptionalParameterWithDefaultValue(UseRestraints,
"useRestraints",
191 DefineOptionalParameterWithDefaultValue(Restraint_file,
"Restraint_file",
193 DefineOptionalParameterWithDefaultValue(
194 UseThermodynamicIntegration,
"useThermodynamicIntegration",
false);
195 DefineOptionalParameterWithDefaultValue(HULL_Method,
"HULL_Method",
198 DefineOptionalParameterWithDefaultValue(PrivilegedAxis,
"privilegedAxis",
201 deprecatedKeywords_.insert(
"nComponents");
202 deprecatedKeywords_.insert(
"nZconstraints");
203 deprecatedKeywords_.insert(
"initialConfig");
204 deprecatedKeywords_.insert(
"thermIntDistSpringConst");
205 deprecatedKeywords_.insert(
"thermIntThetaSpringConst");
206 deprecatedKeywords_.insert(
"thermIntOmegaSpringConst");
207 deprecatedKeywords_.insert(
"useSolidThermInt");
208 deprecatedKeywords_.insert(
"useLiquidThermInt");
209 deprecatedKeywords_.insert(
"minimizerMaxIter");
210 deprecatedKeywords_.insert(
"minimizerWriteFreq");
211 deprecatedKeywords_.insert(
"minimizerStepSize");
212 deprecatedKeywords_.insert(
"minimizerFTol");
213 deprecatedKeywords_.insert(
"minimizerGTol");
214 deprecatedKeywords_.insert(
"minimizerLSTol");
215 deprecatedKeywords_.insert(
"minimizerLSMaxIter");
216 deprecatedKeywords_.insert(
"electricField");
217 deprecatedKeywords_.insert(
"cutoffPolicy");
218 deprecatedKeywords_.insert(
"beadSize");
221 Globals::~Globals() {
222 Utils::deletePointers(moleculeStamps_);
224 Utils::deletePointers(components_);
225 Utils::deletePointers(zconstraints_);
226 Utils::deletePointers(restraints_);
231 delete minimizerPars_;
234 void Globals::validate() {
235 DataHolder::validate();
237 CheckParameter(ForceField, isNotEmpty());
238 CheckParameter(TargetTemp, isPositive());
241 isEqualIgnoreCase(
"NVE") || isEqualIgnoreCase(
"NVT") ||
242 isEqualIgnoreCase(
"NPTi") || isEqualIgnoreCase(
"NPTf") ||
243 isEqualIgnoreCase(
"NPTxyz") || isEqualIgnoreCase(
"NPTsz") ||
244 isEqualIgnoreCase(
"NPAT") || isEqualIgnoreCase(
"NPA") ||
245 isEqualIgnoreCase(
"LANGEVINDYNAMICS") || isEqualIgnoreCase(
"LD") ||
246 isEqualIgnoreCase(
"NPRT") || isEqualIgnoreCase(
"NPGT") ||
247 isEqualIgnoreCase(
"NGammaT") || isEqualIgnoreCase(
"NGT") ||
248 isEqualIgnoreCase(
"LANGEVINHULL") || isEqualIgnoreCase(
"LHULL") ||
249 isEqualIgnoreCase(
"SMIPD") || isEqualIgnoreCase(
"LANGEVINPISTON") ||
250 isEqualIgnoreCase(
"SPF"));
251 CheckParameter(Dt, isPositive());
252 CheckParameter(RunTime, isPositive());
253 CheckParameter(FinalConfig, isNotEmpty());
254 CheckParameter(SampleTime, isNonNegative());
255 CheckParameter(ResetTime, isNonNegative());
256 CheckParameter(StatusTime, isNonNegative());
257 CheckParameter(CutoffRadius, isPositive());
258 CheckParameter(SwitchingRadius, isNonNegative());
259 CheckParameter(Dielectric, isPositive());
260 CheckParameter(ThermalTime, isNonNegative());
261 CheckParameter(TauThermostat, isPositive());
262 CheckParameter(TauBarostat, isPositive());
263 CheckParameter(ZconsTime, isPositive());
264 CheckParameter(ZconsTol, isPositive());
265 CheckParameter(Seed, isPositive());
266 CheckParameter(ZconsGap, isPositive());
267 CheckParameter(ZconsFixtime, isPositive());
268 CheckParameter(ThermodynamicIntegrationLambda, isNonNegative());
269 CheckParameter(ThermodynamicIntegrationK, isPositive());
270 CheckParameter(ForceFieldVariant, isNotEmpty());
271 CheckParameter(ForceFieldFileName, isNotEmpty());
272 CheckParameter(CutoffMethod, isEqualIgnoreCase(
"HARD") ||
273 isEqualIgnoreCase(
"SWITCHED") ||
274 isEqualIgnoreCase(
"SHIFTED_POTENTIAL") ||
275 isEqualIgnoreCase(
"SHIFTED_FORCE") ||
276 isEqualIgnoreCase(
"TAYLOR_SHIFTED") ||
277 isEqualIgnoreCase(
"EWALD_FULL"));
279 isEqualIgnoreCase(
"NONE") || isEqualIgnoreCase(
"HARD") ||
280 isEqualIgnoreCase(
"SWITCHED") ||
281 isEqualIgnoreCase(
"SHIFTED_POTENTIAL") ||
282 isEqualIgnoreCase(
"SHIFTED_FORCE") ||
283 isEqualIgnoreCase(
"REACTION_FIELD") ||
284 isEqualIgnoreCase(
"TAYLOR_SHIFTED") ||
285 isEqualIgnoreCase(
"EWALD_FULL"));
287 ElectrostaticScreeningMethod,
288 isEqualIgnoreCase(
"UNDAMPED") || isEqualIgnoreCase(
"DAMPED"));
289 CheckParameter(SwitchingFunctionType,
290 isEqualIgnoreCase(
"CUBIC") ||
291 isEqualIgnoreCase(
"FIFTH_ORDER_POLYNOMIAL"));
292 CheckParameter(OrthoBoxTolerance, isPositive());
293 CheckParameter(DampingAlpha, isNonNegative());
294 CheckParameter(SkinThickness, isPositive());
295 CheckParameter(Viscosity, isNonNegative());
296 CheckParameter(BeadSize, isPositive());
297 CheckParameter(FrozenBufferRadius, isPositive());
298 CheckParameter(LangevinBufferRadius, isPositive());
299 CheckParameter(NeighborListNeighbors, isPositive());
300 CheckParameter(HULL_Method, isEqualIgnoreCase(
"Convex") ||
301 isEqualIgnoreCase(
"AlphaShape"));
302 CheckParameter(Alpha, isPositive());
303 CheckParameter(StatFilePrecision, isPositive());
304 CheckParameter(PrivilegedAxis, isEqualIgnoreCase(
"x") ||
305 isEqualIgnoreCase(
"y") ||
306 isEqualIgnoreCase(
"z"));
308 for (std::vector<Component*>::iterator i = components_.begin();
309 i != components_.end(); ++i) {
310 if (!(*i)->findMoleculeStamp(moleculeStamps_)) {
311 std::ostringstream oss;
312 oss <<
"Globals Error: can not find molecule stamp for component "
313 << (*i)->getType() << std::endl;
314 throw OpenMDException(oss.str());
319 bool Globals::addComponent(Component* comp) {
320 components_.push_back(comp);
324 bool Globals::addZConsStamp(ZConsStamp* zcons) {
325 zconstraints_.push_back(zcons);
329 bool Globals::addRestraintStamp(RestraintStamp* rest) {
330 restraints_.push_back(rest);
334 bool Globals::addFluctuatingChargeParameters(
335 FluctuatingChargeParameters* fqp) {
336 if (flucQpars_ != NULL)
delete flucQpars_;
342 bool Globals::addRNEMDParameters(RNEMD::RNEMDParameters* rnemdPars) {
343 if (rnemdPars_ != NULL)
delete rnemdPars_;
345 rnemdPars_ = rnemdPars;
349 bool Globals::addLightParameters(Perturbations::LightParameters* lightPars) {
350 if (lightPars_ != NULL)
delete lightPars_;
352 lightPars_ = lightPars;
356 bool Globals::addMinimizerParameters(MinimizerParameters* miniPars) {
357 if (minimizerPars_ != NULL)
delete minimizerPars_;
359 minimizerPars_ = miniPars;
363 bool Globals::addMoleculeStamp(MoleculeStamp* molStamp) {
364 std::string molStampName = molStamp->getName();
365 std::map<std::string, MoleculeStamp*>::iterator i;
367 i = moleculeStamps_.find(molStampName);
368 if (i == moleculeStamps_.end()) {
369 moleculeStamps_.insert(std::map<std::string, MoleculeStamp*>::value_type(
370 molStampName, molStamp));
373 std::ostringstream oss;
374 oss <<
"Globals Error: Molecule Stamp " << molStamp->getName()
375 <<
"appears multiple times\n";
376 throw OpenMDException(oss.str());
381 bool Globals::addFragmentStamp(FragmentStamp* fragStamp) {
382 std::string fragStampName = fragStamp->getName();
383 std::map<std::string, FragmentStamp*>::iterator i;
385 i = fragmentStamps_.find(fragStampName);
386 if (i == fragmentStamps_.end()) {
387 fragmentStamps_.insert(std::map<std::string, FragmentStamp*>::value_type(
388 fragStampName, fragStamp));
391 std::ostringstream oss;
392 oss <<
"Globals Error: Fragment Stamp " << fragStamp->getName()
393 <<
"appears multiple times\n";
394 throw OpenMDException(oss.str());
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.
ElectrostaticSummationMethod