--- trunk/src/io/ForceFieldOptions.hpp 2005/11/21 22:59:36 765 +++ trunk/src/io/ForceFieldOptions.hpp 2006/05/17 21:51:42 963 @@ -39,36 +39,74 @@ * such damages. */ -#ifndef IO_FORCEFIELDOPTIONS_HPP -#define IO_FORCEFIELDOPTIONS_HPP -#include "utils/simError.h" -#include "utils/ParameterManager.hpp" -#include "io/ParamConstraint.hpp" -namespace oopse { - - class ForceFieldOptions { - DeclareParameter(MixingRule, std::string); - - public: - ForceFieldOptions() { - DefineOptionalParameter(MixingRule, "arithmetic"); - } - - ForceFieldOptions(const ForceFieldOptions&); - ForceFieldOptions& operator = (const ForceFieldOptions&); - - void validateOptions() { - CheckParameter(MixingRule, isEqualIgnoreCase(std::string("arithmetic")) || isEqualIgnoreCase(std::string("geometric"))); - - } - - bool setData(const std::string& keyword, const std::string& value); - - private: - typedef std::map ParamMap; - ParamMap parameters_; - }; - -} - -#endif +#ifndef IO_FORCEFIELDOPTIONS_HPP +#define IO_FORCEFIELDOPTIONS_HPP +#include "utils/simError.h" +#include "utils/ParameterManager.hpp" +#include "utils/StringUtils.hpp" +#include "io/ParamConstraint.hpp" +#define __C +#include "UseTheForce/fForceOptions.h" + +namespace oopse { + + class ForceFieldOptions { + DeclareParameter(Name, std::string); + DeclareParameter(vdWtype, std::string); + DeclareParameter(DistanceMixingRule, std::string); + DeclareParameter(DistanceType, std::string); + DeclareParameter(EnergyMixingRule, std::string); + DeclareParameter(CutoffPolicy, std::string); + DeclareParameter(EnergyUnitScaling, RealType); + DeclareParameter(DistanceUnitScaling, RealType); + DeclareParameter(AngleUnitScaling, RealType); + DeclareParameter(TorsionAngleConvention, std::string); + DeclareParameter(vdw14scale, RealType); + DeclareParameter(electrostatic14scale, RealType); + DeclareParameter(dielectric, RealType); + + public: + ForceFieldOptions(); + ForceFieldOptions(const ForceFieldOptions&); + ForceFieldOptions& operator = (const ForceFieldOptions&); + + void validateOptions() { + CheckParameter(vdWtype, isEqualIgnoreCase(std::string("Lennard-Jones"))); + CheckParameter(DistanceMixingRule, isEqualIgnoreCase(std::string("arithmetic")) || isEqualIgnoreCase(std::string("geometric"))); + 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(CutoffPolicy, isEqualIgnoreCase(std::string("MIX")) || isEqualIgnoreCase(std::string("MAX")) || isEqualIgnoreCase(std::string("TRADITIONAL"))); + } + + bool setData(const std::string& keyword, const std::string& value) { + bool result; + ParamMap::iterator i =parameters_.find(keyword); + if (i != parameters_.end()) { + if(isInteger(value)){ + int ival = lexi_cast(value); + result = i->second->setData(ival); + } + else if (isType(value)){ + RealType dval = lexi_cast(value); + result = i->second->setData(dval); + } else{ + result = i->second->setData(value); + } + } else { + sprintf(painCave.errMsg, "%s is an unrecognized keyword\n", keyword.c_str() ); + painCave.isFatal = 0; + simError(); + } + + return result; + } + + void makeFortranOptions(ForceOptions & fortranForceOptions); + private: + typedef std::map ParamMap; + ParamMap parameters_; + }; + +} +#endif