add 'atom type' test option to force style tests

This commit is contained in:
jrgissing
2023-02-11 16:11:35 -05:00
parent ddc23bb3bf
commit 7709dfa118
6 changed files with 50 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_atom_types"] = &TestConfigReader::run_atom_types;
consumers["pair_style"] = &TestConfigReader::pair_style;
consumers["pair_coeff"] = &TestConfigReader::pair_coeff;
@ -228,6 +229,20 @@ void TestConfigReader::run_vel(const yaml_event_t &event)
}
}
void TestConfigReader::run_atom_types(const yaml_event_t &event)
{
config.run_atom_types.clear();
config.run_atom_types.resize(config.natoms + 1);
std::stringstream data((char *)event.data.scalar.value);
std::string line;
while (std::getline(data, line, '\n')) {
int tag, atom_type;
sscanf(line.c_str(), "%d %d", &tag, &atom_type);
config.run_atom_types[tag] = atom_type;
}
}
void TestConfigReader::pair_style(const yaml_event_t &event)
{
config.pair_style = (char *)event.data.scalar.value;