Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

append to out_file when LAMMPS restarts #640

Merged
merged 1 commit into from
May 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions source/lmp/pair_deepmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ PairDeepMD::PairDeepMD(LAMMPS *lmp)
if (strcmp(update->unit_style,"metal") != 0) {
error->all(FLERR,"Pair deepmd requires metal unit, please set it by \"units metal\"");
}
restartinfo = 1;
pppmflag = 1;
respa_enable = 0;
writedata = 0;
Expand All @@ -254,6 +255,7 @@ PairDeepMD::PairDeepMD(LAMMPS *lmp)
single_model = false;
multi_models_mod_devi = false;
multi_models_no_mod_devi = false;
is_restart = false;
// set comm size needed by this Pair
comm_reverse = 1;

Expand Down Expand Up @@ -855,6 +857,7 @@ void PairDeepMD::settings(int narg, char **arg)

if (comm->me == 0){
if (numb_models > 1 && out_freq > 0){
if (!is_restart) {
fp.open (out_file);
fp << scientific;
fp << "#"
Expand All @@ -866,6 +869,10 @@ void PairDeepMD::settings(int narg, char **arg)
<< setw(18+1) << "min_devi_f"
<< setw(18+1) << "avg_devi_f"
<< endl;
} else {
fp.open (out_file, std::ofstream::out | std::ofstream::app);
fp << scientific;
}
}
string pre = " ";
cout << pre << ">>> Info of model(s):" << endl
Expand Down Expand Up @@ -901,6 +908,16 @@ void PairDeepMD::settings(int narg, char **arg)
all_force.resize(numb_models);
}

void PairDeepMD::read_restart(FILE *)
{
is_restart = true;
}

void PairDeepMD::write_restart(FILE *)
{
// pass
}

/* ----------------------------------------------------------------------
set coeffs for one or more type pairs
------------------------------------------------------------------------- */
Expand Down
3 changes: 3 additions & 0 deletions source/lmp/pair_deepmd.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class PairDeepMD : public Pair {
void settings(int, char **);
virtual void coeff(int, char **);
void init_style();
virtual void write_restart(FILE *);
virtual void read_restart(FILE *);
double init_one(int i, int j);
int pack_reverse_comm(int, int, double *);
void unpack_reverse_comm(int, int *, double *);
Expand Down Expand Up @@ -75,6 +77,7 @@ private:
bool single_model;
bool multi_models_mod_devi;
bool multi_models_no_mod_devi;
bool is_restart;
#ifdef HIGH_PREC
std::vector<double > fparam;
std::vector<double > aparam;
Expand Down