output potential energy with fix efield with equal style variables

This commit is contained in:
Axel Kohlmeyer
2023-03-11 17:45:38 -05:00
parent 37b7ba7cae
commit 6b6f8087d3

View File

@ -273,12 +273,12 @@ void FixEfield::post_force(int vflag)
double **x = atom->x; double **x = atom->x;
double fx, fy, fz; double fx, fy, fz;
double v[6]; double v[6], unwrap[3];
;
// constant efield // constant efield
if (varflag == CONSTANT) { if (varflag == CONSTANT) {
double unwrap[3];
// charge interactions // charge interactions
// force = qE, potential energy = F dot x in unwrapped coords // force = qE, potential energy = F dot x in unwrapped coords
@ -385,7 +385,12 @@ void FixEfield::post_force(int vflag)
} }
f[i][2] += fz; f[i][2] += fz;
fsum[3] += fz; fsum[3] += fz;
if (estyle == ATOM) fsum[0] += efield[0][3]; if (estyle == ATOM) {
fsum[0] += efield[0][3];
} else {
domain->unmap(x[i], image[i], unwrap);
fsum[0] -= fx * unwrap[0] + fy * unwrap[1] + fz * unwrap[2];
}
} }
} }