git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@15290 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2016-07-12 22:40:29 +00:00
parent c5aece5b43
commit 6ec2346ca0
2 changed files with 13 additions and 1 deletions

View File

@ -23,6 +23,8 @@
#include "dihedral.h"
#include "improper.h"
#include "kspace.h"
#include "modify.h"
#include "fix.h"
#include "memory.h"
#include "error.h"
@ -45,10 +47,12 @@ ComputePEAtom::ComputePEAtom(LAMMPS *lmp, int narg, char **arg) :
pairflag = 1;
bondflag = angleflag = dihedralflag = improperflag = 1;
kspaceflag = 1;
fixflag = 1;
} else {
pairflag = 0;
bondflag = angleflag = dihedralflag = improperflag = 0;
kspaceflag = 0;
fixflag = 0;
int iarg = 3;
while (iarg < narg) {
if (strcmp(arg[iarg],"pair") == 0) pairflag = 1;
@ -57,6 +61,7 @@ ComputePEAtom::ComputePEAtom(LAMMPS *lmp, int narg, char **arg) :
else if (strcmp(arg[iarg],"dihedral") == 0) dihedralflag = 1;
else if (strcmp(arg[iarg],"improper") == 0) improperflag = 1;
else if (strcmp(arg[iarg],"kspace") == 0) kspaceflag = 1;
else if (strcmp(arg[iarg],"fix") == 0) fixflag = 1;
else error->all(FLERR,"Illegal compute pe/atom command");
iarg++;
}
@ -145,6 +150,12 @@ void ComputePEAtom::compute_peratom()
for (i = 0; i < nkspace; i++) energy[i] += eatom[i];
}
// add in per-atom contributions from relevant fixes
// always only for owned atoms, not ghost
if (fixflag && modify->n_thermo_energy_atom)
modify->thermo_energy_atom(nlocal,energy);
// communicate ghost energy between neighbor procs
if (force->newton || (force->kspace && force->kspace->tip4pflag))