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 name_space std; |
14 |
|
15 |
name_space 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 |
* Finishes off the AtomType by communicating the logical portions of the |
31 |
* structure to the Fortran atype module |
32 |
*/ |
33 |
void complete(); |
34 |
|
35 |
void setMass(double m) { |
36 |
mass_ = m; |
37 |
} |
38 |
|
39 |
double getMass(void) { |
40 |
return mass_; |
41 |
} |
42 |
|
43 |
void setIdent(int id) { |
44 |
atp_.ident = id; |
45 |
} |
46 |
|
47 |
int getIdent() { |
48 |
return atp_.ident; |
49 |
} |
50 |
|
51 |
void setName(const std::string&name) { |
52 |
name_ = name; |
53 |
} |
54 |
|
55 |
std::string getName() { |
56 |
return name_; |
57 |
} |
58 |
|
59 |
void setLennardJones() { |
60 |
atp_.is_LennardJones = 1; |
61 |
} |
62 |
|
63 |
bool isLennardJones() { |
64 |
return atp_.is_LennardJones; |
65 |
} |
66 |
|
67 |
void setElectrostatic() { |
68 |
atp_.is_Electrostatic = 1; |
69 |
} |
70 |
|
71 |
bool isElectrostatic() { |
72 |
return atp_.is_Electrostatic; |
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 |
atp_.is_Electrostatic = 1; |
86 |
} |
87 |
|
88 |
bool isCharge() { |
89 |
return atp_.is_Charge; |
90 |
} |
91 |
|
92 |
bool isDirectional() { |
93 |
return atp_.is_Directional; |
94 |
} |
95 |
|
96 |
bool isDipole() { |
97 |
return atp_.is_Dipole; |
98 |
} |
99 |
|
100 |
bool isGayBerne() { |
101 |
return atp_.is_GayBerne; |
102 |
} |
103 |
|
104 |
bool isSticky() { |
105 |
return atp_.is_Sticky; |
106 |
} |
107 |
|
108 |
bool isShape() { |
109 |
return atp_.is_Shape; |
110 |
} |
111 |
|
112 |
//below functions are just forward functions |
113 |
/** |
114 |
* Adds property into property map |
115 |
* @param genData GenericData to be added into PropertyMap |
116 |
*/ |
117 |
void addProperty(GenericData* genData); |
118 |
|
119 |
/** |
120 |
* Removes property from PropertyMap by name |
121 |
* @param propName the name of property to be removed |
122 |
*/ |
123 |
void removeProperty(const std::string& propName); |
124 |
|
125 |
/** |
126 |
* clear all of the properties |
127 |
*/ |
128 |
void clearProperties(); |
129 |
|
130 |
/** |
131 |
* Returns all names of properties |
132 |
* @return all names of properties |
133 |
*/ |
134 |
std::vector<std::string> getPropertyNames(); |
135 |
|
136 |
/** |
137 |
* Returns all of the properties in PropertyMap |
138 |
* @return all of the properties in PropertyMap |
139 |
*/ |
140 |
std::vector<GenericData*> getProperties(); |
141 |
|
142 |
/** |
143 |
* Returns property |
144 |
* @param propName name of property |
145 |
* @return a pointer point to property with propName. If no property named propName |
146 |
* exists, return NULL |
147 |
*/ |
148 |
GenericData* getPropertyByName(const std::string& propName); |
149 |
|
150 |
protected: |
151 |
|
152 |
AtomTypeProperties atp_; |
153 |
double mass_; |
154 |
std::string name_; |
155 |
|
156 |
private: |
157 |
//prevent copy construction and copy assignment, since property map contains |
158 |
//pointers which can not be copied and managered safely, except make the generic data |
159 |
//at PropertyMap as copy on write shared pointer |
160 |
AtomType(const AtomType&); |
161 |
AtomType& operator=(const AtomType& atomType); |
162 |
|
163 |
|
164 |
PropertyMap properties_; |
165 |
|
166 |
}; |
167 |
|
168 |
struct LJParam { |
169 |
double epsilon; |
170 |
double sigma; |
171 |
}; |
172 |
typedef SimpleTypeData<LJParam> LJParamGenericData; |
173 |
|
174 |
} |
175 |
|
176 |
#endif |