forked from lijiext/lammps
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@1192 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
parent
5d0e722080
commit
d9df67ded2
|
@ -6,7 +6,6 @@ if ($1 == 1) then
|
|||
|
||||
cp atom_vec_granular.cpp ..
|
||||
cp fix_freeze.cpp ..
|
||||
cp fix_gran_diag.cpp ..
|
||||
cp fix_nve_gran.cpp ..
|
||||
cp fix_pour.cpp ..
|
||||
cp fix_wall_gran.cpp ..
|
||||
|
@ -16,7 +15,6 @@ if ($1 == 1) then
|
|||
|
||||
cp atom_vec_granular.h ..
|
||||
cp fix_freeze.h ..
|
||||
cp fix_gran_diag.h ..
|
||||
cp fix_nve_gran.h ..
|
||||
cp fix_pour.h ..
|
||||
cp fix_wall_gran.h ..
|
||||
|
@ -31,7 +29,6 @@ else if ($1 == 0) then
|
|||
|
||||
rm ../atom_vec_granular.cpp
|
||||
rm ../fix_freeze.cpp
|
||||
rm ../fix_gran_diag.cpp
|
||||
rm ../fix_nve_gran.cpp
|
||||
rm ../fix_pour.cpp
|
||||
rm ../fix_wall_gran.cpp
|
||||
|
@ -41,7 +38,6 @@ else if ($1 == 0) then
|
|||
|
||||
rm ../atom_vec_granular.h
|
||||
rm ../fix_freeze.h
|
||||
rm ../fix_gran_diag.h
|
||||
rm ../fix_nve_gran.h
|
||||
rm ../fix_pour.h
|
||||
rm ../fix_wall_gran.h
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,60 +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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef FIX_GRAN_DIAG_H
|
||||
#define FIX_GRAN_DIAG_H
|
||||
|
||||
#include "stdio.h"
|
||||
#include "fix.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class FixGranDiag : public Fix {
|
||||
public:
|
||||
FixGranDiag(class LAMMPS *, int, char **);
|
||||
~FixGranDiag();
|
||||
int setmask();
|
||||
void init();
|
||||
void setup();
|
||||
void end_of_step();
|
||||
|
||||
private:
|
||||
int me,first,pairstyle,nlayers,maxlayers,dim;
|
||||
FILE *fpden,*fpvel,*fpstr;
|
||||
double step,stepinv,boxlo,PI;
|
||||
double dt,xkk,xkkt,xmu,gamman_dl,gammas_dl;
|
||||
int freeze_group_bit;
|
||||
|
||||
int *numdens;
|
||||
double *dendens;
|
||||
double *velx,*vely,*velz;
|
||||
double *velxx,*velyy,*velzz,*velxy,*velxz,*velyz;
|
||||
double *sigxx,*sigyy,*sigzz,*sigxy,*sigxz,*sigyz;
|
||||
double *velx11,*vely11,*velz11;
|
||||
double *velxx11,*velyy11,*velzz11,*velxy11,*velxz11,*velyz11;
|
||||
double *velfxx,*velfyy,*velfzz,*velfxy,*velfxz,*velfyz;
|
||||
double *sigx2,*sigy2,*sigz2,*sigxy2,*sigxz2,*sigyz2;
|
||||
|
||||
class Pair *pair;
|
||||
class NeighList *list,*listgran;
|
||||
|
||||
void allocate();
|
||||
void deallocate();
|
||||
void stress_no_history();
|
||||
void stress_history();
|
||||
void stress_hertzian();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -21,7 +21,6 @@ AtomStyle(granular,AtomVecGranular)
|
|||
|
||||
#ifdef FixInclude
|
||||
#include "fix_freeze.h"
|
||||
#include "fix_gran_diag.h"
|
||||
#include "fix_nve_gran.h"
|
||||
#include "fix_pour.h"
|
||||
#include "fix_shear_history.h"
|
||||
|
@ -30,7 +29,6 @@ AtomStyle(granular,AtomVecGranular)
|
|||
|
||||
#ifdef FixClass
|
||||
FixStyle(freeze,FixFreeze)
|
||||
FixStyle(gran/diag,FixGranDiag)
|
||||
FixStyle(nve/gran,FixNVEGran)
|
||||
FixStyle(pour,FixPour)
|
||||
FixStyle(SHEAR_HISTORY,FixShearHistory)
|
||||
|
|
|
@ -122,6 +122,15 @@ void PairMEAM::compute(int eflag, int vflag)
|
|||
int *ilist_half,*jlist_half,*numneigh_half,**firstneigh_half;
|
||||
int *numneigh_full,**firstneigh_full;
|
||||
|
||||
evdwl = 0.0;
|
||||
if (eflag || vflag) ev_setup(eflag,vflag);
|
||||
else evflag = vflag_fdotr = 0;
|
||||
|
||||
// error check (for now)
|
||||
|
||||
if (eflag_atom || vflag_atom)
|
||||
error->all("Pair style meam does not yet support peratom energy/virial");
|
||||
|
||||
// grow local arrays if necessary
|
||||
|
||||
if (atom->nmax > nmax) {
|
||||
|
@ -176,7 +185,7 @@ void PairMEAM::compute(int eflag, int vflag)
|
|||
// check size of scrfcn based on half neighbor list
|
||||
|
||||
int nlocal = atom->nlocal;
|
||||
int nall = atom->nlocal + atom->nghost;
|
||||
int nall = nlocal + atom->nghost;
|
||||
|
||||
n = 0;
|
||||
for (ii = 0; ii < inum_half; ii++) n += numneigh_half[ilist_half[ii]];
|
||||
|
@ -194,9 +203,6 @@ void PairMEAM::compute(int eflag, int vflag)
|
|||
(double *) memory->smalloc(maxneigh*sizeof(double),"pair:fcpair");
|
||||
}
|
||||
|
||||
eng_vdwl = 0.0;
|
||||
if (vflag) for (i = 0; i < 6; i++) virial[i] = 0.0;
|
||||
|
||||
// zero out local arrays
|
||||
|
||||
for (i = 0; i < nall; i++) {
|
||||
|
@ -229,7 +235,7 @@ void PairMEAM::compute(int eflag, int vflag)
|
|||
for (ii = 0; ii < inum_half; ii++) {
|
||||
i = ilist_half[ii];
|
||||
ifort = i+1;
|
||||
meam_dens_init_(&ifort,&nmax,&eflag,&eng_vdwl,&ntype,type,fmap,&x[0][0],
|
||||
meam_dens_init_(&ifort,&nmax,&eflag,&evdwl,&ntype,type,fmap,&x[0][0],
|
||||
&numneigh_half[i],firstneigh_half[i],
|
||||
&numneigh_full[i],firstneigh_full[i],
|
||||
&scrfcn[offset],&dscrfcn[offset],&fcpair[offset],
|
||||
|
@ -246,7 +252,7 @@ void PairMEAM::compute(int eflag, int vflag)
|
|||
reverse_flag = 0;
|
||||
comm->reverse_comm_pair(this);
|
||||
|
||||
meam_dens_final_(&nlocal,&nmax,&eflag,&eng_vdwl,&ntype,type,fmap,
|
||||
meam_dens_final_(&nlocal,&nmax,&eflag,&evdwl,&ntype,type,fmap,
|
||||
&arho1[0][0],&arho2[0][0],arho2b,&arho3[0][0],
|
||||
&arho3b[0][0],&t_ave[0][0],gamma,dgamma1,
|
||||
dgamma2,dgamma3,rho,rho0,rho1,rho2,rho3,frhop,&errorflag);
|
||||
|
@ -263,7 +269,7 @@ void PairMEAM::compute(int eflag, int vflag)
|
|||
for (ii = 0; ii < inum_half; ii++) {
|
||||
i = ilist_half[ii];
|
||||
ifort = i+1;
|
||||
meam_force_(&ifort,&nmax,&eflag,&eng_vdwl,&ntype,type,fmap,&x[0][0],
|
||||
meam_force_(&ifort,&nmax,&eflag,&evdwl,&ntype,type,fmap,&x[0][0],
|
||||
&numneigh_half[i],firstneigh_half[i],
|
||||
&numneigh_full[i],firstneigh_full[i],
|
||||
&scrfcn[offset],&dscrfcn[offset],&fcpair[offset],
|
||||
|
@ -286,7 +292,10 @@ void PairMEAM::compute(int eflag, int vflag)
|
|||
neigh_f2c(inum_half,ilist_half,numneigh_half,firstneigh_half);
|
||||
neigh_f2c(inum_half,ilist_half,numneigh_full,firstneigh_full);
|
||||
|
||||
if (vflag == 2) virial_compute();
|
||||
// just sum global energy (for now)
|
||||
|
||||
if (evflag) ev_tally(0,0,nlocal,newton_pair,evdwl,0.0,0.0,0.0,0.0);
|
||||
if (vflag_fdotr) virial_compute();
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
|
|
@ -1,166 +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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "string.h"
|
||||
#include "compute_ebond_atom.h"
|
||||
#include "atom.h"
|
||||
#include "neighbor.h"
|
||||
#include "comm.h"
|
||||
#include "update.h"
|
||||
#include "force.h"
|
||||
#include "bond.h"
|
||||
#include "modify.h"
|
||||
#include "domain.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
||||
#define MAX(a,b) ((a) > (b) ? (a) : (b))
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
ComputeEbondAtom::ComputeEbondAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
Compute(lmp, narg, arg)
|
||||
{
|
||||
if (narg != 3) error->all("Illegal compute ebond/atom command");
|
||||
|
||||
peratom_flag = 1;
|
||||
size_peratom = 0;
|
||||
comm_reverse = 1;
|
||||
|
||||
nmax = 0;
|
||||
energy = NULL;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
ComputeEbondAtom::~ComputeEbondAtom()
|
||||
{
|
||||
memory->sfree(energy);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ComputeEbondAtom::init()
|
||||
{
|
||||
if (force->bond == NULL)
|
||||
error->all("Bond style does not support computing per-atom bond energy");
|
||||
|
||||
int count = 0;
|
||||
for (int i = 0; i < modify->ncompute; i++)
|
||||
if (strcmp(modify->compute[i]->style,"ebond/atom") == 0) count++;
|
||||
if (count > 1 && comm->me == 0)
|
||||
error->warning("More than one compute ebond/atom");
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ComputeEbondAtom::compute_peratom()
|
||||
{
|
||||
int i,n,i1,i2,type,iflag,jflag;
|
||||
double delx,dely,delz,rsq,fforce,eng;
|
||||
|
||||
// grow energy array if necessary
|
||||
|
||||
if (atom->nmax > nmax) {
|
||||
memory->sfree(energy);
|
||||
nmax = atom->nmax;
|
||||
energy = (double *)
|
||||
memory->smalloc(nmax*sizeof(double),"compute/epair/atom:energy");
|
||||
scalar_atom = energy;
|
||||
}
|
||||
|
||||
// clear energy array
|
||||
// n includes ghosts only if newton_bond flag is set
|
||||
|
||||
int nlocal = atom->nlocal;
|
||||
int newton_bond = force->newton_bond;
|
||||
|
||||
if (newton_bond) n = nlocal + atom->nghost;
|
||||
else n = nlocal;
|
||||
|
||||
for (i = 0; i < n; i++) energy[i] = 0.0;
|
||||
|
||||
// compute bond energy for atoms via bond->single()
|
||||
// if neither atom is in compute group, skip that bond
|
||||
// only add energy to atoms in group
|
||||
|
||||
double **x = atom->x;
|
||||
int *mask = atom->mask;
|
||||
int **bondlist = neighbor->bondlist;
|
||||
int nbondlist = neighbor->nbondlist;
|
||||
|
||||
for (n = 0; n < nbondlist; n++) {
|
||||
i1 = bondlist[n][0];
|
||||
i2 = bondlist[n][1];
|
||||
type = bondlist[n][2];
|
||||
iflag = mask[i1] & groupbit;
|
||||
jflag = mask[i2] & groupbit;
|
||||
if (iflag == 0 && jflag == 0) continue;
|
||||
|
||||
delx = x[i1][0] - x[i2][0];
|
||||
dely = x[i1][1] - x[i2][1];
|
||||
delz = x[i1][2] - x[i2][2];
|
||||
domain->minimum_image(delx,dely,delz);
|
||||
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
force->bond->single(type,rsq,i1,i2,1,fforce,eng);
|
||||
if (iflag) energy[i1] += eng;
|
||||
if (jflag && (newton_bond || i2 < nlocal)) energy[i2] += eng;
|
||||
}
|
||||
|
||||
// communicate energy between neigchbor procs
|
||||
|
||||
if (newton_bond) comm->reverse_comm_compute(this);
|
||||
|
||||
// remove double counting of per-atom energy
|
||||
|
||||
for (i = 0; i < nlocal; i++) energy[i] *= 0.5;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
int ComputeEbondAtom::pack_reverse_comm(int n, int first, double *buf)
|
||||
{
|
||||
int i,m,last;
|
||||
|
||||
m = 0;
|
||||
last = first + n;
|
||||
for (i = first; i < last; i++) buf[m++] = energy[i];
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ComputeEbondAtom::unpack_reverse_comm(int n, int *list, double *buf)
|
||||
{
|
||||
int i,j,m;
|
||||
|
||||
m = 0;
|
||||
for (i = 0; i < n; i++) {
|
||||
j = list[i];
|
||||
energy[j] += buf[m++];
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
memory usage of local atom-based array
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
double ComputeEbondAtom::memory_usage()
|
||||
{
|
||||
double bytes = nmax * sizeof(double);
|
||||
return bytes;
|
||||
}
|
|
@ -1,38 +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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef COMPUTE_EBOND_ATOM_H
|
||||
#define COMPUTE_EBOND_ATOM_H
|
||||
|
||||
#include "compute.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class ComputeEbondAtom : public Compute {
|
||||
public:
|
||||
ComputeEbondAtom(class LAMMPS *, int, char **);
|
||||
~ComputeEbondAtom();
|
||||
void init();
|
||||
void compute_peratom();
|
||||
int pack_reverse_comm(int, int, double *);
|
||||
void unpack_reverse_comm(int, int *, double *);
|
||||
double memory_usage();
|
||||
|
||||
private:
|
||||
int nmax;
|
||||
double *energy;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,231 +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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "string.h"
|
||||
#include "compute_epair_atom.h"
|
||||
#include "atom.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
#include "neigh_request.h"
|
||||
#include "modify.h"
|
||||
#include "comm.h"
|
||||
#include "update.h"
|
||||
#include "force.h"
|
||||
#include "pair.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
||||
#define MAX(a,b) ((a) > (b) ? (a) : (b))
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
ComputeEpairAtom::ComputeEpairAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
Compute(lmp, narg, arg)
|
||||
{
|
||||
if (narg != 3) error->all("Illegal compute epair/atom command");
|
||||
|
||||
peratom_flag = 1;
|
||||
size_peratom = 0;
|
||||
comm_reverse = 1;
|
||||
|
||||
nmax = 0;
|
||||
energy = NULL;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
ComputeEpairAtom::~ComputeEpairAtom()
|
||||
{
|
||||
memory->sfree(energy);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ComputeEpairAtom::init()
|
||||
{
|
||||
if (force->pair == NULL || force->pair->single_enable == 0)
|
||||
error->all("Pair style does not support computing per-atom energy");
|
||||
|
||||
// need an occasional half neighbor list
|
||||
|
||||
int irequest = neighbor->request((void *) this);
|
||||
neighbor->requests[irequest]->pair = 0;
|
||||
neighbor->requests[irequest]->compute = 1;
|
||||
neighbor->requests[irequest]->occasional = 1;
|
||||
|
||||
if (force->pair_match("eam")) eamstyle = 1;
|
||||
else eamstyle = 0;
|
||||
|
||||
int count = 0;
|
||||
for (int i = 0; i < modify->ncompute; i++)
|
||||
if (strcmp(modify->compute[i]->style,"epair/atom") == 0) count++;
|
||||
if (count > 1 && comm->me == 0)
|
||||
error->warning("More than one compute epair/atom");
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ComputeEpairAtom::init_list(int id, NeighList *ptr)
|
||||
{
|
||||
list = ptr;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ComputeEpairAtom::compute_peratom()
|
||||
{
|
||||
int i,j,ii,jj,n,inum,jnum,itype,jtype,iflag,jflag;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
double factor_coul,factor_lj,eng;
|
||||
int *ilist,*jlist,*numneigh,**firstneigh;
|
||||
Pair::One one;
|
||||
|
||||
// grow energy array if necessary
|
||||
|
||||
if (atom->nmax > nmax) {
|
||||
memory->sfree(energy);
|
||||
nmax = atom->nmax;
|
||||
energy = (double *)
|
||||
memory->smalloc(nmax*sizeof(double),"compute/epair/atom:energy");
|
||||
scalar_atom = energy;
|
||||
}
|
||||
|
||||
// clear energy array
|
||||
// n includes ghosts only if newton_pair flag is set
|
||||
|
||||
int nlocal = atom->nlocal;
|
||||
int newton_pair = force->newton_pair;
|
||||
|
||||
if (newton_pair) n = nlocal + atom->nghost;
|
||||
else n = nlocal;
|
||||
|
||||
for (i = 0; i < n; i++) energy[i] = 0.0;
|
||||
|
||||
// invoke half neighbor list (will copy or build if necessary)
|
||||
|
||||
neighbor->build_one(list->index);
|
||||
|
||||
inum = list->inum;
|
||||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
|
||||
// compute pairwise energy for atoms via pair->single()
|
||||
// if neither atom is in compute group, skip that pair
|
||||
// only add energy to atoms in group
|
||||
|
||||
double *special_coul = force->special_coul;
|
||||
double *special_lj = force->special_lj;
|
||||
double **cutsq = force->pair->cutsq;
|
||||
|
||||
double **x = atom->x;
|
||||
int *mask = atom->mask;
|
||||
int *type = atom->type;
|
||||
int nall = nlocal + atom->nghost;
|
||||
|
||||
for (ii = 0; ii < inum; ii++) {
|
||||
i = ilist[ii];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
itype = type[i];
|
||||
iflag = mask[i] & groupbit;
|
||||
jlist = firstneigh[i];
|
||||
jnum = numneigh[i];
|
||||
|
||||
for (jj = 0; jj < jnum; jj++) {
|
||||
j = jlist[jj];
|
||||
jflag = mask[j] & groupbit;
|
||||
if (iflag == 0 && jflag == 0) continue;
|
||||
|
||||
if (j < nall) factor_coul = factor_lj = 1.0;
|
||||
else {
|
||||
factor_coul = special_coul[j/nall];
|
||||
factor_lj = special_lj[j/nall];
|
||||
j %= nall;
|
||||
}
|
||||
|
||||
delx = xtmp - x[j][0];
|
||||
dely = ytmp - x[j][1];
|
||||
delz = ztmp - x[j][2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
jtype = type[j];
|
||||
|
||||
if (rsq < cutsq[itype][jtype]) {
|
||||
force->pair->single(i,j,itype,jtype,rsq,factor_coul,factor_lj,1,one);
|
||||
eng = one.eng_coul + one.eng_vdwl;
|
||||
if (iflag) energy[i] += eng;
|
||||
if (jflag && (newton_pair || j < nlocal)) energy[j] += eng;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// communicate energy between neigchbor procs
|
||||
|
||||
if (newton_pair) comm->reverse_comm_compute(this);
|
||||
|
||||
// remove double counting of per-atom energy
|
||||
|
||||
for (i = 0; i < nlocal; i++) energy[i] *= 0.5;
|
||||
|
||||
// for EAM, include embedding function contribution to energy
|
||||
// only for atoms in compute group
|
||||
|
||||
if (eamstyle) {
|
||||
for (ii = 0; ii < inum; ii++) {
|
||||
i = ilist[ii];
|
||||
if (mask[i] & groupbit) {
|
||||
force->pair->single_embed(i,type[i],eng);
|
||||
energy[i] += eng;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
int ComputeEpairAtom::pack_reverse_comm(int n, int first, double *buf)
|
||||
{
|
||||
int i,m,last;
|
||||
|
||||
m = 0;
|
||||
last = first + n;
|
||||
for (i = first; i < last; i++) buf[m++] = energy[i];
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ComputeEpairAtom::unpack_reverse_comm(int n, int *list, double *buf)
|
||||
{
|
||||
int i,j,m;
|
||||
|
||||
m = 0;
|
||||
for (i = 0; i < n; i++) {
|
||||
j = list[i];
|
||||
energy[j] += buf[m++];
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
memory usage of local atom-based array
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
double ComputeEpairAtom::memory_usage()
|
||||
{
|
||||
double bytes = nmax * sizeof(double);
|
||||
return bytes;
|
||||
}
|
|
@ -1,40 +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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef COMPUTE_EPAIR_ATOM_H
|
||||
#define COMPUTE_EPAIR_ATOM_H
|
||||
|
||||
#include "compute.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class ComputeEpairAtom : public Compute {
|
||||
public:
|
||||
ComputeEpairAtom(class LAMMPS *, int, char **);
|
||||
~ComputeEpairAtom();
|
||||
void init();
|
||||
void init_list(int, class NeighList *);
|
||||
void compute_peratom();
|
||||
int pack_reverse_comm(int, int, double *);
|
||||
void unpack_reverse_comm(int, int *, double *);
|
||||
double memory_usage();
|
||||
|
||||
private:
|
||||
int nmax,eamstyle;
|
||||
class NeighList *list;
|
||||
double *energy;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue