diff --git a/src/ML-PACE/compute_pace.cpp b/src/ML-PACE/compute_pace.cpp index 4689106452..235f555bfa 100644 --- a/src/ML-PACE/compute_pace.cpp +++ b/src/ML-PACE/compute_pace.cpp @@ -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; } \ No newline at end of file diff --git a/src/ML-PACE/pair_pace_al.cpp b/src/ML-PACE/pair_pace_al.cpp index baa14c8c08..ce8a75a6e5 100644 --- a/src/ML-PACE/pair_pace_al.cpp +++ b/src/ML-PACE/pair_pace_al.cpp @@ -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); diff --git a/src/ML-PACE/pair_pace_al.h b/src/ML-PACE/pair_pace_al.h index 7e66603092..29a76e1f3c 100644 --- a/src/ML-PACE/pair_pace_al.h +++ b/src/ML-PACE/pair_pace_al.h @@ -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;