Skip to content
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: 15 additions & 2 deletions source/lmp/pair_nnp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ PairNNP::PairNNP(LAMMPS *lmp)
numb_types = 0;
numb_models = 0;
out_freq = 0;
out_each = 0;
scale = NULL;

// set comm size needed by this Pair
Expand Down Expand Up @@ -328,10 +329,16 @@ void PairNNP::compute(int eflag, int vflag)
<< " " << setw(18) << all_e_avg
<< " " << setw(18) << all_f_max
<< " " << setw(18) << all_f_min
<< " " << setw(18) << all_f_avg
<< " " << setw(18) << all_f_avg;
// << " " << setw(18) << avg_e
// << " " << setw(18) << std_e_1 / all_nlocal
<< endl;
if (out_each == 1){
// TODO: Fix two problems:
// 1. If the atom_style is not atomic (e.g. charge), the order of std_f is different from that of atom ids.
// 2. std_f is not gathered by MPI.
for (int dd = 0; dd < all_nlocal; ++dd) fp << " " << setw(18) << std_f[dd];
}
fp << endl;
}
}
}
Expand Down Expand Up @@ -415,6 +422,7 @@ is_key (const string& input)
keys.push_back("out_freq");
keys.push_back("out_file");
keys.push_back("fparam");
keys.push_back("out_each");

for (int ii = 0; ii < keys.size(); ++ii){
if (input == keys[ii]) {
Expand Down Expand Up @@ -460,6 +468,7 @@ void PairNNP::settings(int narg, char **arg)

out_freq = 100;
out_file = "model_devi.out";
out_each = 0;
fparam.clear();
while (iarg < narg) {
if (! is_key(arg[iarg])) {
Expand All @@ -486,6 +495,10 @@ void PairNNP::settings(int narg, char **arg)
}
iarg += 1 + dim_fparam ;
}
else if (string(arg[iarg]) == string("out_each")) {
out_each = 1;
iarg += 1;
}
}
if (out_freq < 0) error->all(FLERR,"Illegal out_freq, should be >= 0");

Expand Down
1 change: 1 addition & 0 deletions source/lmp/pair_nnp.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ private:
int out_freq;
string out_file;
int dim_fparam;
int out_each;
#ifdef HIGH_PREC
vector<double > fparam;
#else
Expand Down