42 |
|
#include "io/ElectrostaticAtomTypesSectionParser.hpp" |
43 |
|
#include "UseTheForce/ForceField.hpp" |
44 |
|
#include "utils/NumericConstant.hpp" |
45 |
+ |
#include "utils/simError.h" |
46 |
|
namespace oopse { |
47 |
|
|
48 |
|
ElectrostaticAtomTypesSectionParser::ElectrostaticAtomTypesSectionParser() { |
68 |
|
// name 2 charge |u| Qxx Qyy Qzz [theta phi psi] |
69 |
|
|
70 |
|
if (nTokens < 2) { |
71 |
< |
std::cerr << "ElectrostaticAtomTypesSectionParser Error: Not enought Tokens at line " << lineNo << std::endl; |
71 |
> |
sprintf(painCave.errMsg, "ElectrostaticAtomTypesSectionParser Error: Not enough tokens at line %d\n", |
72 |
> |
lineNo); |
73 |
> |
painCave.isFatal = 1; |
74 |
> |
simError(); |
75 |
|
} else { |
76 |
|
|
77 |
|
std::string atomTypeName = tokenizer.nextToken(); |
91 |
|
|
92 |
|
dAtomType = dynamic_cast<DirectionalAtomType*>(atomType); |
93 |
|
if (dAtomType == NULL) { |
94 |
< |
std::cerr << "ElectrostaticAtomTypesSectionParser Warning:" << std::endl; |
94 |
> |
sprintf(painCave.errMsg, "ElectrostaticAtomTypesSectionParser Error: Can not Cast Atom to DirectionalAtom at line \n"); |
95 |
> |
painCave.isFatal = 1; |
96 |
> |
simError(); |
97 |
|
} |
98 |
|
|
99 |
|
parseCharge(tokenizer, dAtomType); |
105 |
|
|
106 |
|
dAtomType = dynamic_cast<DirectionalAtomType*>(atomType); |
107 |
|
if (dAtomType == NULL) { |
108 |
< |
std::cerr << "ElectrostaticAtomTypesSectionParser Warning:" << std::endl; |
108 |
> |
sprintf(painCave.errMsg, "ElectrostaticAtomTypesSectionParser Error: Can not Cast Atom to DirectionalAtom at line \n"); |
109 |
> |
painCave.isFatal = 1; |
110 |
> |
simError(); |
111 |
|
} |
112 |
|
|
113 |
|
parseCharge(tokenizer, dAtomType); |
122 |
|
} |
123 |
|
|
124 |
|
} else { |
125 |
< |
std::cerr << "ElectrostaticAtomTypesSectionParser Error: Can not find matched AtomType " << atomTypeName |
126 |
< |
<< "at line " << lineNo << std::endl; |
125 |
> |
|
126 |
> |
sprintf(painCave.errMsg, "ElectrostaticAtomTypesSectionParser Error: Can not find matched AtomType at line %d\n", |
127 |
> |
lineNo); |
128 |
> |
painCave.isFatal = 1; |
129 |
> |
simError(); |
130 |
|
} |
131 |
|
|
132 |
|
} |
180 |
|
double psi; |
181 |
|
|
182 |
|
if (tokenizer.countTokens() >=3 ) { |
183 |
< |
phi = tokenizer.nextTokenAsDouble()/180.0; |
184 |
< |
theta = tokenizer.nextTokenAsDouble()/180.0; |
185 |
< |
psi = tokenizer.nextTokenAsDouble()/180.0; |
183 |
> |
phi = tokenizer.nextTokenAsDouble() * NumericConstant::PI /180.0; |
184 |
> |
theta = tokenizer.nextTokenAsDouble() * NumericConstant::PI /180.0; |
185 |
> |
psi = tokenizer.nextTokenAsDouble() * NumericConstant::PI /180.0; |
186 |
|
} else { |
187 |
|
phi = 0.0; |
188 |
|
theta = 0.0; |