change format for equilibrium values and update writer and reader code, so it will become compatible with class2 angles/dihedrals/impropers

This commit is contained in:
Axel Kohlmeyer
2020-05-30 17:50:38 -04:00
parent 07163a710a
commit 1042e16423
3 changed files with 7 additions and 5 deletions

View File

@ -287,8 +287,8 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
// equilibrium angle // equilibrium angle
std::stringstream eqstr; std::stringstream eqstr;
eqstr << lmp->force->angle->equilibrium_angle(1); eqstr << lmp->atom->nangletypes;
for (std::size_t i=1; i < config.angle_coeff.size(); ++i) { for (std::size_t i=0; i < lmp->atom->nangletypes; ++i) {
eqstr << " " << lmp->force->angle->equilibrium_angle(i+1); eqstr << " " << lmp->force->angle->equilibrium_angle(i+1);
} }
writer.emit("equilibrium", eqstr.str()); writer.emit("equilibrium", eqstr.str());

View File

@ -287,8 +287,8 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
// equilibrium distance // equilibrium distance
std::stringstream eqstr; std::stringstream eqstr;
eqstr << lmp->force->bond->equilibrium_distance(1); eqstr << lmp->atom->nbondtypes;
for (std::size_t i=1; i < config.bond_coeff.size(); ++i) { for (std::size_t i=0; i < lmp->atom->nbondtypes; ++i) {
eqstr << " " << lmp->force->bond->equilibrium_distance(i+1); eqstr << " " << lmp->force->bond->equilibrium_distance(i+1);
} }
writer.emit("equilibrium", eqstr.str()); writer.emit("equilibrium", eqstr.str());

View File

@ -213,7 +213,9 @@ void TestConfigReader::equilibrium(const yaml_event_t & event) {
std::stringstream data((char *)event.data.scalar.value); std::stringstream data((char *)event.data.scalar.value);
config.equilibrium.clear(); config.equilibrium.clear();
double value; double value;
while (1) { std::size_t num;
data >> num;
for (std::size_t i=0; i < num; ++i) {
data >> value; data >> value;
if (data.eof()) break; if (data.eof()) break;
config.equilibrium.push_back(value); config.equilibrium.push_back(value);