--- trunk/src/io/Globals.cpp 2009/03/09 14:03:31 1327 +++ branches/development/src/io/Globals.cpp 2011/08/30 15:45:35 1616 @@ -1,24 +1,15 @@ /* - * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. + * Copyright (c) 2005, 2010 The University of Notre Dame. All Rights Reserved. * * The University of Notre Dame grants you ("Licensee") a * non-exclusive, royalty free, license to use, modify and * redistribute this software in source and binary code form, provided * that the following conditions are met: * - * 1. Acknowledgement of the program authors must be made in any - * publication of scientific results based in part on use of the - * program. An acceptable form of acknowledgement is citation of - * the article in which the program was described (Matthew - * A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher - * J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented - * Parallel Simulation Engine for Molecular Dynamics," - * J. Comput. Chem. 26, pp. 252-271 (2005)) - * - * 2. Redistributions of source code must retain the above copyright + * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - * 3. Redistributions in binary form must reproduce the above copyright + * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the * distribution. @@ -37,6 +28,15 @@ * arising out of the use of or inability to use software, even if the * University of Notre Dame has been advised of the possibility of * such damages. + * + * SUPPORT OPEN SCIENCE! If you use OpenMD or its source code in your + * research, please cite the appropriate papers when you publish your + * work. Good starting points are: + * + * [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). + * [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). + * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). + * [4] Vardeman & Gezelter, in progress (2009). */ #include @@ -49,7 +49,7 @@ #include "utils/MemoryUtils.hpp" #include "utils/simError.h" -namespace oopse { +namespace OpenMD { Globals::Globals() { DefineParameter(ForceField, "forceField") @@ -74,7 +74,7 @@ Globals::Globals() { DefineOptionalParameter(Seed, "seed"); DefineOptionalParameter(Minimizer, "minimizer"); DefineOptionalParameter(MinimizerMaxIter,"minimizerMaxIter"); - DefineOptionalParameter(MinimizerWriteFrq, "minimizerWriteFrq"); + DefineOptionalParameter(MinimizerWriteFreq, "minimizerWriteFreq"); DefineOptionalParameter(MinimizerStepSize, "minimizerStepSize"); DefineOptionalParameter(MinimizerFTol, "minimizerFTol"); DefineOptionalParameter(MinimizerGTol, "minimizerGTol"); @@ -88,14 +88,10 @@ Globals::Globals() { DefineOptionalParameter(ForceFieldVariant, "forceFieldVariant"); DefineOptionalParameter(ForceFieldFileName, "forceFieldFileName"); DefineOptionalParameter(DampingAlpha, "dampingAlpha"); - DefineOptionalParameter(ThermIntDistSpringConst, "thermIntDistSpringConst"); - DefineOptionalParameter(ThermIntThetaSpringConst, "thermIntThetaSpringConst"); - DefineOptionalParameter(ThermIntOmegaSpringConst, "thermIntOmegaSpringConst"); DefineOptionalParameter(SurfaceTension, "surfaceTension"); DefineOptionalParameter(PrintPressureTensor, "printPressureTensor"); DefineOptionalParameter(TaggedAtomPair, "taggedAtomPair"); DefineOptionalParameter(PrintTaggedPairDistance, "printTaggedPairDistance"); - DefineOptionalParameter(CutoffPolicy, "cutoffPolicy"); DefineOptionalParameter(SwitchingFunctionType, "switchingFunctionType"); DefineOptionalParameter(HydroPropFile, "HydroPropFile"); DefineOptionalParameter(Viscosity, "viscosity"); @@ -104,12 +100,13 @@ Globals::Globals() { DefineOptionalParameter(LangevinBufferRadius, "langevinBufferRadius"); DefineOptionalParameter(NeighborListNeighbors,"NeighborListNeighbors"); DefineOptionalParameter(UseMultipleTemperatureMethod, "useMultipleTemperatureMethod"); + DefineOptionalParameter(ElectrostaticSummationMethod, "electrostaticSummationMethod"); DefineOptionalParameter(MTM_Ce, "MTM_Ce"); DefineOptionalParameter(MTM_G, "MTM_G"); DefineOptionalParameter(MTM_Io, "MTM_Io"); DefineOptionalParameter(MTM_Sigma, "MTM_Sigma"); DefineOptionalParameter(MTM_R, "MTM_R"); - + DefineOptionalParameter(Alpha, "alpha"); DefineOptionalParameterWithDefaultValue(UsePeriodicBoundaryConditions, "usePeriodicBoundaryConditions", true); @@ -117,14 +114,9 @@ Globals::Globals() { DefineOptionalParameterWithDefaultValue(UseInitalTime, "useInitialTime", false); DefineOptionalParameterWithDefaultValue(UseIntialExtendedSystemState, "useInitialExtendedSystemState", false); DefineOptionalParameterWithDefaultValue(OrthoBoxTolerance, "orthoBoxTolerance", 1E-6); - DefineOptionalParameterWithDefaultValue(UseSolidThermInt, "useSolidThermInt", false); - DefineOptionalParameterWithDefaultValue(UseLiquidThermInt, "useLiquidThermInt", false); - DefineOptionalParameterWithDefaultValue(ThermIntDistSpringConst, "thermIntDistSpringConst", 6.0); - DefineOptionalParameterWithDefaultValue(ThermIntThetaSpringConst, "thermIntThetaSpringConst", 7.5); - DefineOptionalParameterWithDefaultValue(ThermIntOmegaSpringConst, "thermIntOmegaSpringConst", 13.5); - DefineOptionalParameterWithDefaultValue(ElectrostaticSummationMethod, "electrostaticSummationMethod", "SHIFTED_FORCE"); + DefineOptionalParameterWithDefaultValue(CutoffMethod, "cutoffMethod", "SHIFTED_FORCE"); DefineOptionalParameterWithDefaultValue(ElectrostaticScreeningMethod, "electrostaticScreeningMethod", "DAMPED"); - DefineOptionalParameterWithDefaultValue(Dielectric, "dielectric", 78.5); + DefineOptionalParameterWithDefaultValue(Dielectric, "dielectric", 80.0); DefineOptionalParameterWithDefaultValue(CompressDumpFile, "compressDumpFile", 0); DefineOptionalParameterWithDefaultValue(OutputForceVector, "outputForceVector", 0); DefineOptionalParameterWithDefaultValue(SkinThickness, "skinThickness", 1.0); @@ -133,20 +125,34 @@ Globals::Globals() { DefineOptionalParameterWithDefaultValue(AccumulateBoxDipole, "accumulateBoxDipole", false); DefineOptionalParameterWithDefaultValue(UseRNEMD, "useRNEMD", false); - DefineOptionalParameterWithDefaultValue(RNEMD_swapTime, "RNEMD_swapTime", 100.0); - DefineOptionalParameterWithDefaultValue(RNEMD_nBins, "RNEMD_nBins", 15); - DefineOptionalParameterWithDefaultValue(RNEMD_swapType, "RNEMD_swapType", "Kinetic"); - + DefineOptionalParameterWithDefaultValue(RNEMD_exchangeTime, "RNEMD_exchangeTime", 100.0); + DefineOptionalParameterWithDefaultValue(RNEMD_nBins, "RNEMD_nBins", 16); + DefineOptionalParameterWithDefaultValue(RNEMD_logWidth, "RNEMD_logWidth", 16); + DefineOptionalParameterWithDefaultValue(RNEMD_exchangeType, "RNEMD_exchangeType", "KineticScale"); + DefineOptionalParameterWithDefaultValue(RNEMD_targetFlux, "RNEMD_targetFlux", 0.0); + DefineOptionalParameterWithDefaultValue(RNEMD_objectSelection, "RNEMD_objectSelection", "select all"); + DefineOptionalParameterWithDefaultValue(UseRestraints, "useRestraints", false); + DefineOptionalParameterWithDefaultValue(Restraint_file, "Restraint_file", "idealCrystal.in"); + DefineOptionalParameterWithDefaultValue(UseThermodynamicIntegration, "useThermodynamicIntegration", false); + DefineOptionalParameterWithDefaultValue(HULL_Method,"HULL_Method","Convex"); + + deprecatedKeywords_.insert("nComponents"); deprecatedKeywords_.insert("nZconstraints"); deprecatedKeywords_.insert("initialConfig"); + deprecatedKeywords_.insert("thermIntDistSpringConst"); + deprecatedKeywords_.insert("thermIntThetaSpringConst"); + deprecatedKeywords_.insert("thermIntOmegaSpringConst"); + deprecatedKeywords_.insert("useSolidThermInt"); + deprecatedKeywords_.insert("useLiquidThermInt"); } Globals::~Globals() { MemoryUtils::deletePointers(components_); MemoryUtils::deletePointers(zconstraints_); + MemoryUtils::deletePointers(restraints_); } void Globals::validate() { @@ -172,7 +178,7 @@ void Globals::validate() { CheckParameter(Seed, isPositive()); CheckParameter(Minimizer, isEqualIgnoreCase("SD") || isEqualIgnoreCase("CG")); CheckParameter(MinimizerMaxIter, isPositive()); - CheckParameter(MinimizerWriteFrq, isPositive()); + CheckParameter(MinimizerWriteFreq, isPositive()); CheckParameter(MinimizerStepSize, isPositive()); CheckParameter(MinimizerFTol, isPositive()); CheckParameter(MinimizerGTol, isPositive()); @@ -184,18 +190,12 @@ void Globals::validate() { CheckParameter(ThermodynamicIntegrationK, isPositive()); CheckParameter(ForceFieldVariant, isNotEmpty()); CheckParameter(ForceFieldFileName, isNotEmpty()); - CheckParameter(ThermIntDistSpringConst, isPositive()); - CheckParameter(ThermIntThetaSpringConst, isPositive()); - CheckParameter(ThermIntOmegaSpringConst, isPositive()); - CheckParameter(ElectrostaticSummationMethod, isEqualIgnoreCase("NONE") || isEqualIgnoreCase("SHIFTED_POTENTIAL") || isEqualIgnoreCase("SHIFTED_FORCE") || isEqualIgnoreCase("REACTION_FIELD")); - CheckParameter(ElectrostaticScreeningMethod, isEqualIgnoreCase("UNDAMPED") || isEqualIgnoreCase("DAMPED")); + CheckParameter(CutoffMethod, isEqualIgnoreCase("HARD") || isEqualIgnoreCase("SWITCHED") || isEqualIgnoreCase("SHIFTED_POTENTIAL") || isEqualIgnoreCase("SHIFTED_FORCE")); CheckParameter(CutoffPolicy, isEqualIgnoreCase("MIX") || isEqualIgnoreCase("MAX") || isEqualIgnoreCase("TRADITIONAL")); + CheckParameter(ElectrostaticSummationMethod, isEqualIgnoreCase("NONE") || isEqualIgnoreCase("HARD") || isEqualIgnoreCase("SWITCHED") || isEqualIgnoreCase("SHIFTED_POTENTIAL") || isEqualIgnoreCase("SHIFTED_FORCE") || isEqualIgnoreCase("REACTION_FIELD")); + CheckParameter(ElectrostaticScreeningMethod, isEqualIgnoreCase("UNDAMPED") || isEqualIgnoreCase("DAMPED")); CheckParameter(SwitchingFunctionType, isEqualIgnoreCase("CUBIC") || isEqualIgnoreCase("FIFTH_ORDER_POLYNOMIAL")); - //CheckParameter(StatFileFormat,); CheckParameter(OrthoBoxTolerance, isPositive()); - CheckParameter(ThermIntDistSpringConst, isPositive()); - CheckParameter(ThermIntThetaSpringConst, isPositive()); - CheckParameter(ThermIntOmegaSpringConst, isPositive()); CheckParameter(DampingAlpha,isNonNegative()); CheckParameter(SkinThickness, isPositive()); CheckParameter(Viscosity, isNonNegative()); @@ -203,19 +203,23 @@ void Globals::validate() { CheckParameter(FrozenBufferRadius, isPositive()); CheckParameter(LangevinBufferRadius, isPositive()); CheckParameter(NeighborListNeighbors, isPositive()); - CheckParameter(RNEMD_swapTime, isPositive()); - CheckParameter(RNEMD_nBins, isPositive()); - CheckParameter(RNEMD_swapType, isEqualIgnoreCase("Kinetic") || isEqualIgnoreCase("Px") || isEqualIgnoreCase("Py") || isEqualIgnoreCase("Pz")); + CheckParameter(RNEMD_exchangeTime, isPositive()); + CheckParameter(RNEMD_nBins, isPositive() && isEven()); + CheckParameter(RNEMD_exchangeType, isEqualIgnoreCase("KineticSwap") || isEqualIgnoreCase("KineticScale") || isEqualIgnoreCase("Px") || isEqualIgnoreCase("Py") || isEqualIgnoreCase("Pz") || isEqualIgnoreCase("PxScale") || isEqualIgnoreCase("PyScale") || isEqualIgnoreCase("PzScale")); + CheckParameter(RNEMD_targetFlux, isNonNegative()); + CheckParameter(HULL_Method, isEqualIgnoreCase("Convex") || isEqualIgnoreCase("AlphaShape")); + CheckParameter(Alpha, isPositive()); + for(std::vector::iterator i = components_.begin(); i != components_.end(); ++i) { if (!(*i)->findMoleculeStamp(moleculeStamps_)) { std::ostringstream oss; oss << "Globals Error: can not find molecule stamp for component " << (*i)->getType() << std::endl; - throw OOPSEException(oss.str()); + throw OpenMDException(oss.str()); } } } - + bool Globals::addComponent(Component* comp) { components_.push_back(comp); return true; @@ -226,6 +230,11 @@ bool Globals::addZConsStamp(ZConsStamp* zcons) { return true; } +bool Globals::addRestraintStamp(RestraintStamp* rest) { + restraints_.push_back(rest); + return true; +} + bool Globals::addMoleculeStamp(MoleculeStamp* molStamp) { std::string molStampName = molStamp->getName(); std::map::iterator i; @@ -237,7 +246,7 @@ bool Globals::addMoleculeStamp(MoleculeStamp* molStamp } else { std::ostringstream oss; oss << "Globals Error: Molecule Stamp " << molStamp->getName() << "appears multiple times\n"; - throw OOPSEException(oss.str()); + throw OpenMDException(oss.str()); } return ret; }