--- trunk/src/io/ForceFieldOptions.hpp 2005/12/23 23:04:25 820 +++ trunk/src/io/ForceFieldOptions.hpp 2013/06/16 15:15:42 1879 @@ -6,19 +6,10 @@ * 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,30 +28,49 @@ * 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, 234107 (2008). + * [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). + * [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). */ #ifndef IO_FORCEFIELDOPTIONS_HPP #define IO_FORCEFIELDOPTIONS_HPP #include "utils/simError.h" +#include "types/DataHolder.hpp" #include "utils/ParameterManager.hpp" #include "utils/StringUtils.hpp" #include "io/ParamConstraint.hpp" -namespace oopse { +namespace OpenMD { - class ForceFieldOptions { + class ForceFieldOptions : public DataHolder { DeclareParameter(Name, std::string); DeclareParameter(vdWtype, std::string); DeclareParameter(DistanceMixingRule, std::string); DeclareParameter(DistanceType, std::string); DeclareParameter(EnergyMixingRule, std::string); - DeclareParameter(EnergyUnitScaling, double); - DeclareParameter(DistanceUnitScaling, double); - DeclareParameter(AngleUnitScaling, double); + DeclareParameter(CutoffPolicy, std::string); + DeclareParameter(EnergyUnitScaling, RealType); + DeclareParameter(MetallicEnergyUnitScaling, RealType); + DeclareParameter(DistanceUnitScaling, RealType); + DeclareParameter(AngleUnitScaling, RealType); DeclareParameter(TorsionAngleConvention, std::string); - DeclareParameter(vdw14scale, double); - DeclareParameter(electrostatic14scale, double); - DeclareParameter(dielectric, double); + DeclareParameter(vdw12scale, RealType); + DeclareParameter(vdw13scale, RealType); + DeclareParameter(vdw14scale, RealType); + DeclareParameter(electrostatic12scale, RealType); + DeclareParameter(electrostatic13scale, RealType); + DeclareParameter(electrostatic14scale, RealType); + DeclareParameter(GayBerneMu, RealType); + DeclareParameter(GayBerneNu, RealType); + DeclareParameter(EAMMixingMethod, std::string); public: ForceFieldOptions(); @@ -69,26 +79,36 @@ namespace oopse { void validateOptions() { CheckParameter(vdWtype, isEqualIgnoreCase(std::string("Lennard-Jones"))); - CheckParameter(DistanceMixingRule, isEqualIgnoreCase(std::string("arithmetic")) || isEqualIgnoreCase(std::string("geometric"))); + CheckParameter(DistanceMixingRule, isEqualIgnoreCase(std::string("arithmetic")) || isEqualIgnoreCase(std::string("geometric")) || isEqualIgnoreCase(std::string("cubic"))); CheckParameter(DistanceType, isEqualIgnoreCase(std::string("sigma")) || isEqualIgnoreCase(std::string("Rmin"))); - CheckParameter(EnergyMixingRule, isEqualIgnoreCase(std::string("arithmetic")) || isEqualIgnoreCase(std::string("geometric"))); - CheckParameter(TorsionAngleConvention, isEqualIgnoreCase(std::string("180 is trans")) || isEqualIgnoreCase(std::string("0 is trans"))); - } + CheckParameter(EnergyMixingRule, isEqualIgnoreCase(std::string("arithmetic")) || isEqualIgnoreCase(std::string("geometric")) || isEqualIgnoreCase(std::string("hhg"))); + CheckParameter(TorsionAngleConvention, isEqualIgnoreCase(std::string("180_is_trans")) || isEqualIgnoreCase(std::string("0_is_trans"))); + CheckParameter(CutoffPolicy, isEqualIgnoreCase(std::string("MIX")) || isEqualIgnoreCase(std::string("MAX")) || isEqualIgnoreCase(std::string("TRADITIONAL"))); + CheckParameter(EAMMixingMethod, isEqualIgnoreCase(std::string("JOHNSON")) || isEqualIgnoreCase(std::string("DAW"))); + } bool setData(const std::string& keyword, const std::string& value) { - bool result; + bool result(false); ParamMap::iterator i =parameters_.find(keyword); if (i != parameters_.end()) { - if(isType(value)){ + if(isInteger(value)){ int ival = lexi_cast(value); result = i->second->setData(ival); } - else if (isType(value)){ - double dval = lexi_cast(value); + else if (isType(value)){ + RealType dval = lexi_cast(value); result = i->second->setData(dval); } else{ result = i->second->setData(value); } + + if (!result) { + sprintf(painCave.errMsg, + "Unrecognized data type for keyword: %s = %s\n", + keyword.c_str(), value.c_str() ); + painCave.isFatal = 1; + simError(); + } } else { sprintf(painCave.errMsg, "%s is an unrecognized keyword\n", keyword.c_str() ); painCave.isFatal = 0; @@ -97,8 +117,7 @@ namespace oopse { return result; } - - void tellFortranOptions(); + private: typedef std::map ParamMap; ParamMap parameters_;