Merge pull request #2582 from ellio167/pair_kim_refactor

Small pair kim refactor to better support multiple run commands with different models
This commit is contained in:
Axel Kohlmeyer
2021-02-04 13:27:06 -05:00
committed by GitHub
2 changed files with 33 additions and 1 deletions

View File

@ -540,6 +540,19 @@ void PairKIM::coeff(int narg, char **arg)
kimerror = KIM_Model_ClearThenRefresh(pkim);
if (kimerror)
error->all(FLERR,"KIM KIM_Model_ClearThenRefresh returned error");
// Update cached quantities that may have changed due to Refresh
KIM_Model_GetInfluenceDistance(pkim, &kim_global_influence_distance);
KIM_Model_GetNeighborListPointers(
pkim,
&kim_number_of_neighbor_lists,
&kim_cutoff_values,
&modelWillNotRequestNeighborsOfNoncontributingParticles);
if (neighborLists) {
delete [] neighborLists;
neighborLists = nullptr;
}
neighborLists = new NeighList*[kim_number_of_neighbor_lists];
}
}
@ -591,6 +604,9 @@ void PairKIM::init_style()
neighbor->requests[irequest]->cutoff
= kim_cutoff_values[i] + neighbor->skin;
}
// increment instance_me in case of need to change the neighbor list
// request settings
instance_me += 1;
}
/* ----------------------------------------------------------------------
@ -809,6 +825,8 @@ void PairKIM::kim_free()
error->all(FLERR,"Unable to destroy Compute Arguments Object");
KIM_Model_Destroy(&pkim);
lmps_maxalloc = 0; // reinitialize member variable
}
kim_init_ok = false;
}
@ -859,7 +877,7 @@ void PairKIM::kim_init()
&modelWillNotRequestNeighborsOfNoncontributingParticles);
if (neighborLists) {
delete [] neighborLists;
neighborLists = 0;
neighborLists = nullptr;
}
neighborLists = new NeighList*[kim_number_of_neighbor_lists];

View File

@ -219,6 +219,20 @@ TEST_F(KimCommandsTest, kim_interactions)
int ifix = lmp->modify->find_fix("KIM_MODEL_STORE");
ASSERT_GE(ifix, 0);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("clear");
lmp->input->one("kim_init LennardJones_Ar real");
lmp->input->one("lattice fcc 4.4300");
lmp->input->one("region box block 0 10 0 10 0 10");
lmp->input->one("create_box 1 box");
lmp->input->one("create_atoms 1 box");
lmp->input->one("kim_interactions Ar");
lmp->input->one("mass 1 39.95");
lmp->input->one("run 1");
lmp->input->one("kim_interactions Ar");
lmp->input->one("run 1");
if (!verbose) ::testing::internal::GetCapturedStdout();
}
TEST_F(KimCommandsTest, kim_param)