added run_torque and EXPECT_TORQUES

This commit is contained in:
alphataubio
2024-08-04 22:40:36 -04:00
parent c2e192e734
commit af203f7fc7
6 changed files with 51 additions and 0 deletions

View File

@ -48,6 +48,7 @@ TestConfigReader::TestConfigReader(TestConfig &config) : config(config)
consumers["run_forces"] = &TestConfigReader::run_forces;
consumers["run_pos"] = &TestConfigReader::run_pos;
consumers["run_vel"] = &TestConfigReader::run_vel;
consumers["run_torque"] = &TestConfigReader::run_torque;
consumers["pair_style"] = &TestConfigReader::pair_style;
consumers["pair_coeff"] = &TestConfigReader::pair_coeff;
@ -228,6 +229,21 @@ void TestConfigReader::run_vel(const yaml_event_t &event)
}
}
void TestConfigReader::run_torque(const yaml_event_t &event)
{
config.run_torque.clear();
config.run_torque.resize(config.natoms + 1);
std::stringstream data((char *)event.data.scalar.value);
std::string line;
while (std::getline(data, line, '\n')) {
int tag;
coord_t xyz;
sscanf(line.c_str(), "%d %lg %lg %lg", &tag, &xyz.x, &xyz.y, &xyz.z);
config.run_torque[tag] = xyz;
}
}
void TestConfigReader::pair_style(const yaml_event_t &event)
{
config.pair_style = (char *)event.data.scalar.value;