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