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

File Contents

# Content
1 #ifndef TYPES_ATOMTYPE_HPP
2
3 #define TYPES_ATOMTYPE_HPP
4
5 #include <string>
6
7 #include "utils/PropertyMap.hpp"
8
9 #define __C
10 #include "types/AtomTypeProperties.h"
11 #include "UseTheForce/DarkSide/atype_interface.h"
12
13 using namespace std;
14
15 namespace oopse {
16 /**
17 * @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 */
23 class AtomType {
24 public:
25
26 AtomType();
27
28 virtual ~AtomType() { } ;
29
30 virtual void complete();
31
32 /**
33 * Finishes off the AtomType by communicating the logical portions of the
34 * structure to the Fortran atype module
35 */
36 void makeFortranAtomType();
37
38 void setMass(double m) {
39 mass_ = m;
40 }
41
42 double getMass(void) {
43 return mass_;
44 }
45
46 void setIdent(int id) {
47 atp.ident = id;
48 }
49
50 int getIdent() {
51 return atp.ident;
52 }
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 atp.is_LennardJones = 1;
64 }
65
66 bool isLennardJones() {
67 return atp.is_LennardJones;
68 }
69
70
71 bool isElectrostatic() {
72 return isCharge() || isMultipole();
73 }
74
75 void setEAM() {
76 atp.is_EAM = 1;
77 }
78
79 bool isEAM() {
80 return atp.is_EAM;
81 }
82
83 void setCharge() {
84 atp.is_Charge = 1;
85 }
86
87 bool isCharge() {
88 return atp.is_Charge;
89 }
90
91 bool isDirectional() {
92 return atp.is_Directional;
93 }
94
95 bool isDipole() {
96 return atp.is_Dipole;
97 }
98
99 bool isQuadrupole() {
100 return atp.is_Quadrupole;
101 }
102
103 bool isMultipole() {
104 return isDipole() || isQuadrupole();
105 }
106
107 bool isGayBerne() {
108 return atp.is_GayBerne;
109 }
110
111 bool isSticky() {
112 return atp.is_Sticky;
113 }
114
115 bool isShape() {
116 return atp.is_Shape;
117 }
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 AtomTypeProperties atp;
160 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
173 };
174
175 struct LJParam {
176 double epsilon;
177 double sigma;
178 };
179 typedef SimpleTypeData<LJParam> LJParamGenericData;
180
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 }
195
196 #endif