reformat
This commit is contained in:
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -14,30 +13,30 @@
|
|||||||
|
|
||||||
#include "compute_pe.h"
|
#include "compute_pe.h"
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
#include "atom.h"
|
|
||||||
#include "update.h"
|
|
||||||
#include "force.h"
|
|
||||||
#include "pair.h"
|
|
||||||
#include "bond.h"
|
|
||||||
#include "angle.h"
|
#include "angle.h"
|
||||||
|
#include "atom.h"
|
||||||
|
#include "atom_masks.h"
|
||||||
|
#include "bond.h"
|
||||||
#include "dihedral.h"
|
#include "dihedral.h"
|
||||||
|
#include "domain.h"
|
||||||
|
#include "error.h"
|
||||||
|
#include "force.h"
|
||||||
#include "improper.h"
|
#include "improper.h"
|
||||||
#include "kspace.h"
|
#include "kspace.h"
|
||||||
#include "modify.h"
|
#include "modify.h"
|
||||||
#include "domain.h"
|
#include "pair.h"
|
||||||
#include "error.h"
|
#include "update.h"
|
||||||
#include "atom_masks.h"
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
ComputePE::ComputePE(LAMMPS *lmp, int narg, char **arg) :
|
ComputePE::ComputePE(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg)
|
||||||
Compute(lmp, narg, arg)
|
|
||||||
{
|
{
|
||||||
if (narg < 3) error->all(FLERR,"Illegal compute pe command");
|
if (narg < 3) error->all(FLERR, "Illegal compute pe command");
|
||||||
if (igroup) error->all(FLERR,"Compute pe must use group all");
|
if (igroup) error->all(FLERR, "Compute pe must use group all");
|
||||||
|
|
||||||
scalar_flag = 1;
|
scalar_flag = 1;
|
||||||
extscalar = 1;
|
extscalar = 1;
|
||||||
@ -56,14 +55,22 @@ ComputePE::ComputePE(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
fixflag = 0;
|
fixflag = 0;
|
||||||
int iarg = 3;
|
int iarg = 3;
|
||||||
while (iarg < narg) {
|
while (iarg < narg) {
|
||||||
if (strcmp(arg[iarg],"pair") == 0) pairflag = 1;
|
if (strcmp(arg[iarg], "pair") == 0)
|
||||||
else if (strcmp(arg[iarg],"bond") == 0) bondflag = 1;
|
pairflag = 1;
|
||||||
else if (strcmp(arg[iarg],"angle") == 0) angleflag = 1;
|
else if (strcmp(arg[iarg], "bond") == 0)
|
||||||
else if (strcmp(arg[iarg],"dihedral") == 0) dihedralflag = 1;
|
bondflag = 1;
|
||||||
else if (strcmp(arg[iarg],"improper") == 0) improperflag = 1;
|
else if (strcmp(arg[iarg], "angle") == 0)
|
||||||
else if (strcmp(arg[iarg],"kspace") == 0) kspaceflag = 1;
|
angleflag = 1;
|
||||||
else if (strcmp(arg[iarg],"fix") == 0) fixflag = 1;
|
else if (strcmp(arg[iarg], "dihedral") == 0)
|
||||||
else error->all(FLERR,"Illegal compute pe command");
|
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 command");
|
||||||
iarg++;
|
iarg++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,11 +85,10 @@ double ComputePE::compute_scalar()
|
|||||||
{
|
{
|
||||||
invoked_scalar = update->ntimestep;
|
invoked_scalar = update->ntimestep;
|
||||||
if (update->eflag_global != invoked_scalar)
|
if (update->eflag_global != invoked_scalar)
|
||||||
error->all(FLERR,"Energy was not tallied on needed timestep");
|
error->all(FLERR, "Energy was not tallied on needed timestep");
|
||||||
|
|
||||||
double one = 0.0;
|
double one = 0.0;
|
||||||
if (pairflag && force->pair)
|
if (pairflag && force->pair) one += force->pair->eng_vdwl + force->pair->eng_coul;
|
||||||
one += force->pair->eng_vdwl + force->pair->eng_coul;
|
|
||||||
|
|
||||||
if (atom->molecular != Atom::ATOMIC) {
|
if (atom->molecular != Atom::ATOMIC) {
|
||||||
if (bondflag && force->bond) one += force->bond->energy;
|
if (bondflag && force->bond) one += force->bond->energy;
|
||||||
@ -91,7 +97,7 @@ double ComputePE::compute_scalar()
|
|||||||
if (improperflag && force->improper) one += force->improper->energy;
|
if (improperflag && force->improper) one += force->improper->energy;
|
||||||
}
|
}
|
||||||
|
|
||||||
MPI_Allreduce(&one,&scalar,1,MPI_DOUBLE,MPI_SUM,world);
|
MPI_Allreduce(&one, &scalar, 1, MPI_DOUBLE, MPI_SUM, world);
|
||||||
|
|
||||||
if (kspaceflag && force->kspace) scalar += force->kspace->energy;
|
if (kspaceflag && force->kspace) scalar += force->kspace->energy;
|
||||||
|
|
||||||
@ -100,8 +106,7 @@ double ComputePE::compute_scalar()
|
|||||||
scalar += force->pair->etail / volume;
|
scalar += force->pair->etail / volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fixflag && modify->n_energy_global)
|
if (fixflag && modify->n_energy_global) scalar += modify->energy_global();
|
||||||
scalar += modify->energy_global();
|
|
||||||
|
|
||||||
return scalar;
|
return scalar;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user