WIP: bevaluator_timestep_shift

This commit is contained in:
Yury Lysogorskiy
2022-06-24 15:04:19 +02:00
parent 79c7a50ffc
commit c6e12dc6d3
3 changed files with 18 additions and 6 deletions

View File

@ -58,10 +58,16 @@ void ComputePaceAtom::init() {
}
double ComputePaceAtom::compute_scalar() {
invoked_peratom = update->ntimestep;
invoked_scalar = update->ntimestep;
auto pair = (PairPACEActiveLearning *) pair_pace_al;
if (invoked_peratom != pair->bevaluator_timestep)
error->all(FLERR, "PACE/gamma was not computed on needed timestep.\nIncrease `freq` in pair_style pace/al [gamma_lower_bound] [gamma_upper_bound] [freq] or reset timestep to 0");
if (invoked_scalar != pair->bevaluator_timestep) {
// error->all(FLERR,
// "PACE/gamma was not computed on needed timestep.\nIncrease `freq` in pair_style pace/al [gamma_lower_bound] [gamma_upper_bound] [freq] or reset timestep to 0");
utils::logmesg(lmp,"[ComputePaceAtom::compute_scalar] Reseting timestep shift to {} and recomputing\n",invoked_scalar);
pair->bevaluator_timestep_shift = invoked_scalar;
pair->compute(1, 1);
}
scalar = pair->max_gamma_grade_per_structure;
return scalar;
@ -70,8 +76,13 @@ double ComputePaceAtom::compute_scalar() {
void ComputePaceAtom::compute_peratom() {
invoked_peratom = update->ntimestep;
auto pair = (PairPACEActiveLearning *) pair_pace_al;
if (invoked_peratom != pair->bevaluator_timestep)
error->all(FLERR, "PACE/gamma was not computed on needed timestep.\nIncrease `freq` in pair_style pace/al [gamma_lower_bound] [gamma_upper_bound] [freq] or reset timestep to 0");
if (invoked_peratom != pair->bevaluator_timestep) {
// error->all(FLERR,
// "PACE/gamma was not computed on needed timestep.\nIncrease `freq` in pair_style pace/al [gamma_lower_bound] [gamma_upper_bound] [freq] or reset timestep to 0");
utils::logmesg(lmp,"[ComputePaceAtom::compute_scalar] Reseting timestep shift to {} and recomputing\n",invoked_scalar);
pair->bevaluator_timestep_shift = invoked_peratom;
pair->compute(1, 1);
}
vector_atom = pair->extrapolation_grade_gamma;
}

View File

@ -224,7 +224,7 @@ void PairPACEActiveLearning::compute(int eflag, int vflag) {
}
int current_timestep = update->ntimestep;
bool is_bevaluator = current_timestep % gamma_grade_eval_freq == 0;
bool is_bevaluator = (current_timestep - bevaluator_timestep_shift) % gamma_grade_eval_freq == 0;
if (is_bevaluator)
aceimpl->ace->resize_neighbours_cache(max_jnum);

View File

@ -77,6 +77,7 @@ namespace LAMMPS_NS {
double rcutmax; // max cutoff for all elements
int nelements; // # of unique elements
int bevaluator_timestep; // timestep, on which gamma grade were computed
int bevaluator_timestep_shift = 0; //
double *extrapolation_grade_gamma; //per-atom gamma value
double **scale;