ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-2.0/src/io/ForceFieldOptions.hpp
(Generate patch)

Comparing trunk/OOPSE-2.0/src/io/ForceFieldOptions.hpp (file contents):
Revision 2464 by gezelter, Mon Nov 21 22:59:36 2005 UTC vs.
Revision 2519 by chuckv, Fri Dec 23 23:04:25 2005 UTC

# Line 39 | Line 39
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, "arithmetic");
55 <        }
56 <        
57 <        ForceFieldOptions(const ForceFieldOptions&);
58 <        ForceFieldOptions& operator = (const ForceFieldOptions&);
59 <
60 <        void validateOptions() {
61 <          CheckParameter(MixingRule, isEqualIgnoreCase(std::string("arithmetic")) || isEqualIgnoreCase(std::string("geometric")));
62 <
63 <        }
64 <
65 <        bool setData(const std::string& keyword, const std::string& value);
66 <
67 <    private:
68 <        typedef std::map<std::string, ParameterBase*> ParamMap;
69 <        ParamMap parameters_;                  
70 <  };
71 <  
72 < }
73 <
74 < #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 >
49 > namespace oopse {
50 >  
51 >  class ForceFieldOptions {
52 >    DeclareParameter(Name, std::string);
53 >    DeclareParameter(vdWtype, std::string);
54 >    DeclareParameter(DistanceMixingRule, std::string);
55 >    DeclareParameter(DistanceType, std::string);
56 >    DeclareParameter(EnergyMixingRule, std::string);
57 >    DeclareParameter(EnergyUnitScaling, double);
58 >    DeclareParameter(DistanceUnitScaling, double);
59 >    DeclareParameter(AngleUnitScaling, double);
60 >    DeclareParameter(TorsionAngleConvention, std::string);
61 >    DeclareParameter(vdw14scale, double);
62 >    DeclareParameter(electrostatic14scale, double);
63 >    DeclareParameter(dielectric, double);
64 >    
65 >  public:
66 >    ForceFieldOptions();
67 >    ForceFieldOptions(const ForceFieldOptions&);
68 >    ForceFieldOptions& operator = (const ForceFieldOptions&);
69 >    
70 >    void validateOptions() {
71 >      CheckParameter(vdWtype, isEqualIgnoreCase(std::string("Lennard-Jones")));
72 >      CheckParameter(DistanceMixingRule, isEqualIgnoreCase(std::string("arithmetic")) || isEqualIgnoreCase(std::string("geometric")));
73 >      CheckParameter(DistanceType, isEqualIgnoreCase(std::string("sigma")) || isEqualIgnoreCase(std::string("Rmin")));
74 >      CheckParameter(EnergyMixingRule, isEqualIgnoreCase(std::string("arithmetic")) || isEqualIgnoreCase(std::string("geometric")));
75 >      CheckParameter(TorsionAngleConvention, isEqualIgnoreCase(std::string("180 is trans")) || isEqualIgnoreCase(std::string("0 is trans")));
76 >    }
77 >    
78 >    bool setData(const std::string& keyword, const std::string& value) {
79 >      bool result;
80 >      ParamMap::iterator i =parameters_.find(keyword);
81 >      if (i != parameters_.end()) {
82 >        if(isType<int>(value)){
83 >          int ival = lexi_cast<int>(value);
84 >          result = i->second->setData(ival);
85 >        }      
86 >        else if (isType<double>(value)){
87 >          double dval = lexi_cast<double>(value);
88 >          result = i->second->setData(dval);
89 >        } else{
90 >          result = i->second->setData(value);
91 >        }
92 >      } else {
93 >        sprintf(painCave.errMsg,  "%s is an unrecognized keyword\n", keyword.c_str() );
94 >        painCave.isFatal = 0;
95 >        simError();        
96 >      }
97 >      
98 >      return result;
99 >    }
100 >
101 >    void tellFortranOptions();
102 >  private:
103 >    typedef std::map<std::string, ParameterBase*> ParamMap;
104 >    ParamMap parameters_;                  
105 >  };
106 >  
107 > }
108 > #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines