24 |
|
*/ |
25 |
|
|
26 |
|
#include "io/ElectrostaticAtomTypesSectionParser.hpp" |
27 |
– |
|
27 |
|
#include "UseTheForce/ForceField.hpp" |
28 |
< |
|
28 |
> |
#include "utils/NumericConstant.hpp" |
29 |
|
namespace oopse { |
30 |
|
|
31 |
|
ElectrostaticAtomTypesSectionParser::ElectrostaticAtomTypesSectionParser() { |
112 |
|
AtomType* atomType) { |
113 |
|
|
114 |
|
double charge = tokenizer.nextTokenAsDouble(); |
115 |
< |
atomType->addProperty(new DoubleGenericData("Charge", charge)); |
116 |
< |
atomType->setCharge(); |
117 |
< |
|
115 |
> |
|
116 |
> |
if (fabs(charge) > NumericConstant::epsilon) { |
117 |
> |
atomType->addProperty(new DoubleGenericData("Charge", charge)); |
118 |
> |
atomType->setCharge(); |
119 |
> |
} |
120 |
|
} |
121 |
|
void ElectrostaticAtomTypesSectionParser::parseDipole(StringTokenizer& tokenizer, |
122 |
|
DirectionalAtomType* dAtomType) { |
123 |
|
|
124 |
< |
double Dipole = tokenizer.nextTokenAsDouble(); |
125 |
< |
dAtomType->addProperty(new DoubleGenericData("Dipole", Dipole)); |
126 |
< |
dAtomType->setDipole(); |
124 |
> |
double dipole = tokenizer.nextTokenAsDouble(); |
125 |
> |
|
126 |
> |
if (fabs(dipole) > NumericConstant::epsilon) { |
127 |
> |
|
128 |
> |
dAtomType->addProperty(new DoubleGenericData("Dipole", dipole)); |
129 |
> |
dAtomType->setDipole(); |
130 |
> |
} |
131 |
|
} |
132 |
|
|
133 |
|
void ElectrostaticAtomTypesSectionParser::parseQuadruple(StringTokenizer& tokenizer, |
137 |
|
Q[0] = tokenizer.nextTokenAsDouble(); |
138 |
|
Q[1] = tokenizer.nextTokenAsDouble(); |
139 |
|
Q[2] = tokenizer.nextTokenAsDouble(); |
140 |
< |
|
141 |
< |
dAtomType->addProperty(new Vector3dGenericData("Quadrupole", Q)); |
142 |
< |
dAtomType->setQuadrupole(); |
140 |
> |
|
141 |
> |
if (fabs(Q[0]) > NumericConstant::epsilon && fabs(Q[1]) > NumericConstant::epsilon |
142 |
> |
&& fabs(Q[2]) > NumericConstant::epsilon) { |
143 |
> |
|
144 |
> |
dAtomType->addProperty(new Vector3dGenericData("Quadrupole", Q)); |
145 |
> |
dAtomType->setQuadrupole(); |
146 |
> |
} |
147 |
|
} |
148 |
|
void ElectrostaticAtomTypesSectionParser::parseElectroBodyFrame(StringTokenizer& tokenizer, |
149 |
|
DirectionalAtomType* dAtomType) { |