| 39 | 
  | 
 * such damages. | 
| 40 | 
  | 
 */ | 
| 41 | 
  | 
  | 
| 42 | 
< | 
#ifndef IO_FORCEFIELDOPTIONS_HPP | 
| 43 | 
< | 
#define IO_FORCEFIELDOPTIONS_HPP | 
| 44 | 
< | 
#include "utils/simError.h" | 
| 45 | 
< | 
#include "utils/ParameterManager.hpp" | 
| 46 | 
< | 
#include "io/ParamConstraint.hpp" | 
| 47 | 
< | 
namespace oopse { | 
| 48 | 
< | 
   | 
| 49 | 
< | 
  class ForceFieldOptions { | 
| 50 | 
< | 
    DeclareParameter(MixingRule, std::string); | 
| 51 | 
< | 
 | 
| 52 | 
< | 
    public: | 
| 53 | 
< | 
        ForceFieldOptions() { | 
| 54 | 
< | 
          DefineOptionalParameter(MixingRule, "arthimatic"); | 
| 55 | 
< | 
        } | 
| 56 | 
< | 
         | 
| 57 | 
< | 
        ForceFieldOptions(const ForceFieldOptions&); | 
| 58 | 
< | 
        ForceFieldOptions& operator = (const ForceFieldOptions&); | 
| 59 | 
< | 
 | 
| 60 | 
< | 
        void validateOptions() { | 
| 61 | 
< | 
          CheckParameter(MixingRule, isEqualIgnoreCase(std::string("arthimatic")) ||  | 
| 62 | 
< | 
                 isEqualIgnoreCase(std::string("geometric")));  | 
| 63 | 
< | 
 | 
| 64 | 
< | 
        } | 
| 65 | 
< | 
 | 
| 66 | 
< | 
        bool setData(const std::string& keyword, const std::string& value); | 
| 67 | 
< | 
 | 
| 68 | 
< | 
    private: | 
| 69 | 
< | 
        typedef std::map<std::string, ParameterBase*> ParamMap; | 
| 70 | 
< | 
        ParamMap parameters_;                   | 
| 71 | 
< | 
  }; | 
| 72 | 
< | 
   | 
| 73 | 
< | 
} | 
| 74 | 
< | 
 | 
| 75 | 
< | 
#endif | 
| 42 | 
> | 
#ifndef IO_FORCEFIELDOPTIONS_HPP | 
| 43 | 
> | 
#define IO_FORCEFIELDOPTIONS_HPP | 
| 44 | 
> | 
#include "utils/simError.h" | 
| 45 | 
> | 
#include "utils/ParameterManager.hpp" | 
| 46 | 
> | 
#include "utils/StringUtils.hpp" | 
| 47 | 
> | 
#include "io/ParamConstraint.hpp" | 
| 48 | 
> | 
#define __C | 
| 49 | 
> | 
#include "UseTheForce/fForceOptions.h" | 
| 50 | 
> | 
 | 
