forked from lijiext/lammps
simplify parsing of equilibrium data
This commit is contained in:
parent
7d62fd5106
commit
99c0c1ace1
|
@ -210,14 +210,13 @@ void TestConfigReader::angle_coeff(const yaml_event_t & event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestConfigReader::equilibrium(const yaml_event_t & event) {
|
void TestConfigReader::equilibrium(const yaml_event_t & event) {
|
||||||
std::string vals = (char *)event.data.scalar.value;
|
std::stringstream data((char *)event.data.scalar.value);
|
||||||
config.equilibrium.clear();
|
config.equilibrium.clear();
|
||||||
std::size_t found = vals.find_first_of(" \t");
|
double value;
|
||||||
while (found != std::string::npos) {
|
while (1) {
|
||||||
double value = atof(vals.substr(0,found).c_str());
|
data >> value;
|
||||||
|
if (data.eof()) break;
|
||||||
config.equilibrium.push_back(value);
|
config.equilibrium.push_back(value);
|
||||||
vals = vals.substr(found+1);
|
|
||||||
found = vals.find_first_of(" \t");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue