ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-3.0/src/types/AtomType.hpp
Revision: 1813
Committed: Wed Dec 1 17:38:32 2004 UTC (19 years, 9 months ago) by tim
File size: 5018 byte(s)
Log Message:
refactory AtomType

File Contents

# User Rev Content
1 gezelter 1631 #ifndef TYPES_ATOMTYPE_HPP
2 tim 1740
3 gezelter 1631 #define TYPES_ATOMTYPE_HPP
4    
5 gezelter 1652 #include <string>
6    
7 gezelter 1631 #include "utils/PropertyMap.hpp"
8 tim 1740
9 gezelter 1631 #define __C
10     #include "types/AtomTypeProperties.h"
11     #include "UseTheForce/DarkSide/atype_interface.h"
12    
13 tim 1787 using namespace std;
14 gezelter 1652
15 tim 1787 namespace oopse {
16 gezelter 1631 /**
17 tim 1740 * @class AtomType
18     * AtomType is what OOPSE looks to for unchanging data about an atom.
19     * Things that belong to AtomType are universal properties (i.e. does
20     * this atom have a Charge? What is it's mass_?) Dynamic properties of
21     * an atom are not intended to be properties of an atom type
22 gezelter 1631 */
23 tim 1740 class AtomType {
24     public:
25 gezelter 1631
26 tim 1740 AtomType();
27 gezelter 1632
28 tim 1740 virtual ~AtomType() { } ;
29 tim 1769
30     virtual void complete();
31    
32 tim 1740 /**
33     * Finishes off the AtomType by communicating the logical portions of the
34     * structure to the Fortran atype module
35     */
36 tim 1769 void makeFortranAtomType();
37    
38 tim 1740 void setMass(double m) {
39     mass_ = m;
40     }
41    
42     double getMass(void) {
43     return mass_;
44     }
45    
46     void setIdent(int id) {
47 tim 1787 atp.ident = id;
48 tim 1740 }
49    
50     int getIdent() {
51 tim 1787 return atp.ident;
52 tim 1740 }
53    
54     void setName(const std::string&name) {
55     name_ = name;
56     }
57    
58     std::string getName() {
59     return name_;
60     }
61    
62     void setLennardJones() {
63 tim 1787 atp.is_LennardJones = 1;
64 tim 1740 }
65    
66     bool isLennardJones() {
67 tim 1787 return atp.is_LennardJones;
68 tim 1740 }
69    
70    
71     bool isElectrostatic() {
72 tim 1813 return isCharge() || isMultipole();
73 tim 1740 }
74    
75     void setEAM() {
76 tim 1787 atp.is_EAM = 1;
77 tim 1740 }
78    
79     bool isEAM() {
80 tim 1787 return atp.is_EAM;
81 tim 1740 }
82    
83     void setCharge() {
84 tim 1787 atp.is_Charge = 1;
85 tim 1740 }
86    
87     bool isCharge() {
88 tim 1787 return atp.is_Charge;
89 tim 1740 }
90    
91     bool isDirectional() {
92 tim 1787 return atp.is_Directional;
93 tim 1740 }
94    
95     bool isDipole() {
96 tim 1787 return atp.is_Dipole;
97 tim 1740 }
98    
99 tim 1813 bool isQuadrupole() {
100     return atp.is_Quadrupole;
101     }
102    
103     bool isMultipole() {
104     return isDipole() || isQuadrupole();
105     }
106    
107 tim 1740 bool isGayBerne() {
108 tim 1787 return atp.is_GayBerne;
109 tim 1740 }
110    
111     bool isSticky() {
112 tim 1787 return atp.is_Sticky;
113 tim 1740 }
114    
115     bool isShape() {
116 tim 1787 return atp.is_Shape;
117 tim 1740 }
118    
119     //below functions are just forward functions
120     /**
121     * Adds property into property map
122     * @param genData GenericData to be added into PropertyMap
123     */
124     void addProperty(GenericData* genData);
125    
126     /**
127     * Removes property from PropertyMap by name
128     * @param propName the name of property to be removed
129     */
130     void removeProperty(const std::string& propName);
131    
132     /**
133     * clear all of the properties
134     */
135     void clearProperties();
136    
137     /**
138     * Returns all names of properties
139     * @return all names of properties
140     */
141     std::vector<std::string> getPropertyNames();
142    
143     /**
144     * Returns all of the properties in PropertyMap
145     * @return all of the properties in PropertyMap
146     */
147     std::vector<GenericData*> getProperties();
148    
149     /**
150     * Returns property
151     * @param propName name of property
152     * @return a pointer point to property with propName. If no property named propName
153     * exists, return NULL
154     */
155     GenericData* getPropertyByName(const std::string& propName);
156    
157     protected:
158    
159 tim 1787 AtomTypeProperties atp;
160 tim 1740 double mass_;
161     std::string name_;
162    
163     private:
164     //prevent copy construction and copy assignment, since property map contains
165     //pointers which can not be copied and managered safely, except make the generic data
166     //at PropertyMap as copy on write shared pointer
167     AtomType(const AtomType&);
168     AtomType& operator=(const AtomType& atomType);
169    
170    
171     PropertyMap properties_;
172 gezelter 1632
173 tim 1740 };
174 gezelter 1632
175 tim 1765 struct LJParam {
176     double epsilon;
177     double sigma;
178     };
179     typedef SimpleTypeData<LJParam> LJParamGenericData;
180 tim 1769
181     struct EAMParam {
182     double latticeConstant;
183     int nrho;
184     double drho;
185     int nr;
186     double dr;
187     double rcut;
188     std::vector<double> rvals;
189     std::vector<double> rhovals;
190     std::vector<double> Frhovals;
191     };
192    
193     typedef SimpleTypeData<EAMParam> EAMParamGenericData;
194 tim 1740 }
195 gezelter 1652
196 gezelter 1631 #endif