| 51 | 
> | 
namespace oopse { | 
| 52 | 
> | 
   | 
| 53 | 
> | 
  class ForceFieldOptions { | 
| 54 | 
> | 
    DeclareParameter(Name, std::string); | 
| 55 | 
> | 
    DeclareParameter(vdWtype, std::string); | 
| 56 | 
> | 
    DeclareParameter(DistanceMixingRule, std::string); | 
| 57 | 
> | 
    DeclareParameter(DistanceType, std::string); | 
| 58 | 
> | 
    DeclareParameter(EnergyMixingRule, std::string); | 
| 59 | 
> | 
    DeclareParameter(CutoffPolicy, std::string); | 
| 60 | 
> | 
    DeclareParameter(EnergyUnitScaling, RealType); | 
| 61 | 
> | 
    DeclareParameter(DistanceUnitScaling, RealType); | 
| 62 | 
> | 
    DeclareParameter(AngleUnitScaling, RealType); | 
| 63 | 
> | 
    DeclareParameter(TorsionAngleConvention, std::string); | 
| 64 | 
> | 
    DeclareParameter(vdw14scale, RealType); | 
| 65 | 
> | 
    DeclareParameter(electrostatic14scale, RealType); | 
| 66 | 
> | 
    DeclareParameter(GayBerneMu, RealType); | 
| 67 | 
> | 
    DeclareParameter(GayBerneNu, RealType); | 
| 68 | 
> | 
     | 
| 69 | 
> | 
  public: | 
| 70 | 
> | 
    ForceFieldOptions(); | 
| 71 | 
> | 
    ForceFieldOptions(const ForceFieldOptions&); | 
| 72 | 
> | 
    ForceFieldOptions& operator = (const ForceFieldOptions&); | 
| 73 | 
> | 
     | 
| 74 | 
> | 
    void validateOptions() { | 
| 75 | 
> | 
      CheckParameter(vdWtype, isEqualIgnoreCase(std::string("Lennard-Jones"))); | 
| 76 | 
> | 
      CheckParameter(DistanceMixingRule, isEqualIgnoreCase(std::string("arithmetic")) || isEqualIgnoreCase(std::string("geometric")) || isEqualIgnoreCase(std::string("cubic"))); | 
| 77 | 
> | 
      CheckParameter(DistanceType, isEqualIgnoreCase(std::string("sigma")) || isEqualIgnoreCase(std::string("Rmin"))); | 
| 78 | 
> | 
      CheckParameter(EnergyMixingRule, isEqualIgnoreCase(std::string("arithmetic")) || isEqualIgnoreCase(std::string("geometric")) || isEqualIgnoreCase(std::string("hhg"))); | 
| 79 | 
> | 
      CheckParameter(TorsionAngleConvention, isEqualIgnoreCase(std::string("180 is trans")) || isEqualIgnoreCase(std::string("0 is trans"))); | 
| 80 | 
> | 
      CheckParameter(CutoffPolicy, isEqualIgnoreCase(std::string("MIX")) || isEqualIgnoreCase(std::string("MAX")) || isEqualIgnoreCase(std::string("TRADITIONAL"))); | 
| 81 | 
> | 
   } | 
| 82 | 
> | 
     | 
| 83 | 
> | 
    bool setData(const std::string& keyword, const std::string& value) { | 
| 84 | 
> | 
      bool result; | 
| 85 | 
> | 
      ParamMap::iterator i =parameters_.find(keyword); | 
| 86 | 
> | 
      if (i != parameters_.end()) { | 
| 87 | 
> | 
        if(isInteger(value)){ | 
| 88 | 
> | 
          int ival = lexi_cast<int>(value); | 
| 89 | 
> | 
          result = i->second->setData(ival); | 
| 90 | 
> | 
        }       | 
| 91 | 
> | 
        else if (isType<RealType>(value)){ | 
| 92 | 
> | 
          RealType dval = lexi_cast<RealType>(value); | 
| 93 | 
> | 
          result = i->second->setData(dval); | 
| 94 | 
> | 
        } else{ | 
| 95 | 
> | 
          result = i->second->setData(value); | 
| 96 | 
> | 
        } | 
| 97 | 
> | 
      } else { | 
| 98 | 
> | 
        sprintf(painCave.errMsg,  "%s is an unrecognized keyword\n", keyword.c_str() ); | 
| 99 | 
> | 
        painCave.isFatal = 0; | 
| 100 | 
> | 
        simError();         | 
| 101 | 
> | 
      } | 
| 102 | 
> | 
       | 
| 103 | 
> | 
      return result; | 
| 104 | 
> | 
    } | 
| 105 | 
> | 
 | 
| 106 | 
> | 
    void makeFortranOptions(ForceOptions & fortranForceOptions); | 
| 107 | 
> | 
  private: | 
| 108 | 
> | 
    typedef std::map<std::string, ParameterBase*> ParamMap; | 
| 109 | 
> | 
    ParamMap parameters_;                   | 
| 110 | 
> | 
  }; | 
| 111 | 
> | 
   | 
| 112 | 
> | 
} | 
| 113 | 
> | 
#endif |