pair_pace_al.cpp: use comm->me, throw more detailed error when extrapolate

compute_pace.cpp: comment out logmessage
This commit is contained in:
Yury Lysogorskiy
2022-06-27 13:03:59 +02:00
parent afd8e1d060
commit 23959d4330
2 changed files with 11 additions and 9 deletions

View File

@ -62,6 +62,7 @@ double ComputePaceAtom::compute_scalar() {
auto pair = (PairPACEActiveLearning *) pair_pace_al;
if (invoked_scalar != pair->bevaluator_timestep) {
//TODO: somehow control the frequency of extra computation and warn user about adjusting gamma_freq?
// utils::logmesg(lmp,"[ComputePaceAtom::compute_scalar] Reseting timestep shift to {} (pace timestep={}) and recomputing\n",invoked_scalar,pair->bevaluator_timestep);
pair->bevaluator_timestep_shift = invoked_scalar;
//TODO: is that right calling of pair pace compute?
@ -76,6 +77,7 @@ void ComputePaceAtom::compute_peratom() {
invoked_peratom = update->ntimestep;
auto pair = (PairPACEActiveLearning *) pair_pace_al;
if (invoked_peratom != pair->bevaluator_timestep) {
//TODO: somehow control the frequency of extra computation and warn user about adjusting gamma_freq?
// utils::logmesg(lmp,"[ComputePaceAtom::compute_peratom] Reseting timestep shift to {} (pace timestep={}) and recomputing\n",invoked_peratom,pair->bevaluator_timestep);
pair->bevaluator_timestep_shift = invoked_peratom;
//TODO: is that right calling of pair pace compute?

View File

@ -313,27 +313,27 @@ void PairPACEActiveLearning::compute(int eflag, int vflag) {
if (vflag_fdotr) virial_fdotr_compute();
//TODO: check correctness of MPI usage, maybe use comm->me==0 instead ?
//TODO: check correctness of MPI usage
if (is_bevaluator) {
//gather together max_gamma_grade_per_structure
MPI_Allreduce(&max_gamma_grade, &max_gamma_grade_per_structure, 1, MPI_DOUBLE, MPI_MAX, world);
int mpi_rank;
MPI_Comm_rank(world, &mpi_rank);
if (max_gamma_grade_per_structure > gamma_upper_bound) {
if (mpi_rank == 0)
if (comm->me == 0)
dump_extrapolation_grade(update->ntimestep, max_gamma_grade_per_structure);
if (is_dump_extrapolative_structures) dump->write();
MPI_Barrier(world);
if (mpi_rank == 0) {
error->all(FLERR, "Extrapolation grade is too large, stopping...\n");
}
if (comm->me == 0)
error->all(FLERR,
"Extrapolation grade is too large (gamma={:.3f} > gamma_upper_bound={:.3f}, timestep={}), stopping...\n",
max_gamma_grade_per_structure, gamma_upper_bound, current_timestep);
MPI_Abort(world, 1); //abort properly with error code '1' if not using 4 processes
MPI_Barrier(world);
MPI_Abort(world, 1); //abort properly with error code '1' if not using many processes
exit(EXIT_FAILURE);
} else if (max_gamma_grade_per_structure > gamma_lower_bound) {
if (mpi_rank == 0)
if (comm->me == 0)
dump_extrapolation_grade(update->ntimestep, max_gamma_grade_per_structure);
if (is_dump_extrapolative_structures)
dump->write();