From da75fc3eaafd7117003b0ad6f6dfb0771b0b1620 Mon Sep 17 00:00:00 2001 From: Steven Strong Date: Wed, 8 May 2019 09:05:09 -0500 Subject: [PATCH] incorporate compute_pe_e3b into compute_pair --- doc/src/Commands_compute.txt | 1 - doc/src/compute.txt | 1 - doc/src/compute_pe_e3b.txt | 60 --------------------- doc/src/computes.txt | 1 - doc/src/pair_e3b.txt | 6 +-- examples/USER/e3b/README | 2 +- examples/USER/e3b/in.e3b-tip4p2005 | 4 +- src/.gitignore | 7 +-- src/USER-MISC/README | 1 - src/USER-MISC/compute_pe_e3b.cpp | 86 ------------------------------ src/USER-MISC/compute_pe_e3b.h | 45 ---------------- src/USER-MISC/pair_e3b.cpp | 14 +++-- src/USER-MISC/pair_e3b.h | 6 --- 13 files changed, 19 insertions(+), 215 deletions(-) delete mode 100644 doc/src/compute_pe_e3b.txt delete mode 100644 src/USER-MISC/compute_pe_e3b.cpp delete mode 100644 src/USER-MISC/compute_pe_e3b.h diff --git a/doc/src/Commands_compute.txt b/doc/src/Commands_compute.txt index e36234a306..f566702609 100644 --- a/doc/src/Commands_compute.txt +++ b/doc/src/Commands_compute.txt @@ -91,7 +91,6 @@ KOKKOS, o = USER-OMP, t = OPT. "pe/atom"_compute_pe_atom.html, "pe/mol/tally"_compute_tally.html, "pe/tally"_compute_tally.html, -"pe/e3b"_compute_pe_e3b.html, "plasticity/atom"_compute_plasticity_atom.html, "pressure"_compute_pressure.html, "pressure/cylinder"_compute_pressure_cylinder.html, diff --git a/doc/src/compute.txt b/doc/src/compute.txt index 047d838b2d..87dbee57d6 100644 --- a/doc/src/compute.txt +++ b/doc/src/compute.txt @@ -240,7 +240,6 @@ compute"_Commands_compute.html doc page are followed by one or more of "pe/atom"_compute_pe_atom.html - potential energy for each atom "pe/mol/tally"_compute_tally.html - "pe/tally"_compute_tally.html - -"pe/e3b"_compute_pe_e3b.html - potential energy from pair_style e3b "plasticity/atom"_compute_plasticity_atom.html - Peridynamic plasticity for each atom "pressure"_compute_pressure.html - total pressure and pressure tensor "pressure/cylinder"_compute_pressure_cylinder.html - diff --git a/doc/src/compute_pe_e3b.txt b/doc/src/compute_pe_e3b.txt deleted file mode 100644 index 8fdfd6c1c6..0000000000 --- a/doc/src/compute_pe_e3b.txt +++ /dev/null @@ -1,60 +0,0 @@ -"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c - -:link(lws,http://lammps.sandia.gov) -:link(ld,Manual.html) -:link(lc,Commands_all.html) - -:line - -compute pe/e3b command :h3 - -[Syntax:] - -compute ID group-ID pe/e3b :pre - -ID, group-ID are documented in "compute"_compute.html command -pe/e3b = style name of this compute command :ul - -[Examples:] - -compute 1 all pe/e3b :pre - -[Description:] - -Define a computation that calculates the contribution of "pair_style e3b"_pair_e3b.html to the potential energy. -The specified group must be "all". -See the "compute pe/atom"_compute_pe_atom.html command if you want per-atom -energies. -These per-atom values could be summed for a group of atoms via the "compute reduce"_compute_reduce.html command. - -The "pair_style e3b"_pair_e3b.html potential is composed of 4 terms. -This compute calculates the total e3b contribution to the energy as well as each of the four terms. -The four terms are stored as a 4-element vector in the order pe_Ea, pe_Eb, pe_Ec, pe_E2. -See "pair_style e3b"_pair_e3b.html for more details, and an example script can be found in the examples/USER/e3b directory. - -:line - -[Output info:] - -This compute calculates a global scalar (the total e3b energy) and a global -vector of length 4 (the four energy terms), which can be accessed by indices -1-4. These values can be used by any command that uses global scalar -or vector values from a compute as input. See the "Howto -output"_Howto_output.html doc page for an overview of LAMMPS output -options. - -The scalar and vector values calculated by this compute are -"extensive" and in energy -"units"_units.html. - -[Restrictions:] - -This compute must be used with "pair_style e3b"_pair_e3b.html. - -[Related commands:] - -"pair_style e3b"_pair_e3b.html, -"compute pe"_compute_pe.html, -"compute pe/atom"_compute_pe_atom.html - -[Default:] none diff --git a/doc/src/computes.txt b/doc/src/computes.txt index eefbe5116c..926b8da222 100644 --- a/doc/src/computes.txt +++ b/doc/src/computes.txt @@ -66,7 +66,6 @@ Computes :h1 compute_pair_local compute_pe compute_pe_atom - compute_pe_e3b compute_plasticity_atom compute_pressure compute_pressure_cylinder diff --git a/doc/src/pair_e3b.txt b/doc/src/pair_e3b.txt index b9e6ea2ace..fe4349a57d 100644 --- a/doc/src/pair_e3b.txt +++ b/doc/src/pair_e3b.txt @@ -86,8 +86,8 @@ This estimate defaults to 10 and can be changed using the {neigh} keyword, which If the neigh setting is too small, the simulation will fail with the error "neigh is too small". If the neigh setting is too large, the pair style will use more memory than necessary. -This pair style makes 4 different contributions to the potential energy from the E2, Ea, Eb, and Ec terms above. -The value of each of these terms can be computed using "compute pe/e3b"_compute_pe_e3b.html. +This pair style tallies a breakdown of the total E3B potential energy into sub-categories, which can be accessed via the "compute pair"_compute_pair.html command as a vector of values of length 4. +The 4 values correspond to the terms in the first equation above: the E2 term, the Ea term, the Eb term, and the Ec term. See the examples/USER/e3b directory for a complete example script. @@ -124,7 +124,7 @@ The {preset} keyword currently only works with real, metal, si, and cgs "units"_ [Related commands:] -"pair_coeff"_pair_coeff.html, "compute pe/e3b"_compute_pe_e3b.html +"pair_coeff"_pair_coeff.html, "compute pair"_compute_pair.html [Default:] diff --git a/examples/USER/e3b/README b/examples/USER/e3b/README index 9dd4c284d6..8ef1a54fa2 100644 --- a/examples/USER/e3b/README +++ b/examples/USER/e3b/README @@ -1,6 +1,6 @@ The input script in.lammps simulates bulk water using the 2015 E3B potential. -This script also demonstrates the use of compute pe/e3b to calculate the +This script also demonstrates the use of compute pair to calculate the potential energy contribution of the e3b pair style. These potential energy contributions can be found in the output file e3b.txt. See the LAMMPS documentation for more details. diff --git a/examples/USER/e3b/in.e3b-tip4p2005 b/examples/USER/e3b/in.e3b-tip4p2005 index 64b82046a6..ffb03969d2 100644 --- a/examples/USER/e3b/in.e3b-tip4p2005 +++ b/examples/USER/e3b/in.e3b-tip4p2005 @@ -74,9 +74,9 @@ velocity all create ${myT} 15856 dist gaussian rot yes mom yes run 0 velocity all scale ${myT} -compute e3b all pe/e3b +compute e3b all pair e3b fix e3b all ave/time 1 1 ${thermo_rate} c_e3b c_e3b[*] & - file e3b.txt title2 "step pe_e3b pe_ea pe_eb pe_ec pe_e2" + file e3b.txt title2 "step pe_e3b pe_e2 pe_ea pe_eb pe_ec" ############################################################################# #equilibrate bulk water at NVT diff --git a/src/.gitignore b/src/.gitignore index 3a6acbd871..54ca4549df 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -309,8 +309,6 @@ /compute_meso_t_atom.h /compute_msd_nongauss.cpp /compute_msd_nongauss.h -/compute_pe_e3b.cpp -/compute_pe_e3b.h /compute_pe_tally.cpp /compute_pe_tally.h /compute_plasticity_atom.cpp @@ -794,6 +792,10 @@ /pair_eam_cd.h /pair_eam_fs.cpp /pair_eam_fs.h +/fix_electron_stopping.cpp +/fix_electron_stopping.h +/pair_lebedeva_z.cpp +/pair_lebedeva_z.h /pair_lj_expand_coul_long.cpp /pair_lj_expand_coul_long.h /pair_edip.cpp @@ -1242,4 +1244,3 @@ /pair_smtbq.h /pair_vashishta*.cpp /pair_vashishta*.h - diff --git a/src/USER-MISC/README b/src/USER-MISC/README index 2107242826..a3fb40e26e 100644 --- a/src/USER-MISC/README +++ b/src/USER-MISC/README @@ -29,7 +29,6 @@ bond_style harmonic/shift/cut, Carsten Svaneborg, science at zqex.dk, 8 Aug 11 compute ackland/atom, Gerolf Ziegenhain, gerolf at ziegenhain.com, 4 Oct 2007 compute basal/atom, Christopher Barrett, cdb333 at cavs.msstate.edu, 3 Mar 2013 compute cnp/atom, Paulo Branicio (USC), branicio at usc.edu, 31 May 2017 -compute pe/e3b, Steven Strong (U Chicago), stevene.strong at gmail dot com, 16 Apr 19 compute entropy/atom, Pablo Piaggi (EPFL), pablo.piaggi at epfl.ch, 15 June 2018 compute pressure/cylinder, Cody K. Addington (NCSU), , 2 Oct 2018 compute stress/mop, Romain Vermorel (U Pau) & Laurent Joly (U Lyon), romain.vermorel at univ-pau.fr & ljoly.ulyon at gmail.com, 5 Sep 18 diff --git a/src/USER-MISC/compute_pe_e3b.cpp b/src/USER-MISC/compute_pe_e3b.cpp deleted file mode 100644 index c2d63e074e..0000000000 --- a/src/USER-MISC/compute_pe_e3b.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. - - contributing author: Steven E Strong - stevene.strong at gmail dot com -------------------------------------------------------------------------- */ - -#include "compute_pe_e3b.h" -#include "pair_e3b.h" - -#include "pair.h" -#include "update.h" -#include "error.h" -#include "force.h" - -using namespace LAMMPS_NS; - -/* ---------------------------------------------------------------------- */ - -ComputePEE3B::ComputePEE3B(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), e3b(NULL) -{ - // 0 1 2 - //compute ID grp pe/e3b - if (narg != 3) error->all(FLERR,"Illegal compute pe/e3b command"); - - scalar_flag = 1; - vector_flag = 1; - size_vector = 4; //etotA,etotB,etotC,etot2 - extvector = extscalar = 1; - timeflag = 1; - - peflag = 1; // we need Pair::ev_tally() to be run - - invoked_vector = invoked_scalar = -1; - vector = new double[size_vector]; -} - -/* ---------------------------------------------------------------------- */ - -ComputePEE3B::~ComputePEE3B() -{ - delete[] vector; -} - -/* ---------------------------------------------------------------------- */ - -void ComputePEE3B::init() { - Pair *pair = force->pair_match("e3b",false,0); - if (pair==NULL) - error->all(FLERR,"This compute must be used with pair_style e3b"); - - e3b = (PairE3B *) pair; - if (e3b==NULL) - error->all(FLERR,"something went wrong"); -} - -/* ---------------------------------------------------------------------- */ - -void ComputePEE3B::compute_vector() -{ - invoked_vector = update->ntimestep; - if (update->eflag_global != invoked_scalar) - error->all(FLERR,"Energy was not tallied on needed timestep"); - - // sum energies across procs - MPI_Allreduce(e3b->etot,vector,4,MPI_DOUBLE,MPI_SUM,world); -} - -double ComputePEE3B::compute_scalar() { - invoked_scalar = update->ntimestep; - if (invoked_scalar != invoked_vector) - compute_vector(); - - scalar = vector[0]+vector[1]+vector[2]+vector[3]; - return scalar; -} diff --git a/src/USER-MISC/compute_pe_e3b.h b/src/USER-MISC/compute_pe_e3b.h deleted file mode 100644 index a23c48b38d..0000000000 --- a/src/USER-MISC/compute_pe_e3b.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- c++ -*- ---------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -#ifdef COMPUTE_CLASS - -ComputeStyle(pe/e3b,ComputePEE3B) - -#else - -#ifndef LMP_COMPUTE_PEE3B_H -#define LMP_COMPUTE_PEE3B_H - -#include "compute.h" - -namespace LAMMPS_NS { - -class ComputePEE3B : public Compute { - - public: - ComputePEE3B(class LAMMPS *, int, char **); - virtual ~ComputePEE3B(); - - void init(); - - double compute_scalar(); - void compute_vector(); - - private: - class PairE3B *e3b; -}; - -} - -#endif -#endif diff --git a/src/USER-MISC/pair_e3b.cpp b/src/USER-MISC/pair_e3b.cpp index d6ed8f8cf2..1be5f5100d 100644 --- a/src/USER-MISC/pair_e3b.cpp +++ b/src/USER-MISC/pair_e3b.cpp @@ -48,6 +48,8 @@ PairE3B::PairE3B(LAMMPS *lmp) : Pair(lmp),pairPerAtom(10) single_enable = 0; restartinfo = 0; one_coeff = 1; + nextra=4; //store and tally pot energy terms eA, eB, eC, and e2 + pvector = new double[nextra]; allocatedE3B = false; pairO = NULL; @@ -78,6 +80,8 @@ PairE3B::~PairE3B() memory->destroy(fpair3); memory->destroy(sumExp); } + + delete[] pvector; } /* ---------------------------------------------------------------------- */ @@ -99,7 +103,7 @@ void PairE3B::compute(int eflag, int vflag) memset(sumExp,0.0,nbytes); evdwl = 0.0; - etot[0]=etot[1]=etot[2]=etot[3]=0.0; + pvector[0]=pvector[1]=pvector[2]=pvector[3]=0.0; if (eflag || vflag) ev_setup(eflag,vflag); else evflag = vflag_fdotr = 0; @@ -161,7 +165,7 @@ void PairE3B::compute(int eflag, int vflag) if (evflag) { ev_tally(i,j,nlocal,newton_pair,tmpexp,0.0,fpair,delx,dely,delz); - etot[3] += tmpexp; + pvector[0] += tmpexp; } } //end if rsq