forked from lijiext/lammps
Adding MSM code.
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@8780 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
parent
20a11e138a
commit
ace4980800
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,190 @@
|
|||
/* -*- 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 KSPACE_CLASS
|
||||
|
||||
KSpaceStyle(msm,MSM)
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_MSM_H
|
||||
#define LMP_MSM_H
|
||||
|
||||
#include "lmptype.h"
|
||||
#include "mpi.h"
|
||||
|
||||
#include "kspace.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class MSM : public KSpace {
|
||||
public:
|
||||
MSM(class LAMMPS *, int, char **);
|
||||
~MSM();
|
||||
void init();
|
||||
void setup();
|
||||
void compute(int, int);
|
||||
|
||||
protected:
|
||||
int me,nprocs;
|
||||
double precision;
|
||||
int nfactors;
|
||||
int *factors;
|
||||
double qsum,qsqsum,q2;
|
||||
double qqrd2e;
|
||||
double cutoff;
|
||||
double volume;
|
||||
double *delxinv,*delyinv,*delzinv,*delvolinv;
|
||||
|
||||
int *nx_msm,*ny_msm,*nz_msm;
|
||||
int *nxlo_in,*nylo_in,*nzlo_in;
|
||||
int *nxhi_in,*nyhi_in,*nzhi_in;
|
||||
int *nxlo_in_d,*nylo_in_d,*nzlo_in_d;
|
||||
int *nxhi_in_d,*nyhi_in_d,*nzhi_in_d;
|
||||
int *nxlo_out,*nylo_out,*nzlo_out;
|
||||
int *nxhi_out,*nyhi_out,*nzhi_out;
|
||||
int *nxlo_ghost,*nxhi_ghost,*nylo_ghost;
|
||||
int *nyhi_ghost,*nzlo_ghost,*nzhi_ghost;
|
||||
int nxlo_direct,nxhi_direct,nylo_direct;
|
||||
int nyhi_direct,nzlo_direct,nzhi_direct;
|
||||
int nmax_direct;
|
||||
int nlower,nupper;
|
||||
int ngrid,nbuf;
|
||||
int levels;
|
||||
double ****qgrid;
|
||||
double ****egrid;
|
||||
double **g_direct;
|
||||
|
||||
double *buf1,*buf2;
|
||||
|
||||
double **phi1d,**dphi1d;
|
||||
|
||||
int **part2grid; // storage for particle -> grid mapping
|
||||
int nmax;
|
||||
|
||||
int triclinic; // domain settings, orthog or triclinic
|
||||
double *boxlo;
|
||||
|
||||
void set_grid();
|
||||
double estimate_1d_error(double,double);
|
||||
double estimate_3d_error();
|
||||
double estimate_total_error();
|
||||
void allocate();
|
||||
void deallocate();
|
||||
void allocate_levels();
|
||||
void deallocate_levels();
|
||||
int factorable(int,int&,int&);
|
||||
void compute_gf_denom();
|
||||
double gf_denom(double, double, double);
|
||||
void particle_map();
|
||||
void make_rho();
|
||||
void ghost_swap(int);
|
||||
void charge_swap(int);
|
||||
void potential_swap(int);
|
||||
void direct(int, int, int);
|
||||
void restrict(int,int,int);
|
||||
void prolongate(int,int,int);
|
||||
void fillbrick(int);
|
||||
void fieldforce();
|
||||
void procs2grid2d(int,int,int,int*,int*);
|
||||
void compute_phis_and_dphis(const double &, const double &, const double &);
|
||||
double compute_phi(const double &);
|
||||
double compute_dphi(const double &);
|
||||
void get_g_direct();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Illegal ... command
|
||||
|
||||
Self-explanatory. Check the input script syntax and compare to the
|
||||
documentation for the command. You can use -echo screen as a
|
||||
command-line option when running LAMMPS to see the offending line.
|
||||
|
||||
E: Cannot (yet) use MSM with triclinic box
|
||||
|
||||
This feature is not yet supported.
|
||||
|
||||
E: Cannot (yet) use MSM with 2d simulation
|
||||
|
||||
This feature is not yet supported.
|
||||
|
||||
E: Kspace style requires atom attribute q
|
||||
|
||||
The atom style defined does not have these attributes.
|
||||
|
||||
E: Cannot (yet) use nonperiodic boundaries with MSM
|
||||
|
||||
This feature is not yet supported.
|
||||
|
||||
E: Cannot use slab correction with MSM
|
||||
|
||||
Slab correction can only be used with Ewald and PPPM, not MSM
|
||||
|
||||
E: MSM order cannot be < 2 or > than %d
|
||||
|
||||
This is a limitation of the MSM implementation in LAMMPS.
|
||||
Currently the only available order is 4.
|
||||
|
||||
E: KSpace style is incompatible with Pair style
|
||||
|
||||
Setting a kspace style requires that a pair style with a long-range
|
||||
Coulombic component be selected that is compatible with MSM. Note
|
||||
that TIP4P is not (yet) supported by MSM
|
||||
|
||||
E: Cannot use kspace solver on system with no charge
|
||||
|
||||
No atoms in system have a non-zero charge.
|
||||
|
||||
E: System is not charge neutral, net charge = %g
|
||||
|
||||
The total charge on all atoms on the system is not 0.0, which
|
||||
is not valid for MSM.
|
||||
|
||||
W: MSM parallel communication error, try reducing accuracy or number of procs
|
||||
|
||||
Currently only nearest neighbor communication between processors is implemented in MSM.
|
||||
If charge from an atom spans more than one processor domain this error will result.
|
||||
|
||||
E: MSM grid is too large
|
||||
|
||||
The global MSM grid is larger than OFFSET in one or more dimensions.
|
||||
OFFSET is currently set to 16384. You likely need to decrease the
|
||||
requested accuracy.
|
||||
|
||||
E: KSpace accuracy must be > 0
|
||||
|
||||
The kspace accuracy designated in the input must be greater than zero.
|
||||
|
||||
E: Out of range atoms - cannot compute MSM
|
||||
|
||||
One or more atoms are attempting to map their charge to a MSM grid
|
||||
point that is not owned by a processor. This is likely for one of two
|
||||
reasons, both of them bad. First, it may mean that an atom near the
|
||||
boundary of a processor's sub-domain has moved more than 1/2 the
|
||||
"neighbor skin distance"_neighbor.html without neighbor lists being
|
||||
rebuilt and atoms being migrated to new processors. This also means
|
||||
you may be missing pairwise interactions that need to be computed.
|
||||
The solution is to change the re-neighboring criteria via the
|
||||
"neigh_modify"_neigh_modify command. The safest settings are "delay 0
|
||||
every 1 check yes". Second, it may mean that an atom has moved far
|
||||
outside a processor's sub-domain or even the entire simulation box.
|
||||
This indicates bad physics, e.g. due to highly overlapping atoms, too
|
||||
large a timestep, etc.
|
||||
|
||||
*/
|
|
@ -37,8 +37,8 @@ class PairBornCoulLong : public Pair {
|
|||
void read_restart(FILE *);
|
||||
void write_restart_settings(FILE *);
|
||||
void read_restart_settings(FILE *);
|
||||
double single(int, int, int, int, double, double, double, double &);
|
||||
void *extract(const char *, int &);
|
||||
virtual double single(int, int, int, int, double, double, double, double &);
|
||||
virtual void *extract(const char *, int &);
|
||||
|
||||
protected:
|
||||
double cut_lj_global;
|
||||
|
|
|
@ -0,0 +1,194 @@
|
|||
/* ----------------------------------------------------------------------
|
||||
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: Stan Moore (SNL), Paul Crozier (SNL)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "math.h"
|
||||
#include "stdio.h"
|
||||
#include "stdlib.h"
|
||||
#include "string.h"
|
||||
#include "pair_born_coul_msm.h"
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "force.h"
|
||||
#include "kspace.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
#include "math_const.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace MathConst;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairBornCoulMSM::PairBornCoulMSM(LAMMPS *lmp) : PairBornCoulLong(lmp) {}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairBornCoulMSM::compute(int eflag, int vflag)
|
||||
{
|
||||
int i,j,ii,jj,inum,jnum,itype,jtype;
|
||||
double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,evdwl,ecoul,fpair;
|
||||
double rsq,r2inv,r6inv,forcecoul,forceborn,factor_coul,factor_lj;
|
||||
double egamma,fgamma,prefactor;
|
||||
double r,rexp;
|
||||
int *ilist,*jlist,*numneigh,**firstneigh;
|
||||
|
||||
evdwl = ecoul = 0.0;
|
||||
if (eflag || vflag) ev_setup(eflag,vflag);
|
||||
else evflag = vflag_fdotr = 0;
|
||||
|
||||
double **x = atom->x;
|
||||
double **f = atom->f;
|
||||
double *q = atom->q;
|
||||
int *type = atom->type;
|
||||
int nlocal = atom->nlocal;
|
||||
double *special_coul = force->special_coul;
|
||||
double *special_lj = force->special_lj;
|
||||
int newton_pair = force->newton_pair;
|
||||
double qqrd2e = force->qqrd2e;
|
||||
|
||||
inum = list->inum;
|
||||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
|
||||
// loop over neighbors of my atoms
|
||||
|
||||
for (ii = 0; ii < inum; ii++) {
|
||||
i = ilist[ii];
|
||||
qtmp = q[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
itype = type[i];
|
||||
jlist = firstneigh[i];
|
||||
jnum = numneigh[i];
|
||||
|
||||
for (jj = 0; jj < jnum; jj++) {
|
||||
j = jlist[jj];
|
||||
factor_lj = special_lj[sbmask(j)];
|
||||
factor_coul = special_coul[sbmask(j)];
|
||||
j &= NEIGHMASK;
|
||||
|
||||
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]) {
|
||||
r2inv = 1.0/rsq;
|
||||
|
||||
if (rsq < cut_coulsq) {
|
||||
r = sqrt(rsq);
|
||||
prefactor = qqrd2e * qtmp*q[j]/r;
|
||||
egamma = 1.0 - (r/cut_coul)*force->kspace->gamma(r/cut_coul);
|
||||
fgamma = 1.0 + (rsq/cut_coulsq)*force->kspace->dgamma(r/cut_coul);
|
||||
forcecoul = prefactor * fgamma;
|
||||
if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else forcecoul = 0.0;
|
||||
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
rexp = exp((sigma[itype][jtype]-r)*rhoinv[itype][jtype]);
|
||||
forceborn = born1[itype][jtype]*r*rexp - born2[itype][jtype]*r6inv
|
||||
+ born3[itype][jtype]*r2inv*r6inv;
|
||||
} else forceborn = 0.0;
|
||||
|
||||
fpair = (forcecoul + factor_lj*forceborn) * r2inv;
|
||||
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
if (newton_pair || j < nlocal) {
|
||||
f[j][0] -= delx*fpair;
|
||||
f[j][1] -= dely*fpair;
|
||||
f[j][2] -= delz*fpair;
|
||||
}
|
||||
|
||||
if (eflag) {
|
||||
if (rsq < cut_coulsq) {
|
||||
ecoul = prefactor*egamma;
|
||||
if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else ecoul = 0.0;
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
evdwl = a[itype][jtype]*rexp - c[itype][jtype]*r6inv
|
||||
+ d[itype][jtype]*r6inv*r2inv - offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
} else evdwl = 0.0;
|
||||
}
|
||||
|
||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
||||
evdwl,ecoul,fpair,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (vflag_fdotr) virial_fdotr_compute();
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairBornCoulMSM::single(int i, int j, int itype, int jtype,
|
||||
double rsq,
|
||||
double factor_coul, double factor_lj,
|
||||
double &fforce)
|
||||
{
|
||||
double r2inv,r6inv,r,rexp,egamma,fgamma,prefactor;
|
||||
double forcecoul,forceborn,phicoul,phiborn;
|
||||
|
||||
r2inv = 1.0/rsq;
|
||||
if (rsq < cut_coulsq) {
|
||||
r = sqrt(rsq);
|
||||
prefactor = force->qqrd2e * atom->q[i]*atom->q[j]/r;
|
||||
egamma = 1.0 - (r/cut_coul)*force->kspace->gamma(r/cut_coul);
|
||||
fgamma = 1.0 + (rsq/cut_coulsq)*force->kspace->dgamma(r/cut_coul);
|
||||
forcecoul = prefactor * fgamma;
|
||||
if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else forcecoul = 0.0;
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
r = sqrt(rsq);
|
||||
rexp = exp((sigma[itype][jtype]-r)*rhoinv[itype][jtype]);
|
||||
forceborn = born1[itype][jtype]*r*rexp - born2[itype][jtype]*r6inv +
|
||||
born3[itype][jtype]*r2inv*r6inv;
|
||||
} else forceborn = 0.0;
|
||||
fforce = (forcecoul + factor_lj*forceborn) * r2inv;
|
||||
|
||||
double eng = 0.0;
|
||||
if (rsq < cut_coulsq) {
|
||||
phicoul = prefactor*egamma;
|
||||
if (factor_coul < 1.0) phicoul -= (1.0-factor_coul)*prefactor;
|
||||
eng += phicoul;
|
||||
}
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
phiborn = a[itype][jtype]*rexp - c[itype][jtype]*r6inv +
|
||||
d[itype][jtype]*r2inv*r6inv - offset[itype][jtype];
|
||||
eng += factor_lj*phiborn;
|
||||
}
|
||||
return eng;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void *PairBornCoulMSM::extract(const char *str, int &dim)
|
||||
{
|
||||
dim = 0;
|
||||
if (strcmp(str,"cut_msm") == 0) return (void *) &cut_coul;
|
||||
return NULL;
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
/* ----------------------------------------------------------------------
|
||||
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 PAIR_CLASS
|
||||
|
||||
PairStyle(born/coul/msm,PairBornCoulMSM)
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_PAIR_BORN_COUL_MSM_H
|
||||
#define LMP_PAIR_BORN_COUL_MSM_H
|
||||
|
||||
#include "pair_born_coul_long.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class PairBornCoulMSM : public PairBornCoulLong {
|
||||
public:
|
||||
PairBornCoulMSM(class LAMMPS *);
|
||||
virtual ~PairBornCoulMSM(){};
|
||||
virtual void compute(int, int);
|
||||
virtual double single(int, int, int, int, double, double, double, double &);
|
||||
virtual void *extract(const char *, int &);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Illegal ... command
|
||||
|
||||
Self-explanatory. Check the input script syntax and compare to the
|
||||
documentation for the command. You can use -echo screen as a
|
||||
command-line option when running LAMMPS to see the offending line.
|
||||
|
||||
E: Incorrect args for pair coefficients
|
||||
|
||||
Self-explanatory. Check the input script or data file.
|
||||
|
||||
E: All pair coeffs are not set
|
||||
|
||||
All pair coefficients must be set in the data file or by the
|
||||
pair_coeff command before running a simulation.
|
||||
|
||||
E: Pair style born/coul/long requires atom attribute q
|
||||
|
||||
An atom style that defines this attribute must be used.
|
||||
|
||||
E: Pair style is incompatible with KSpace style
|
||||
|
||||
If a pair style with a long-range Coulombic component is selected,
|
||||
then a kspace style must also be used.
|
||||
|
||||
*/
|
|
@ -28,7 +28,7 @@ class PairBuckCoulLong : public Pair {
|
|||
public:
|
||||
PairBuckCoulLong(class LAMMPS *);
|
||||
virtual ~PairBuckCoulLong();
|
||||
void compute(int, int);
|
||||
virtual void compute(int, int);
|
||||
void settings(int, char **);
|
||||
void coeff(int, char **);
|
||||
void init_style();
|
||||
|
@ -37,8 +37,8 @@ class PairBuckCoulLong : public Pair {
|
|||
void read_restart(FILE *);
|
||||
void write_restart_settings(FILE *);
|
||||
void read_restart_settings(FILE *);
|
||||
double single(int, int, int, int, double, double, double, double &);
|
||||
void *extract(const char *, int &);
|
||||
virtual double single(int, int, int, int, double, double, double, double &);
|
||||
virtual void *extract(const char *, int &);
|
||||
|
||||
protected:
|
||||
double cut_lj_global;
|
||||
|
|
|
@ -0,0 +1,189 @@
|
|||
/* ----------------------------------------------------------------------
|
||||
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 "math.h"
|
||||
#include "stdio.h"
|
||||
#include "stdlib.h"
|
||||
#include "string.h"
|
||||
#include "pair_buck_coul_msm.h"
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "force.h"
|
||||
#include "kspace.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
#include "math_const.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace MathConst;
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairBuckCoulMSM::PairBuckCoulMSM(LAMMPS *lmp) : PairBuckCoulLong(lmp) {}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairBuckCoulMSM::compute(int eflag, int vflag)
|
||||
{
|
||||
int i,j,ii,jj,inum,jnum,itype,jtype;
|
||||
double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,evdwl,ecoul,fpair;
|
||||
double rsq,r2inv,r6inv,forcecoul,forcebuck,factor_coul,factor_lj;
|
||||
double egamma,fgamma,prefactor;
|
||||
double r,rexp;
|
||||
int *ilist,*jlist,*numneigh,**firstneigh;
|
||||
|
||||
evdwl = ecoul = 0.0;
|
||||
if (eflag || vflag) ev_setup(eflag,vflag);
|
||||
else evflag = vflag_fdotr = 0;
|
||||
|
||||
double **x = atom->x;
|
||||
double **f = atom->f;
|
||||
double *q = atom->q;
|
||||
int *type = atom->type;
|
||||
int nlocal = atom->nlocal;
|
||||
double *special_coul = force->special_coul;
|
||||
double *special_lj = force->special_lj;
|
||||
int newton_pair = force->newton_pair;
|
||||
double qqrd2e = force->qqrd2e;
|
||||
|
||||
inum = list->inum;
|
||||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
|
||||
// loop over neighbors of my atoms
|
||||
|
||||
for (ii = 0; ii < inum; ii++) {
|
||||
i = ilist[ii];
|
||||
qtmp = q[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
itype = type[i];
|
||||
jlist = firstneigh[i];
|
||||
jnum = numneigh[i];
|
||||
|
||||
for (jj = 0; jj < jnum; jj++) {
|
||||
j = jlist[jj];
|
||||
factor_lj = special_lj[sbmask(j)];
|
||||
factor_coul = special_coul[sbmask(j)];
|
||||
j &= NEIGHMASK;
|
||||
|
||||
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]) {
|
||||
r2inv = 1.0/rsq;
|
||||
|
||||
if (rsq < cut_coulsq) {
|
||||
r = sqrt(rsq);
|
||||
prefactor = qqrd2e * qtmp*q[j]/r;
|
||||
egamma = 1.0 - (r/cut_coul)*force->kspace->gamma(r/cut_coul);
|
||||
fgamma = 1.0 + (rsq/cut_coulsq)*force->kspace->dgamma(r/cut_coul);
|
||||
forcecoul = prefactor * fgamma;
|
||||
if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else forcecoul = 0.0;
|
||||
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
rexp = exp(-r*rhoinv[itype][jtype]);
|
||||
forcebuck = buck1[itype][jtype]*r*rexp - buck2[itype][jtype]*r6inv;
|
||||
} else forcebuck = 0.0;
|
||||
|
||||
fpair = (forcecoul + factor_lj*forcebuck) * r2inv;
|
||||
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
if (newton_pair || j < nlocal) {
|
||||
f[j][0] -= delx*fpair;
|
||||
f[j][1] -= dely*fpair;
|
||||
f[j][2] -= delz*fpair;
|
||||
}
|
||||
|
||||
if (eflag) {
|
||||
if (rsq < cut_coulsq) {
|
||||
ecoul = prefactor*egamma;
|
||||
if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else ecoul = 0.0;
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
evdwl = a[itype][jtype]*rexp - c[itype][jtype]*r6inv -
|
||||
offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
} else evdwl = 0.0;
|
||||
}
|
||||
|
||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
||||
evdwl,ecoul,fpair,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (vflag_fdotr) virial_fdotr_compute();
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairBuckCoulMSM::single(int i, int j, int itype, int jtype,
|
||||
double rsq,
|
||||
double factor_coul, double factor_lj,
|
||||
double &fforce)
|
||||
{
|
||||
double r2inv,r6inv,r,rexp,egamma,fgamma,prefactor;
|
||||
double forcecoul,forcebuck,phicoul,phibuck;
|
||||
|
||||
r2inv = 1.0/rsq;
|
||||
if (rsq < cut_coulsq) {
|
||||
r = sqrt(rsq);
|
||||
prefactor = force->qqrd2e * atom->q[i]*atom->q[j]/r;
|
||||
egamma = 1.0 - (r/cut_coul)*force->kspace->gamma(r/cut_coul);
|
||||
fgamma = 1.0 + (rsq/cut_coulsq)*force->kspace->dgamma(r/cut_coul);
|
||||
forcecoul = prefactor * fgamma;
|
||||
if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else forcecoul = 0.0;
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
r = sqrt(rsq);
|
||||
rexp = exp(-r*rhoinv[itype][jtype]);
|
||||
forcebuck = buck1[itype][jtype]*r*rexp - buck2[itype][jtype]*r6inv;
|
||||
} else forcebuck = 0.0;
|
||||
fforce = (forcecoul + factor_lj*forcebuck) * r2inv;
|
||||
|
||||
double eng = 0.0;
|
||||
if (rsq < cut_coulsq) {
|
||||
phicoul = prefactor*egamma;
|
||||
if (factor_coul < 1.0) phicoul -= (1.0-factor_coul)*prefactor;
|
||||
eng += phicoul;
|
||||
}
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
phibuck = a[itype][jtype]*rexp - c[itype][jtype]*r6inv -
|
||||
offset[itype][jtype];
|
||||
eng += factor_lj*phibuck;
|
||||
}
|
||||
return eng;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void *PairBuckCoulMSM::extract(const char *str, int &dim)
|
||||
{
|
||||
dim = 0;
|
||||
if (strcmp(str,"cut_msm") == 0) return (void *) &cut_coul;
|
||||
return NULL;
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
/* ----------------------------------------------------------------------
|
||||
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 PAIR_CLASS
|
||||
|
||||
PairStyle(buck/coul/msm,PairBuckCoulMSM)
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_PAIR_BUCK_COUL_MSM_H
|
||||
#define LMP_PAIR_BUCK_COUL_MSM_H
|
||||
|
||||
#include "pair_buck_coul_long.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class PairBuckCoulMSM : public PairBuckCoulLong {
|
||||
public:
|
||||
PairBuckCoulMSM(class LAMMPS *);
|
||||
virtual ~PairBuckCoulMSM(){};
|
||||
virtual void compute(int, int);
|
||||
virtual double single(int, int, int, int, double, double, double, double &);
|
||||
virtual void *extract(const char *, int &);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Illegal ... command
|
||||
|
||||
Self-explanatory. Check the input script syntax and compare to the
|
||||
documentation for the command. You can use -echo screen as a
|
||||
command-line option when running LAMMPS to see the offending line.
|
||||
|
||||
E: Incorrect args for pair coefficients
|
||||
|
||||
Self-explanatory. Check the input script or data file.
|
||||
|
||||
E: All pair coeffs are not set
|
||||
|
||||
All pair coefficients must be set in the data file or by the
|
||||
pair_coeff command before running a simulation.
|
||||
|
||||
E: Pair style buck/coul/long requires atom attribute q
|
||||
|
||||
The atom style defined does not have these attributes.
|
||||
|
||||
E: Pair style is incompatible with KSpace style
|
||||
|
||||
If a pair style with a long-range Coulombic component is selected,
|
||||
then a kspace style must also be used.
|
||||
|
||||
*/
|
|
@ -38,7 +38,7 @@ class PairCoulLong : public Pair {
|
|||
virtual void write_restart_settings(FILE *);
|
||||
virtual void read_restart_settings(FILE *);
|
||||
virtual double single(int, int, int, int, double, double, double, double &);
|
||||
void *extract(const char *, int &);
|
||||
virtual void *extract(const char *, int &);
|
||||
|
||||
protected:
|
||||
double cut_coul,cut_coulsq;
|
||||
|
@ -52,7 +52,7 @@ class PairCoulLong : public Pair {
|
|||
int ncoulshiftbits,ncoulmask;
|
||||
|
||||
void allocate();
|
||||
void init_tables();
|
||||
virtual void init_tables();
|
||||
void free_tables();
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,379 @@
|
|||
/* ----------------------------------------------------------------------
|
||||
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 authors: Stan Moore (SNL), Paul Crozier (SNL)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "math.h"
|
||||
#include "stdio.h"
|
||||
#include "stdlib.h"
|
||||
#include "string.h"
|
||||
#include "pair_coul_msm.h"
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "force.h"
|
||||
#include "kspace.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
#include "update.h"
|
||||
#include "integrate.h"
|
||||
#include "respa.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairCoulMSM::PairCoulMSM(LAMMPS *lmp) : PairCoulLong(lmp)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairCoulMSM::compute(int eflag, int vflag)
|
||||
{
|
||||
int i,j,ii,jj,inum,jnum,itable,itype,jtype;
|
||||
double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,ecoul,fpair;
|
||||
double fraction,table;
|
||||
double r,r2inv,forcecoul,factor_coul;
|
||||
double egamma,fgamma,prefactor;
|
||||
int *ilist,*jlist,*numneigh,**firstneigh;
|
||||
double rsq;
|
||||
|
||||
ecoul = 0.0;
|
||||
if (eflag || vflag) ev_setup(eflag,vflag);
|
||||
else evflag = vflag_fdotr = 0;
|
||||
|
||||
double **x = atom->x;
|
||||
double **f = atom->f;
|
||||
double *q = atom->q;
|
||||
int *type = atom->type;
|
||||
int nlocal = atom->nlocal;
|
||||
double *special_coul = force->special_coul;
|
||||
int newton_pair = force->newton_pair;
|
||||
double qqrd2e = force->qqrd2e;
|
||||
|
||||
inum = list->inum;
|
||||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
|
||||
// loop over neighbors of my atoms
|
||||
|
||||
for (ii = 0; ii < inum; ii++) {
|
||||
i = ilist[ii];
|
||||
qtmp = q[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
itype = type[i];
|
||||
jlist = firstneigh[i];
|
||||
jnum = numneigh[i];
|
||||
|
||||
for (jj = 0; jj < jnum; jj++) {
|
||||
j = jlist[jj];
|
||||
factor_coul = special_coul[sbmask(j)];
|
||||
j &= NEIGHMASK;
|
||||
|
||||
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 < cut_coulsq) {
|
||||
r2inv = 1.0/rsq;
|
||||
if (!ncoultablebits || rsq <= tabinnersq) {
|
||||
r = sqrt(rsq);
|
||||
prefactor = qqrd2e * scale[itype][jtype] * qtmp*q[j]/r;
|
||||
egamma = 1.0 - (r/cut_coul)*force->kspace->gamma(r/cut_coul);
|
||||
fgamma = 1.0 + (rsq/cut_coulsq)*force->kspace->dgamma(r/cut_coul);
|
||||
forcecoul = prefactor * fgamma;
|
||||
if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else {
|
||||
union_int_float_t rsq_lookup;
|
||||
rsq_lookup.f = rsq;
|
||||
itable = rsq_lookup.i & ncoulmask;
|
||||
itable >>= ncoulshiftbits;
|
||||
fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable];
|
||||
table = ftable[itable] + fraction*dftable[itable];
|
||||
forcecoul = scale[itype][jtype] * qtmp*q[j] * table;
|
||||
if (factor_coul < 1.0) {
|
||||
table = ctable[itable] + fraction*dctable[itable];
|
||||
prefactor = scale[itype][jtype] * qtmp*q[j] * table;
|
||||
forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
}
|
||||
}
|
||||
|
||||
fpair = forcecoul * r2inv;
|
||||
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
if (newton_pair || j < nlocal) {
|
||||
f[j][0] -= delx*fpair;
|
||||
f[j][1] -= dely*fpair;
|
||||
f[j][2] -= delz*fpair;
|
||||
}
|
||||
|
||||
if (eflag) {
|
||||
if (!ncoultablebits || rsq <= tabinnersq)
|
||||
ecoul = prefactor*egamma;
|
||||
else {
|
||||
table = etable[itable] + fraction*detable[itable];
|
||||
ecoul = scale[itype][jtype] * qtmp*q[j] * table;
|
||||
}
|
||||
if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor;
|
||||
}
|
||||
|
||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
||||
0.0,ecoul,fpair,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (vflag_fdotr) virial_fdotr_compute();
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
setup force tables used in compute routines
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairCoulMSM::init_tables()
|
||||
{
|
||||
int masklo,maskhi;
|
||||
double r,egamma,fgamma,rsw;
|
||||
double qqrd2e = force->qqrd2e;
|
||||
|
||||
tabinnersq = tabinner*tabinner;
|
||||
init_bitmap(tabinner,cut_coul,ncoultablebits,
|
||||
masklo,maskhi,ncoulmask,ncoulshiftbits);
|
||||
|
||||
int ntable = 1;
|
||||
for (int i = 0; i < ncoultablebits; i++) ntable *= 2;
|
||||
|
||||
// linear lookup tables of length N = 2^ncoultablebits
|
||||
// stored value = value at lower edge of bin
|
||||
// d values = delta from lower edge to upper edge of bin
|
||||
|
||||
if (ftable) free_tables();
|
||||
|
||||
memory->create(rtable,ntable,"pair:rtable");
|
||||
memory->create(ftable,ntable,"pair:ftable");
|
||||
memory->create(ctable,ntable,"pair:ctable");
|
||||
memory->create(etable,ntable,"pair:etable");
|
||||
memory->create(drtable,ntable,"pair:drtable");
|
||||
memory->create(dftable,ntable,"pair:dftable");
|
||||
memory->create(dctable,ntable,"pair:dctable");
|
||||
memory->create(detable,ntable,"pair:detable");
|
||||
|
||||
if (cut_respa == NULL) {
|
||||
vtable = ptable = dvtable = dptable = NULL;
|
||||
} else {
|
||||
memory->create(vtable,ntable,"pair:vtable");
|
||||
memory->create(ptable,ntable,"pair:ptable");
|
||||
memory->create(dvtable,ntable,"pair:dvtable");
|
||||
memory->create(dptable,ntable,"pair:dptable");
|
||||
}
|
||||
|
||||
union_int_float_t rsq_lookup;
|
||||
union_int_float_t minrsq_lookup;
|
||||
int itablemin;
|
||||
minrsq_lookup.i = 0 << ncoulshiftbits;
|
||||
minrsq_lookup.i |= maskhi;
|
||||
|
||||
for (int i = 0; i < ntable; i++) {
|
||||
rsq_lookup.i = i << ncoulshiftbits;
|
||||
rsq_lookup.i |= masklo;
|
||||
if (rsq_lookup.f < tabinnersq) {
|
||||
rsq_lookup.i = i << ncoulshiftbits;
|
||||
rsq_lookup.i |= maskhi;
|
||||
}
|
||||
r = sqrtf(rsq_lookup.f);
|
||||
egamma = 1.0 - (r/cut_coul)*force->kspace->gamma(r/cut_coul);
|
||||
fgamma = 1.0 + (rsq_lookup.f/cut_coulsq)*force->kspace->dgamma(r/cut_coul);
|
||||
if (cut_respa == NULL) {
|
||||
rtable[i] = rsq_lookup.f;
|
||||
ftable[i] = qqrd2e/r * fgamma;
|
||||
ctable[i] = qqrd2e/r;
|
||||
etable[i] = qqrd2e/r * egamma;
|
||||
} else {
|
||||
rtable[i] = rsq_lookup.f;
|
||||
ftable[i] = qqrd2e/r * (fgamma - 1.0);
|
||||
ctable[i] = 0.0;
|
||||
etable[i] = qqrd2e/r * egamma;
|
||||
ptable[i] = qqrd2e/r;
|
||||
vtable[i] = qqrd2e/r * fgamma;
|
||||
if (rsq_lookup.f > cut_respa[2]*cut_respa[2]) {
|
||||
if (rsq_lookup.f < cut_respa[3]*cut_respa[3]) {
|
||||
rsw = (r - cut_respa[2])/(cut_respa[3] - cut_respa[2]);
|
||||
ftable[i] += qqrd2e/r * rsw*rsw*(3.0 - 2.0*rsw);
|
||||
ctable[i] = qqrd2e/r * rsw*rsw*(3.0 - 2.0*rsw);
|
||||
} else {
|
||||
ftable[i] = qqrd2e/r * fgamma;
|
||||
ctable[i] = qqrd2e/r;
|
||||
}
|
||||
}
|
||||
}
|
||||
minrsq_lookup.f = MIN(minrsq_lookup.f,rsq_lookup.f);
|
||||
}
|
||||
|
||||
tabinnersq = minrsq_lookup.f;
|
||||
|
||||
int ntablem1 = ntable - 1;
|
||||
|
||||
for (int i = 0; i < ntablem1; i++) {
|
||||
drtable[i] = 1.0/(rtable[i+1] - rtable[i]);
|
||||
dftable[i] = ftable[i+1] - ftable[i];
|
||||
dctable[i] = ctable[i+1] - ctable[i];
|
||||
detable[i] = etable[i+1] - etable[i];
|
||||
}
|
||||
|
||||
if (cut_respa) {
|
||||
for (int i = 0; i < ntablem1; i++) {
|
||||
dvtable[i] = vtable[i+1] - vtable[i];
|
||||
dptable[i] = ptable[i+1] - ptable[i];
|
||||
}
|
||||
}
|
||||
|
||||
// get the delta values for the last table entries
|
||||
// tables are connected periodically between 0 and ntablem1
|
||||
|
||||
drtable[ntablem1] = 1.0/(rtable[0] - rtable[ntablem1]);
|
||||
dftable[ntablem1] = ftable[0] - ftable[ntablem1];
|
||||
dctable[ntablem1] = ctable[0] - ctable[ntablem1];
|
||||
detable[ntablem1] = etable[0] - etable[ntablem1];
|
||||
if (cut_respa) {
|
||||
dvtable[ntablem1] = vtable[0] - vtable[ntablem1];
|
||||
dptable[ntablem1] = ptable[0] - ptable[ntablem1];
|
||||
}
|
||||
|
||||
// get the correct delta values at itablemax
|
||||
// smallest r is in bin itablemin
|
||||
// largest r is in bin itablemax, which is itablemin-1,
|
||||
// or ntablem1 if itablemin=0
|
||||
// deltas at itablemax only needed if corresponding rsq < cut*cut
|
||||
// if so, compute deltas between rsq and cut*cut
|
||||
|
||||
double f_tmp,c_tmp,e_tmp,p_tmp,v_tmp;
|
||||
itablemin = minrsq_lookup.i & ncoulmask;
|
||||
itablemin >>= ncoulshiftbits;
|
||||
int itablemax = itablemin - 1;
|
||||
if (itablemin == 0) itablemax = ntablem1;
|
||||
rsq_lookup.i = itablemax << ncoulshiftbits;
|
||||
rsq_lookup.i |= maskhi;
|
||||
|
||||
if (rsq_lookup.f < cut_coulsq) {
|
||||
rsq_lookup.f = cut_coulsq;
|
||||
r = sqrtf(rsq_lookup.f);
|
||||
egamma = 1.0 - (r/cut_coul)*force->kspace->gamma(r/cut_coul);
|
||||
fgamma = 1.0 + (rsq_lookup.f/cut_coulsq)*force->kspace->dgamma(r/cut_coul);
|
||||
|
||||
if (cut_respa == NULL) {
|
||||
f_tmp = qqrd2e/r * fgamma;
|
||||
c_tmp = qqrd2e/r;
|
||||
e_tmp = qqrd2e/r * egamma;
|
||||
} else {
|
||||
f_tmp = qqrd2e/r * (fgamma - 1.0);
|
||||
c_tmp = 0.0;
|
||||
e_tmp = qqrd2e/r * egamma;
|
||||
p_tmp = qqrd2e/r;
|
||||
v_tmp = qqrd2e/r * fgamma;
|
||||
if (rsq_lookup.f > cut_respa[2]*cut_respa[2]) {
|
||||
if (rsq_lookup.f < cut_respa[3]*cut_respa[3]) {
|
||||
rsw = (r - cut_respa[2])/(cut_respa[3] - cut_respa[2]);
|
||||
f_tmp += qqrd2e/r * rsw*rsw*(3.0 - 2.0*rsw);
|
||||
c_tmp = qqrd2e/r * rsw*rsw*(3.0 - 2.0*rsw);
|
||||
} else {
|
||||
f_tmp = qqrd2e/r * fgamma;
|
||||
c_tmp = qqrd2e/r;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
drtable[itablemax] = 1.0/(rsq_lookup.f - rtable[itablemax]);
|
||||
dftable[itablemax] = f_tmp - ftable[itablemax];
|
||||
dctable[itablemax] = c_tmp - ctable[itablemax];
|
||||
detable[itablemax] = e_tmp - etable[itablemax];
|
||||
if (cut_respa) {
|
||||
dvtable[itablemax] = v_tmp - vtable[itablemax];
|
||||
dptable[itablemax] = p_tmp - ptable[itablemax];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairCoulMSM::single(int i, int j, int itype, int jtype,
|
||||
double rsq,
|
||||
double factor_coul, double factor_lj,
|
||||
double &fforce)
|
||||
{
|
||||
double r2inv,r,egamma,fgamma,prefactor;
|
||||
double fraction,table,forcecoul,phicoul;
|
||||
int itable;
|
||||
|
||||
r2inv = 1.0/rsq;
|
||||
if (!ncoultablebits || rsq <= tabinnersq) {
|
||||
r = sqrt(rsq);
|
||||
egamma = 1.0 - (r/cut_coul)*force->kspace->gamma(r/cut_coul);
|
||||
fgamma = 1.0 + (rsq/cut_coulsq)*force->kspace->dgamma(r/cut_coul);
|
||||
prefactor = force->qqrd2e * atom->q[i]*atom->q[j]/r;
|
||||
forcecoul = prefactor * fgamma;
|
||||
|
||||
if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else {
|
||||
union_int_float_t rsq_lookup;
|
||||
rsq_lookup.f = rsq;
|
||||
itable = rsq_lookup.i & ncoulmask;
|
||||
itable >>= ncoulshiftbits;
|
||||
fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable];
|
||||
table = ftable[itable] + fraction*dftable[itable];
|
||||
forcecoul = atom->q[i]*atom->q[j] * table;
|
||||
if (factor_coul < 1.0) {
|
||||
table = ctable[itable] + fraction*dctable[itable];
|
||||
prefactor = atom->q[i]*atom->q[j] * table;
|
||||
forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
}
|
||||
}
|
||||
fforce = forcecoul * r2inv;
|
||||
|
||||
if (!ncoultablebits || rsq <= tabinnersq)
|
||||
phicoul = prefactor*egamma;
|
||||
else {
|
||||
table = etable[itable] + fraction*detable[itable];
|
||||
phicoul = atom->q[i]*atom->q[j] * table;
|
||||
}
|
||||
if (factor_coul < 1.0) phicoul -= (1.0-factor_coul)*prefactor;
|
||||
|
||||
return phicoul;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void *PairCoulMSM::extract(const char *str, int &dim)
|
||||
{
|
||||
if (strcmp(str,"cut_msm") == 0) {
|
||||
dim = 0;
|
||||
return (void *) &cut_coul;
|
||||
}
|
||||
if (strcmp(str,"scale") == 0) {
|
||||
dim = 2;
|
||||
return (void *) scale;
|
||||
}
|
||||
return NULL;
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
/* ----------------------------------------------------------------------
|
||||
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 PAIR_CLASS
|
||||
|
||||
PairStyle(coul/msm,PairCoulMSM)
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_PAIR_COUL_MSM_H
|
||||
#define LMP_PAIR_COUL_MSM_H
|
||||
|
||||
#include "pair_coul_long.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class PairCoulMSM : public PairCoulLong {
|
||||
public:
|
||||
PairCoulMSM(class LAMMPS *);
|
||||
virtual ~PairCoulMSM(){};
|
||||
virtual void compute(int, int);
|
||||
virtual double single(int, int, int, int, double, double, double, double &);
|
||||
virtual void *extract(const char *, int &);
|
||||
|
||||
protected:
|
||||
virtual void init_tables();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Illegal ... command
|
||||
|
||||
Self-explanatory. Check the input script syntax and compare to the
|
||||
documentation for the command. You can use -echo screen as a
|
||||
command-line option when running LAMMPS to see the offending line.
|
||||
|
||||
E: Incorrect args for pair coefficients
|
||||
|
||||
Self-explanatory. Check the input script or data file.
|
||||
|
||||
E: Pair style lj/cut/coul/msm requires atom attribute q
|
||||
|
||||
The atom style defined does not have this attribute.
|
||||
|
||||
E: Pair cutoff < Respa interior cutoff
|
||||
|
||||
One or more pairwise cutoffs are too short to use with the specified
|
||||
rRESPA cutoffs.
|
||||
|
||||
E: Pair style is incompatible with KSpace style
|
||||
|
||||
If a pair style with a long-range Coulombic component is selected,
|
||||
then a kspace style must also be used.
|
||||
|
||||
*/
|
|
@ -39,12 +39,12 @@ class PairLJCharmmCoulLong : public Pair {
|
|||
void read_restart(FILE *);
|
||||
void write_restart_settings(FILE *);
|
||||
void read_restart_settings(FILE *);
|
||||
double single(int, int, int, int, double, double, double, double &);
|
||||
virtual double single(int, int, int, int, double, double, double, double &);
|
||||
|
||||
void compute_inner();
|
||||
void compute_middle();
|
||||
void compute_outer(int, int);
|
||||
void *extract(const char *, int &);
|
||||
virtual void compute_outer(int, int);
|
||||
virtual void *extract(const char *, int &);
|
||||
|
||||
protected:
|
||||
int implicit;
|
||||
|
@ -65,7 +65,7 @@ class PairLJCharmmCoulLong : public Pair {
|
|||
int ncoulshiftbits,ncoulmask;
|
||||
|
||||
void allocate();
|
||||
void init_tables();
|
||||
virtual void init_tables();
|
||||
void free_tables();
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,647 @@
|
|||
/* ----------------------------------------------------------------------
|
||||
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 authors: Paul Crozier (SNL), Stan Moore (SNL)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "math.h"
|
||||
#include "stdio.h"
|
||||
#include "stdlib.h"
|
||||
#include "string.h"
|
||||
#include "pair_lj_charmm_coul_msm.h"
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "force.h"
|
||||
#include "kspace.h"
|
||||
#include "update.h"
|
||||
#include "integrate.h"
|
||||
#include "respa.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
#include "neigh_request.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairLJCharmmCoulMSM::PairLJCharmmCoulMSM(LAMMPS *lmp) : PairLJCharmmCoulLong(lmp)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
void PairLJCharmmCoulMSM::compute(int eflag, int vflag)
|
||||
{
|
||||
int i,j,ii,jj,inum,jnum,itype,jtype,itable;
|
||||
double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,evdwl,ecoul,fpair;
|
||||
double fraction,table;
|
||||
double r,r2inv,r6inv,forcecoul,forcelj,factor_coul,factor_lj;
|
||||
double egamma,fgamma,prefactor;
|
||||
double philj,switch1,switch2;
|
||||
int *ilist,*jlist,*numneigh,**firstneigh;
|
||||
double rsq;
|
||||
|
||||
evdwl = ecoul = 0.0;
|
||||
if (eflag || vflag) ev_setup(eflag,vflag);
|
||||
else evflag = vflag_fdotr = 0;
|
||||
|
||||
double **x = atom->x;
|
||||
double **f = atom->f;
|
||||
double *q = atom->q;
|
||||
int *type = atom->type;
|
||||
int nlocal = atom->nlocal;
|
||||
double *special_coul = force->special_coul;
|
||||
double *special_lj = force->special_lj;
|
||||
int newton_pair = force->newton_pair;
|
||||
double qqrd2e = force->qqrd2e;
|
||||
|
||||
inum = list->inum;
|
||||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
|
||||
// loop over neighbors of my atoms
|
||||
|
||||
for (ii = 0; ii < inum; ii++) {
|
||||
i = ilist[ii];
|
||||
qtmp = q[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
itype = type[i];
|
||||
jlist = firstneigh[i];
|
||||
jnum = numneigh[i];
|
||||
|
||||
for (jj = 0; jj < jnum; jj++) {
|
||||
j = jlist[jj];
|
||||
factor_lj = special_lj[sbmask(j)];
|
||||
factor_coul = special_coul[sbmask(j)];
|
||||
j &= NEIGHMASK;
|
||||
|
||||
delx = xtmp - x[j][0];
|
||||
dely = ytmp - x[j][1];
|
||||
delz = ztmp - x[j][2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
|
||||
if (rsq < cut_bothsq) {
|
||||
r2inv = 1.0/rsq;
|
||||
|
||||
if (rsq < cut_coulsq) {
|
||||
if (!ncoultablebits || rsq <= tabinnersq) {
|
||||
r = sqrt(rsq);
|
||||
prefactor = qqrd2e * qtmp*q[j]/r;
|
||||
egamma = 1.0 - (r/cut_coul)*force->kspace->gamma(r/cut_coul);
|
||||
fgamma = 1.0 + (rsq/cut_coulsq)*force->kspace->dgamma(r/cut_coul);
|
||||
forcecoul = prefactor * fgamma;
|
||||
if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else {
|
||||
union_int_float_t rsq_lookup;
|
||||
rsq_lookup.f = rsq;
|
||||
itable = rsq_lookup.i & ncoulmask;
|
||||
itable >>= ncoulshiftbits;
|
||||
fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable];
|
||||
table = ftable[itable] + fraction*dftable[itable];
|
||||
forcecoul = qtmp*q[j] * table;
|
||||
if (factor_coul < 1.0) {
|
||||
table = ctable[itable] + fraction*dctable[itable];
|
||||
prefactor = qtmp*q[j] * table;
|
||||
forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
}
|
||||
}
|
||||
} else forcecoul = 0.0;
|
||||
|
||||
if (rsq < cut_ljsq) {
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
jtype = type[j];
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
if (rsq > cut_lj_innersq) {
|
||||
switch1 = (cut_ljsq-rsq) * (cut_ljsq-rsq) *
|
||||
(cut_ljsq + 2.0*rsq - 3.0*cut_lj_innersq) / denom_lj;
|
||||
switch2 = 12.0*rsq * (cut_ljsq-rsq) *
|
||||
(rsq-cut_lj_innersq) / denom_lj;
|
||||
philj = r6inv * (lj3[itype][jtype]*r6inv - lj4[itype][jtype]);
|
||||
forcelj = forcelj*switch1 + philj*switch2;
|
||||
}
|
||||
} else forcelj = 0.0;
|
||||
|
||||
fpair = (forcecoul + factor_lj*forcelj) * r2inv;
|
||||
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
if (newton_pair || j < nlocal) {
|
||||
f[j][0] -= delx*fpair;
|
||||
f[j][1] -= dely*fpair;
|
||||
f[j][2] -= delz*fpair;
|
||||
}
|
||||
|
||||
if (eflag) {
|
||||
if (rsq < cut_coulsq) {
|
||||
if (!ncoultablebits || rsq <= tabinnersq)
|
||||
ecoul = prefactor*egamma;
|
||||
else {
|
||||
table = etable[itable] + fraction*detable[itable];
|
||||
ecoul = qtmp*q[j] * table;
|
||||
}
|
||||
if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else ecoul = 0.0;
|
||||
|
||||
if (rsq < cut_ljsq) {
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]);
|
||||
if (rsq > cut_lj_innersq) {
|
||||
switch1 = (cut_ljsq-rsq) * (cut_ljsq-rsq) *
|
||||
(cut_ljsq + 2.0*rsq - 3.0*cut_lj_innersq) / denom_lj;
|
||||
evdwl *= switch1;
|
||||
}
|
||||
evdwl *= factor_lj;
|
||||
} else evdwl = 0.0;
|
||||
}
|
||||
|
||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
||||
evdwl,ecoul,fpair,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (vflag_fdotr) virial_fdotr_compute();
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairLJCharmmCoulMSM::compute_outer(int eflag, int vflag)
|
||||
{
|
||||
int i,j,ii,jj,inum,jnum,itype,jtype,itable;
|
||||
double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,evdwl,ecoul,fpair;
|
||||
double fraction,table;
|
||||
double r,r2inv,r6inv,forcecoul,forcelj,factor_coul,factor_lj;
|
||||
double egamma,fgamma,prefactor;
|
||||
double philj,switch1,switch2;
|
||||
double rsw;
|
||||
int *ilist,*jlist,*numneigh,**firstneigh;
|
||||
double rsq;
|
||||
|
||||
evdwl = ecoul = 0.0;
|
||||
if (eflag || vflag) ev_setup(eflag,vflag);
|
||||
else evflag = 0;
|
||||
|
||||
double **x = atom->x;
|
||||
double **f = atom->f;
|
||||
double *q = atom->q;
|
||||
int *type = atom->type;
|
||||
int nlocal = atom->nlocal;
|
||||
double *special_coul = force->special_coul;
|
||||
double *special_lj = force->special_lj;
|
||||
int newton_pair = force->newton_pair;
|
||||
double qqrd2e = force->qqrd2e;
|
||||
|
||||
inum = listouter->inum;
|
||||
ilist = listouter->ilist;
|
||||
numneigh = listouter->numneigh;
|
||||
firstneigh = listouter->firstneigh;
|
||||
|
||||
double cut_in_off = cut_respa[2];
|
||||
double cut_in_on = cut_respa[3];
|
||||
|
||||
double cut_in_diff = cut_in_on - cut_in_off;
|
||||
double cut_in_off_sq = cut_in_off*cut_in_off;
|
||||
double cut_in_on_sq = cut_in_on*cut_in_on;
|
||||
|
||||
// loop over neighbors of my atoms
|
||||
|
||||
for (ii = 0; ii < inum; ii++) {
|
||||
i = ilist[ii];
|
||||
qtmp = q[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
itype = type[i];
|
||||
jlist = firstneigh[i];
|
||||
jnum = numneigh[i];
|
||||
|
||||
for (jj = 0; jj < jnum; jj++) {
|
||||
j = jlist[jj];
|
||||
factor_lj = special_lj[sbmask(j)];
|
||||
factor_coul = special_coul[sbmask(j)];
|
||||
j &= NEIGHMASK;
|
||||
|
||||
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 < cut_bothsq) {
|
||||
r2inv = 1.0/rsq;
|
||||
|
||||
if (rsq < cut_coulsq) {
|
||||
if (!ncoultablebits || rsq <= tabinnersq) {
|
||||
r = sqrt(rsq);
|
||||
prefactor = qqrd2e * qtmp*q[j]/r;
|
||||
egamma = 1.0 - (r/cut_coul)*force->kspace->gamma(r/cut_coul);
|
||||
fgamma = 1.0 + (rsq/cut_coulsq)*force->kspace->dgamma(r/cut_coul);
|
||||
forcecoul = prefactor * (fgamma - 1.0);
|
||||
if (rsq > cut_in_off_sq) {
|
||||
if (rsq < cut_in_on_sq) {
|
||||
rsw = (r - cut_in_off)/cut_in_diff;
|
||||
forcecoul += prefactor*rsw*rsw*(3.0 - 2.0*rsw);
|
||||
if (factor_coul < 1.0)
|
||||
forcecoul -=
|
||||
(1.0-factor_coul)*prefactor*rsw*rsw*(3.0 - 2.0*rsw);
|
||||
} else {
|
||||
forcecoul += prefactor;
|
||||
if (factor_coul < 1.0)
|
||||
forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
union_int_float_t rsq_lookup;
|
||||
rsq_lookup.f = rsq;
|
||||
itable = rsq_lookup.i & ncoulmask;
|
||||
itable >>= ncoulshiftbits;
|
||||
fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable];
|
||||
table = ftable[itable] + fraction*dftable[itable];
|
||||
forcecoul = qtmp*q[j] * table;
|
||||
if (factor_coul < 1.0) {
|
||||
table = ctable[itable] + fraction*dctable[itable];
|
||||
prefactor = qtmp*q[j] * table;
|
||||
forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
}
|
||||
}
|
||||
} else forcecoul = 0.0;
|
||||
|
||||
if (rsq < cut_ljsq && rsq > cut_in_off_sq) {
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
if (rsq > cut_lj_innersq) {
|
||||
switch1 = (cut_ljsq-rsq) * (cut_ljsq-rsq) *
|
||||
(cut_ljsq + 2.0*rsq - 3.0*cut_lj_innersq) / denom_lj;
|
||||
switch2 = 12.0*rsq * (cut_ljsq-rsq) *
|
||||
(rsq-cut_lj_innersq) / denom_lj;
|
||||
philj = r6inv * (lj3[itype][jtype]*r6inv - lj4[itype][jtype]);
|
||||
forcelj = forcelj*switch1 + philj*switch2;
|
||||
}
|
||||
if (rsq < cut_in_on_sq) {
|
||||
rsw = (sqrt(rsq) - cut_in_off)/cut_in_diff;
|
||||
forcelj *= rsw*rsw*(3.0 - 2.0*rsw);
|
||||
}
|
||||
} else forcelj = 0.0;
|
||||
|
||||
fpair = (forcecoul + forcelj) * r2inv;
|
||||
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
if (newton_pair || j < nlocal) {
|
||||
f[j][0] -= delx*fpair;
|
||||
f[j][1] -= dely*fpair;
|
||||
f[j][2] -= delz*fpair;
|
||||
}
|
||||
|
||||
if (eflag) {
|
||||
if (rsq < cut_coulsq) {
|
||||
if (!ncoultablebits || rsq <= tabinnersq) {
|
||||
ecoul = prefactor*egamma;
|
||||
if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else {
|
||||
table = etable[itable] + fraction*detable[itable];
|
||||
ecoul = qtmp*q[j] * table;
|
||||
if (factor_coul < 1.0) {
|
||||
table = ptable[itable] + fraction*dptable[itable];
|
||||
prefactor = qtmp*q[j] * table;
|
||||
ecoul -= (1.0-factor_coul)*prefactor;
|
||||
}
|
||||
}
|
||||
} else ecoul = 0.0;
|
||||
|
||||
if (rsq < cut_ljsq) {
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]);
|
||||
if (rsq > cut_lj_innersq) {
|
||||
switch1 = (cut_ljsq-rsq) * (cut_ljsq-rsq) *
|
||||
(cut_ljsq + 2.0*rsq - 3.0*cut_lj_innersq) / denom_lj;
|
||||
evdwl *= switch1;
|
||||
}
|
||||
evdwl *= factor_lj;
|
||||
} else evdwl = 0.0;
|
||||
}
|
||||
|
||||
if (vflag) {
|
||||
if (rsq < cut_coulsq) {
|
||||
if (!ncoultablebits || rsq <= tabinnersq) {
|
||||
forcecoul = prefactor * fgamma;
|
||||
if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else {
|
||||
table = vtable[itable] + fraction*dvtable[itable];
|
||||
forcecoul = qtmp*q[j] * table;
|
||||
if (factor_coul < 1.0) {
|
||||
table = ptable[itable] + fraction*dptable[itable];
|
||||
prefactor = qtmp*q[j] * table;
|
||||
forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
}
|
||||
}
|
||||
} else forcecoul = 0.0;
|
||||
|
||||
if (rsq <= cut_in_off_sq) {
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
if (rsq > cut_lj_innersq) {
|
||||
switch1 = (cut_ljsq-rsq) * (cut_ljsq-rsq) *
|
||||
(cut_ljsq + 2.0*rsq - 3.0*cut_lj_innersq) / denom_lj;
|
||||
switch2 = 12.0*rsq * (cut_ljsq-rsq) *
|
||||
(rsq-cut_lj_innersq) / denom_lj;
|
||||
philj = r6inv * (lj3[itype][jtype]*r6inv - lj4[itype][jtype]);
|
||||
forcelj = forcelj*switch1 + philj*switch2;
|
||||
}
|
||||
} else if (rsq <= cut_in_on_sq) {
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
if (rsq > cut_lj_innersq) {
|
||||
switch1 = (cut_ljsq-rsq) * (cut_ljsq-rsq) *
|
||||
(cut_ljsq + 2.0*rsq - 3.0*cut_lj_innersq) / denom_lj;
|
||||
switch2 = 12.0*rsq * (cut_ljsq-rsq) *
|
||||
(rsq-cut_lj_innersq) / denom_lj;
|
||||
philj = r6inv * (lj3[itype][jtype]*r6inv - lj4[itype][jtype]);
|
||||
forcelj = forcelj*switch1 + philj*switch2;
|
||||
}
|
||||
}
|
||||
|
||||
fpair = (forcecoul + factor_lj*forcelj) * r2inv;
|
||||
}
|
||||
|
||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
||||
evdwl,ecoul,fpair,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
setup force tables used in compute routines
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLJCharmmCoulMSM::init_tables()
|
||||
{
|
||||
int masklo,maskhi;
|
||||
double r,egamma,fgamma,rsw;
|
||||
double qqrd2e = force->qqrd2e;
|
||||
|
||||
tabinnersq = tabinner*tabinner;
|
||||
init_bitmap(tabinner,cut_coul,ncoultablebits,
|
||||
masklo,maskhi,ncoulmask,ncoulshiftbits);
|
||||
|
||||
int ntable = 1;
|
||||
for (int i = 0; i < ncoultablebits; i++) ntable *= 2;
|
||||
|
||||
// linear lookup tables of length N = 2^ncoultablebits
|
||||
// stored value = value at lower edge of bin
|
||||
// d values = delta from lower edge to upper edge of bin
|
||||
|
||||
if (ftable) free_tables();
|
||||
|
||||
memory->create(rtable,ntable,"pair:rtable");
|
||||
memory->create(ftable,ntable,"pair:ftable");
|
||||
memory->create(ctable,ntable,"pair:ctable");
|
||||
memory->create(etable,ntable,"pair:etable");
|
||||
memory->create(drtable,ntable,"pair:drtable");
|
||||
memory->create(dftable,ntable,"pair:dftable");
|
||||
memory->create(dctable,ntable,"pair:dctable");
|
||||
memory->create(detable,ntable,"pair:detable");
|
||||
|
||||
if (cut_respa == NULL) {
|
||||
vtable = ptable = dvtable = dptable = NULL;
|
||||
} else {
|
||||
memory->create(vtable,ntable,"pair:vtable");
|
||||
memory->create(ptable,ntable,"pair:ptable");
|
||||
memory->create(dvtable,ntable,"pair:dvtable");
|
||||
memory->create(dptable,ntable,"pair:dptable");
|
||||
}
|
||||
|
||||
union_int_float_t rsq_lookup;
|
||||
union_int_float_t minrsq_lookup;
|
||||
int itablemin;
|
||||
minrsq_lookup.i = 0 << ncoulshiftbits;
|
||||
minrsq_lookup.i |= maskhi;
|
||||
|
||||
for (int i = 0; i < ntable; i++) {
|
||||
rsq_lookup.i = i << ncoulshiftbits;
|
||||
rsq_lookup.i |= masklo;
|
||||
if (rsq_lookup.f < tabinnersq) {
|
||||
rsq_lookup.i = i << ncoulshiftbits;
|
||||
rsq_lookup.i |= maskhi;
|
||||
}
|
||||
r = sqrtf(rsq_lookup.f);
|
||||
egamma = 1.0 - (r/cut_coul)*force->kspace->gamma(r/cut_coul);
|
||||
fgamma = 1.0 + (rsq_lookup.f/cut_coulsq)*force->kspace->dgamma(r/cut_coul);
|
||||
if (cut_respa == NULL) {
|
||||
rtable[i] = rsq_lookup.f;
|
||||
ftable[i] = qqrd2e/r * fgamma;
|
||||
ctable[i] = qqrd2e/r;
|
||||
etable[i] = qqrd2e/r * egamma;
|
||||
} else {
|
||||
rtable[i] = rsq_lookup.f;
|
||||
ftable[i] = qqrd2e/r * (fgamma - 1.0);
|
||||
ctable[i] = 0.0;
|
||||
etable[i] = qqrd2e/r * egamma;
|
||||
ptable[i] = qqrd2e/r;
|
||||
vtable[i] = qqrd2e/r * fgamma;
|
||||
if (rsq_lookup.f > cut_respa[2]*cut_respa[2]) {
|
||||
if (rsq_lookup.f < cut_respa[3]*cut_respa[3]) {
|
||||
rsw = (r - cut_respa[2])/(cut_respa[3] - cut_respa[2]);
|
||||
ftable[i] += qqrd2e/r * rsw*rsw*(3.0 - 2.0*rsw);
|
||||
ctable[i] = qqrd2e/r * rsw*rsw*(3.0 - 2.0*rsw);
|
||||
} else {
|
||||
ftable[i] = qqrd2e/r * fgamma;
|
||||
ctable[i] = qqrd2e/r;
|
||||
}
|
||||
}
|
||||
}
|
||||
minrsq_lookup.f = MIN(minrsq_lookup.f,rsq_lookup.f);
|
||||
}
|
||||
|
||||
tabinnersq = minrsq_lookup.f;
|
||||
|
||||
int ntablem1 = ntable - 1;
|
||||
|
||||
for (int i = 0; i < ntablem1; i++) {
|
||||
drtable[i] = 1.0/(rtable[i+1] - rtable[i]);
|
||||
dftable[i] = ftable[i+1] - ftable[i];
|
||||
dctable[i] = ctable[i+1] - ctable[i];
|
||||
detable[i] = etable[i+1] - etable[i];
|
||||
}
|
||||
|
||||
if (cut_respa) {
|
||||
for (int i = 0; i < ntablem1; i++) {
|
||||
dvtable[i] = vtable[i+1] - vtable[i];
|
||||
dptable[i] = ptable[i+1] - ptable[i];
|
||||
}
|
||||
}
|
||||
|
||||
// get the delta values for the last table entries
|
||||
// tables are connected periodically between 0 and ntablem1
|
||||
|
||||
drtable[ntablem1] = 1.0/(rtable[0] - rtable[ntablem1]);
|
||||
dftable[ntablem1] = ftable[0] - ftable[ntablem1];
|
||||
dctable[ntablem1] = ctable[0] - ctable[ntablem1];
|
||||
detable[ntablem1] = etable[0] - etable[ntablem1];
|
||||
if (cut_respa) {
|
||||
dvtable[ntablem1] = vtable[0] - vtable[ntablem1];
|
||||
dptable[ntablem1] = ptable[0] - ptable[ntablem1];
|
||||
}
|
||||
|
||||
// get the correct delta values at itablemax
|
||||
// smallest r is in bin itablemin
|
||||
// largest r is in bin itablemax, which is itablemin-1,
|
||||
// or ntablem1 if itablemin=0
|
||||
// deltas at itablemax only needed if corresponding rsq < cut*cut
|
||||
// if so, compute deltas between rsq and cut*cut
|
||||
|
||||
double f_tmp,c_tmp,e_tmp,p_tmp,v_tmp;
|
||||
itablemin = minrsq_lookup.i & ncoulmask;
|
||||
itablemin >>= ncoulshiftbits;
|
||||
int itablemax = itablemin - 1;
|
||||
if (itablemin == 0) itablemax = ntablem1;
|
||||
rsq_lookup.i = itablemax << ncoulshiftbits;
|
||||
rsq_lookup.i |= maskhi;
|
||||
|
||||
if (rsq_lookup.f < cut_coulsq) {
|
||||
rsq_lookup.f = cut_coulsq;
|
||||
r = sqrtf(rsq_lookup.f);
|
||||
egamma = 1.0 - (r/cut_coul)*force->kspace->gamma(r/cut_coul);
|
||||
fgamma = 1.0 + (rsq_lookup.f/cut_coulsq)*force->kspace->dgamma(r/cut_coul);
|
||||
|
||||
if (cut_respa == NULL) {
|
||||
f_tmp = qqrd2e/r * fgamma;
|
||||
c_tmp = qqrd2e/r;
|
||||
e_tmp = qqrd2e/r * egamma;
|
||||
} else {
|
||||
f_tmp = qqrd2e/r * (fgamma - 1.0);
|
||||
c_tmp = 0.0;
|
||||
e_tmp = qqrd2e/r * egamma;
|
||||
p_tmp = qqrd2e/r;
|
||||
v_tmp = qqrd2e/r * fgamma;
|
||||
if (rsq_lookup.f > cut_respa[2]*cut_respa[2]) {
|
||||
if (rsq_lookup.f < cut_respa[3]*cut_respa[3]) {
|
||||
rsw = (r - cut_respa[2])/(cut_respa[3] - cut_respa[2]);
|
||||
f_tmp += qqrd2e/r * rsw*rsw*(3.0 - 2.0*rsw);
|
||||
c_tmp = qqrd2e/r * rsw*rsw*(3.0 - 2.0*rsw);
|
||||
} else {
|
||||
f_tmp = qqrd2e/r * fgamma;
|
||||
c_tmp = qqrd2e/r;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
drtable[itablemax] = 1.0/(rsq_lookup.f - rtable[itablemax]);
|
||||
dftable[itablemax] = f_tmp - ftable[itablemax];
|
||||
dctable[itablemax] = c_tmp - ctable[itablemax];
|
||||
detable[itablemax] = e_tmp - etable[itablemax];
|
||||
if (cut_respa) {
|
||||
dvtable[itablemax] = v_tmp - vtable[itablemax];
|
||||
dptable[itablemax] = p_tmp - ptable[itablemax];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairLJCharmmCoulMSM::single(int i, int j, int itype, int jtype,
|
||||
double rsq,
|
||||
double factor_coul, double factor_lj,
|
||||
double &fforce)
|
||||
{
|
||||
double r2inv,r6inv,r,egamma,fgamma,prefactor;
|
||||
double switch1,switch2,fraction,table,forcecoul,forcelj,phicoul,philj;
|
||||
int itable;
|
||||
|
||||
r2inv = 1.0/rsq;
|
||||
if (rsq < cut_coulsq) {
|
||||
if (!ncoultablebits || rsq <= tabinnersq) {
|
||||
r = sqrt(rsq);
|
||||
egamma = 1.0 - (r/cut_coul)*force->kspace->gamma(r/cut_coul);
|
||||
fgamma = 1.0 + (rsq/cut_coulsq)*force->kspace->dgamma(r/cut_coul);
|
||||
prefactor = force->qqrd2e * atom->q[i]*atom->q[j]/r;
|
||||
forcecoul = prefactor * fgamma;
|
||||
if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else {
|
||||
union_int_float_t rsq_lookup;
|
||||
rsq_lookup.f = rsq;
|
||||
itable = rsq_lookup.i & ncoulmask;
|
||||
itable >>= ncoulshiftbits;
|
||||
fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable];
|
||||
table = ftable[itable] + fraction*dftable[itable];
|
||||
forcecoul = atom->q[i]*atom->q[j] * table;
|
||||
if (factor_coul < 1.0) {
|
||||
table = ctable[itable] + fraction*dctable[itable];
|
||||
prefactor = atom->q[i]*atom->q[j] * table;
|
||||
forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
}
|
||||
}
|
||||
} else forcecoul = 0.0;
|
||||
if (rsq < cut_ljsq) {
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
if (rsq > cut_lj_innersq) {
|
||||
switch1 = (cut_ljsq-rsq) * (cut_ljsq-rsq) *
|
||||
(cut_ljsq + 2.0*rsq - 3.0*cut_lj_innersq) / denom_lj;
|
||||
switch2 = 12.0*rsq * (cut_ljsq-rsq) *
|
||||
(rsq-cut_lj_innersq) / denom_lj;
|
||||
philj = r6inv * (lj3[itype][jtype]*r6inv - lj4[itype][jtype]);
|
||||
forcelj = forcelj*switch1 + philj*switch2;
|
||||
}
|
||||
} else forcelj = 0.0;
|
||||
fforce = (forcecoul + factor_lj*forcelj) * r2inv;
|
||||
|
||||
double eng = 0.0;
|
||||
if (rsq < cut_coulsq) {
|
||||
if (!ncoultablebits || rsq <= tabinnersq)
|
||||
phicoul = prefactor*egamma;
|
||||
else {
|
||||
table = etable[itable] + fraction*detable[itable];
|
||||
phicoul = atom->q[i]*atom->q[j] * table;
|
||||
}
|
||||
if (factor_coul < 1.0) phicoul -= (1.0-factor_coul)*prefactor;
|
||||
eng += phicoul;
|
||||
}
|
||||
|
||||
if (rsq < cut_ljsq) {
|
||||
philj = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]);
|
||||
if (rsq > cut_lj_innersq) {
|
||||
switch1 = (cut_ljsq-rsq) * (cut_ljsq-rsq) *
|
||||
(cut_ljsq + 2.0*rsq - 3.0*cut_lj_innersq) / denom_lj;
|
||||
philj *= switch1;
|
||||
}
|
||||
eng += factor_lj*philj;
|
||||
}
|
||||
|
||||
return eng;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void *PairLJCharmmCoulMSM::extract(const char *str, int &dim)
|
||||
{
|
||||
dim = 2;
|
||||
if (strcmp(str,"lj14_1") == 0) return (void *) lj14_1;
|
||||
if (strcmp(str,"lj14_2") == 0) return (void *) lj14_2;
|
||||
if (strcmp(str,"lj14_3") == 0) return (void *) lj14_3;
|
||||
if (strcmp(str,"lj14_4") == 0) return (void *) lj14_4;
|
||||
|
||||
dim = 0;
|
||||
if (strcmp(str,"implicit") == 0) return (void *) &implicit;
|
||||
if (strcmp(str,"cut_msm") == 0) return (void *) &cut_coul;
|
||||
|
||||
return NULL;
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
/* ----------------------------------------------------------------------
|
||||
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 PAIR_CLASS
|
||||
|
||||
PairStyle(lj/charmm/coul/msm,PairLJCharmmCoulMSM)
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_PAIR_LJ_CHARMM_COUL_MSM_H
|
||||
#define LMP_PAIR_LJ_CHARMM_COUL_MSM_H
|
||||
|
||||
#include "pair_lj_charmm_coul_long.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class PairLJCharmmCoulMSM : public PairLJCharmmCoulLong {
|
||||
public:
|
||||
PairLJCharmmCoulMSM(class LAMMPS *);
|
||||
virtual ~PairLJCharmmCoulMSM(){};
|
||||
virtual void compute(int, int);
|
||||
virtual double single(int, int, int, int, double, double, double, double &);
|
||||
virtual void compute_outer(int, int);
|
||||
virtual void *extract(const char *, int &);
|
||||
|
||||
protected:
|
||||
virtual void init_tables();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Illegal ... command
|
||||
|
||||
Self-explanatory. Check the input script syntax and compare to the
|
||||
documentation for the command. You can use -echo screen as a
|
||||
command-line option when running LAMMPS to see the offending line.
|
||||
|
||||
E: Incorrect args for pair coefficients
|
||||
|
||||
Self-explanatory. Check the input script or data file.
|
||||
|
||||
E: Pair style lj/charmm/coul/long requires atom attribute q
|
||||
|
||||
The atom style defined does not have these attributes.
|
||||
|
||||
E: Pair inner cutoff >= Pair outer cutoff
|
||||
|
||||
The specified cutoffs for the pair style are inconsistent.
|
||||
|
||||
E: Pair cutoff < Respa interior cutoff
|
||||
|
||||
One or more pairwise cutoffs are too short to use with the specified
|
||||
rRESPA cutoffs.
|
||||
|
||||
E: Pair inner cutoff < Respa interior cutoff
|
||||
|
||||
One or more pairwise cutoffs are too short to use with the specified
|
||||
rRESPA cutoffs.
|
||||
|
||||
E: Pair style is incompatible with KSpace style
|
||||
|
||||
If a pair style with a long-range Coulombic component is selected,
|
||||
then a kspace style must also be used.
|
||||
|
||||
*/
|
|
@ -25,6 +25,7 @@ PairStyle(lj/cut/coul/long,PairLJCutCoulLong)
|
|||
namespace LAMMPS_NS {
|
||||
|
||||
class PairLJCutCoulLong : public Pair {
|
||||
|
||||
public:
|
||||
PairLJCutCoulLong(class LAMMPS *);
|
||||
virtual ~PairLJCutCoulLong();
|
||||
|
@ -42,8 +43,8 @@ class PairLJCutCoulLong : public Pair {
|
|||
|
||||
void compute_inner();
|
||||
void compute_middle();
|
||||
void compute_outer(int, int);
|
||||
void *extract(const char *, int &);
|
||||
virtual void compute_outer(int, int);
|
||||
virtual void *extract(const char *, int &);
|
||||
|
||||
protected:
|
||||
double cut_lj_global;
|
||||
|
@ -61,7 +62,7 @@ class PairLJCutCoulLong : public Pair {
|
|||
int ncoulshiftbits,ncoulmask;
|
||||
|
||||
void allocate();
|
||||
void init_tables();
|
||||
virtual void init_tables();
|
||||
void free_tables();
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,590 @@
|
|||
/* ----------------------------------------------------------------------
|
||||
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 authors: Stan Moore (SNL), Paul Crozier (SNL)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "math.h"
|
||||
#include "stdio.h"
|
||||
#include "stdlib.h"
|
||||
#include "string.h"
|
||||
#include "pair_lj_cut_coul_msm.h"
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "force.h"
|
||||
#include "kspace.h"
|
||||
#include "update.h"
|
||||
#include "integrate.h"
|
||||
#include "respa.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
#include "neigh_request.h"
|
||||
#include "math_const.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace MathConst;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairLJCutCoulMSM::PairLJCutCoulMSM(LAMMPS *lmp) : PairLJCutCoulLong(lmp)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairLJCutCoulMSM::compute(int eflag, int vflag)
|
||||
{
|
||||
int i,ii,j,jj,inum,jnum,itype,jtype,itable;
|
||||
double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,evdwl,ecoul,fpair;
|
||||
double fraction,table;
|
||||
double r,r2inv,r6inv,forcecoul,forcelj,factor_coul,factor_lj;
|
||||
double egamma,fgamma,prefactor;
|
||||
int *ilist,*jlist,*numneigh,**firstneigh;
|
||||
double rsq;
|
||||
|
||||
evdwl = ecoul = 0.0;
|
||||
if (eflag || vflag) ev_setup(eflag,vflag);
|
||||
else evflag = vflag_fdotr = 0;
|
||||
|
||||
double **x = atom->x;
|
||||
double **f = atom->f;
|
||||
double *q = atom->q;
|
||||
int *type = atom->type;
|
||||
int nlocal = atom->nlocal;
|
||||
double *special_coul = force->special_coul;
|
||||
double *special_lj = force->special_lj;
|
||||
int newton_pair = force->newton_pair;
|
||||
double qqrd2e = force->qqrd2e;
|
||||
|
||||
inum = list->inum;
|
||||
ilist = list->ilist;
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
|
||||
// loop over neighbors of my atoms
|
||||
|
||||
for (ii = 0; ii < inum; ii++) {
|
||||
i = ilist[ii];
|
||||
qtmp = q[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
itype = type[i];
|
||||
jlist = firstneigh[i];
|
||||
jnum = numneigh[i];
|
||||
|
||||
for (jj = 0; jj < jnum; jj++) {
|
||||
j = jlist[jj];
|
||||
factor_lj = special_lj[sbmask(j)];
|
||||
factor_coul = special_coul[sbmask(j)];
|
||||
j &= NEIGHMASK;
|
||||
|
||||
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]) {
|
||||
r2inv = 1.0/rsq;
|
||||
|
||||
if (rsq < cut_coulsq) {
|
||||
if (!ncoultablebits || rsq <= tabinnersq) {
|
||||
r = sqrt(rsq);
|
||||
prefactor = qqrd2e * qtmp*q[j]/r;
|
||||
egamma = 1.0 - (r/cut_coul)*force->kspace->gamma(r/cut_coul);
|
||||
fgamma = 1.0 + (rsq/cut_coulsq)*force->kspace->dgamma(r/cut_coul);
|
||||
forcecoul = prefactor * fgamma;
|
||||
if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else {
|
||||
union_int_float_t rsq_lookup;
|
||||
rsq_lookup.f = rsq;
|
||||
itable = rsq_lookup.i & ncoulmask;
|
||||
itable >>= ncoulshiftbits;
|
||||
fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable];
|
||||
table = ftable[itable] + fraction*dftable[itable];
|
||||
forcecoul = qtmp*q[j] * table;
|
||||
if (factor_coul < 1.0) {
|
||||
table = ctable[itable] + fraction*dctable[itable];
|
||||
prefactor = qtmp*q[j] * table;
|
||||
forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
}
|
||||
}
|
||||
} else forcecoul = 0.0;
|
||||
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
} else forcelj = 0.0;
|
||||
|
||||
fpair = (forcecoul + factor_lj*forcelj) * r2inv;
|
||||
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
if (newton_pair || j < nlocal) {
|
||||
f[j][0] -= delx*fpair;
|
||||
f[j][1] -= dely*fpair;
|
||||
f[j][2] -= delz*fpair;
|
||||
}
|
||||
|
||||
if (eflag) {
|
||||
if (rsq < cut_coulsq) {
|
||||
if (!ncoultablebits || rsq <= tabinnersq)
|
||||
ecoul = prefactor*egamma;
|
||||
else {
|
||||
table = etable[itable] + fraction*detable[itable];
|
||||
ecoul = qtmp*q[j] * table;
|
||||
}
|
||||
if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else ecoul = 0.0;
|
||||
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]) -
|
||||
offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
} else evdwl = 0.0;
|
||||
}
|
||||
|
||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
||||
evdwl,ecoul,fpair,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (vflag_fdotr) virial_fdotr_compute();
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairLJCutCoulMSM::compute_outer(int eflag, int vflag)
|
||||
{
|
||||
int i,j,ii,jj,inum,jnum,itype,jtype,itable;
|
||||
double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,evdwl,ecoul,fpair;
|
||||
double fraction,table;
|
||||
double r,r2inv,r6inv,forcecoul,forcelj,factor_coul,factor_lj;
|
||||
double egamma,fgamma,prefactor;
|
||||
double rsw;
|
||||
int *ilist,*jlist,*numneigh,**firstneigh;
|
||||
double rsq;
|
||||
|
||||
evdwl = ecoul = 0.0;
|
||||
if (eflag || vflag) ev_setup(eflag,vflag);
|
||||
else evflag = 0;
|
||||
|
||||
double **x = atom->x;
|
||||
double **f = atom->f;
|
||||
double *q = atom->q;
|
||||
int *type = atom->type;
|
||||
int nlocal = atom->nlocal;
|
||||
double *special_coul = force->special_coul;
|
||||
double *special_lj = force->special_lj;
|
||||
int newton_pair = force->newton_pair;
|
||||
double qqrd2e = force->qqrd2e;
|
||||
|
||||
inum = listouter->inum;
|
||||
ilist = listouter->ilist;
|
||||
numneigh = listouter->numneigh;
|
||||
firstneigh = listouter->firstneigh;
|
||||
|
||||
double cut_in_off = cut_respa[2];
|
||||
double cut_in_on = cut_respa[3];
|
||||
|
||||
double cut_in_diff = cut_in_on - cut_in_off;
|
||||
double cut_in_off_sq = cut_in_off*cut_in_off;
|
||||
double cut_in_on_sq = cut_in_on*cut_in_on;
|
||||
|
||||
// loop over neighbors of my atoms
|
||||
|
||||
for (ii = 0; ii < inum; ii++) {
|
||||
i = ilist[ii];
|
||||
qtmp = q[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
itype = type[i];
|
||||
jlist = firstneigh[i];
|
||||
jnum = numneigh[i];
|
||||
|
||||
for (jj = 0; jj < jnum; jj++) {
|
||||
j = jlist[jj];
|
||||
factor_lj = special_lj[sbmask(j)];
|
||||
factor_coul = special_coul[sbmask(j)];
|
||||
j &= NEIGHMASK;
|
||||
|
||||
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]) {
|
||||
r2inv = 1.0/rsq;
|
||||
|
||||
if (rsq < cut_coulsq) {
|
||||
if (!ncoultablebits || rsq <= tabinnersq) {
|
||||
r = sqrt(rsq);
|
||||
prefactor = qqrd2e * qtmp*q[j]/r;
|
||||
egamma = 1.0 - (r/cut_coul)*force->kspace->gamma(r/cut_coul);
|
||||
fgamma = 1.0 + (rsq/cut_coulsq)*force->kspace->dgamma(r/cut_coul);
|
||||
forcecoul = prefactor * (fgamma - 1.0);
|
||||
if (rsq > cut_in_off_sq) {
|
||||
if (rsq < cut_in_on_sq) {
|
||||
rsw = (r - cut_in_off)/cut_in_diff;
|
||||
forcecoul += prefactor*rsw*rsw*(3.0 - 2.0*rsw);
|
||||
if (factor_coul < 1.0)
|
||||
forcecoul -=
|
||||
(1.0-factor_coul)*prefactor*rsw*rsw*(3.0 - 2.0*rsw);
|
||||
} else {
|
||||
forcecoul += prefactor;
|
||||
if (factor_coul < 1.0)
|
||||
forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
union_int_float_t rsq_lookup;
|
||||
rsq_lookup.f = rsq;
|
||||
itable = rsq_lookup.i & ncoulmask;
|
||||
itable >>= ncoulshiftbits;
|
||||
fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable];
|
||||
table = ftable[itable] + fraction*dftable[itable];
|
||||
forcecoul = qtmp*q[j] * table;
|
||||
if (factor_coul < 1.0) {
|
||||
table = ctable[itable] + fraction*dctable[itable];
|
||||
prefactor = qtmp*q[j] * table;
|
||||
forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
}
|
||||
}
|
||||
} else forcecoul = 0.0;
|
||||
|
||||
if (rsq < cut_ljsq[itype][jtype] && rsq > cut_in_off_sq) {
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
if (rsq < cut_in_on_sq) {
|
||||
rsw = (sqrt(rsq) - cut_in_off)/cut_in_diff;
|
||||
forcelj *= rsw*rsw*(3.0 - 2.0*rsw);
|
||||
}
|
||||
} else forcelj = 0.0;
|
||||
|
||||
fpair = (forcecoul + forcelj) * r2inv;
|
||||
|
||||
f[i][0] += delx*fpair;
|
||||
f[i][1] += dely*fpair;
|
||||
f[i][2] += delz*fpair;
|
||||
if (newton_pair || j < nlocal) {
|
||||
f[j][0] -= delx*fpair;
|
||||
f[j][1] -= dely*fpair;
|
||||
f[j][2] -= delz*fpair;
|
||||
}
|
||||
|
||||
if (eflag) {
|
||||
if (rsq < cut_coulsq) {
|
||||
if (!ncoultablebits || rsq <= tabinnersq) {
|
||||
ecoul = prefactor*egamma;
|
||||
if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else {
|
||||
table = etable[itable] + fraction*detable[itable];
|
||||
ecoul = qtmp*q[j] * table;
|
||||
if (factor_coul < 1.0) {
|
||||
table = ptable[itable] + fraction*dptable[itable];
|
||||
prefactor = qtmp*q[j] * table;
|
||||
ecoul -= (1.0-factor_coul)*prefactor;
|
||||
}
|
||||
}
|
||||
} else ecoul = 0.0;
|
||||
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
evdwl = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]) -
|
||||
offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
} else evdwl = 0.0;
|
||||
}
|
||||
|
||||
if (vflag) {
|
||||
if (rsq < cut_coulsq) {
|
||||
if (!ncoultablebits || rsq <= tabinnersq) {
|
||||
forcecoul = prefactor * fgamma;
|
||||
if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else {
|
||||
table = vtable[itable] + fraction*dvtable[itable];
|
||||
forcecoul = qtmp*q[j] * table;
|
||||
if (factor_coul < 1.0) {
|
||||
table = ptable[itable] + fraction*dptable[itable];
|
||||
prefactor = qtmp*q[j] * table;
|
||||
forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
}
|
||||
}
|
||||
} else forcecoul = 0.0;
|
||||
|
||||
if (rsq <= cut_in_off_sq) {
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
} else if (rsq <= cut_in_on_sq)
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
|
||||
fpair = (forcecoul + factor_lj*forcelj) * r2inv;
|
||||
}
|
||||
|
||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
||||
evdwl,ecoul,fpair,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* ----------------------------------------------------------------------
|
||||
setup force tables used in compute routines
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairLJCutCoulMSM::init_tables()
|
||||
{
|
||||
int masklo,maskhi;
|
||||
double r,egamma,fgamma,rsw;
|
||||
double qqrd2e = force->qqrd2e;
|
||||
|
||||
tabinnersq = tabinner*tabinner;
|
||||
init_bitmap(tabinner,cut_coul,ncoultablebits,
|
||||
masklo,maskhi,ncoulmask,ncoulshiftbits);
|
||||
|
||||
int ntable = 1;
|
||||
for (int i = 0; i < ncoultablebits; i++) ntable *= 2;
|
||||
|
||||
// linear lookup tables of length N = 2^ncoultablebits
|
||||
// stored value = value at lower edge of bin
|
||||
// d values = delta from lower edge to upper edge of bin
|
||||
|
||||
if (ftable) free_tables();
|
||||
|
||||
memory->create(rtable,ntable,"pair:rtable");
|
||||
memory->create(ftable,ntable,"pair:ftable");
|
||||
memory->create(ctable,ntable,"pair:ctable");
|
||||
memory->create(etable,ntable,"pair:etable");
|
||||
memory->create(drtable,ntable,"pair:drtable");
|
||||
memory->create(dftable,ntable,"pair:dftable");
|
||||
memory->create(dctable,ntable,"pair:dctable");
|
||||
memory->create(detable,ntable,"pair:detable");
|
||||
|
||||
if (cut_respa == NULL) {
|
||||
vtable = ptable = dvtable = dptable = NULL;
|
||||
} else {
|
||||
memory->create(vtable,ntable*sizeof(double),"pair:vtable");
|
||||
memory->create(ptable,ntable*sizeof(double),"pair:ptable");
|
||||
memory->create(dvtable,ntable*sizeof(double),"pair:dvtable");
|
||||
memory->create(dptable,ntable*sizeof(double),"pair:dptable");
|
||||
}
|
||||
|
||||
union_int_float_t rsq_lookup;
|
||||
union_int_float_t minrsq_lookup;
|
||||
int itablemin;
|
||||
minrsq_lookup.i = 0 << ncoulshiftbits;
|
||||
minrsq_lookup.i |= maskhi;
|
||||
|
||||
for (int i = 0; i < ntable; i++) {
|
||||
rsq_lookup.i = i << ncoulshiftbits;
|
||||
rsq_lookup.i |= masklo;
|
||||
if (rsq_lookup.f < tabinnersq) {
|
||||
rsq_lookup.i = i << ncoulshiftbits;
|
||||
rsq_lookup.i |= maskhi;
|
||||
}
|
||||
r = sqrtf(rsq_lookup.f);
|
||||
egamma = 1.0 - (r/cut_coul)*force->kspace->gamma(r/cut_coul);
|
||||
fgamma = 1.0 + (rsq_lookup.f/cut_coulsq)*force->kspace->dgamma(r/cut_coul);
|
||||
|
||||
if (cut_respa == NULL) {
|
||||
rtable[i] = rsq_lookup.f;
|
||||
ftable[i] = qqrd2e/r * fgamma;
|
||||
ctable[i] = qqrd2e/r;
|
||||
etable[i] = qqrd2e/r * egamma;
|
||||
} else {
|
||||
rtable[i] = rsq_lookup.f;
|
||||
ftable[i] = qqrd2e/r * (fgamma - 1.0);
|
||||
ctable[i] = 0.0;
|
||||
etable[i] = qqrd2e/r * egamma;
|
||||
ptable[i] = qqrd2e/r;
|
||||
vtable[i] = qqrd2e/r * fgamma;
|
||||
if (rsq_lookup.f > cut_respa[2]*cut_respa[2]) {
|
||||
if (rsq_lookup.f < cut_respa[3]*cut_respa[3]) {
|
||||
rsw = (r - cut_respa[2])/(cut_respa[3] - cut_respa[2]);
|
||||
ftable[i] += qqrd2e/r * rsw*rsw*(3.0 - 2.0*rsw);
|
||||
ctable[i] = qqrd2e/r * rsw*rsw*(3.0 - 2.0*rsw);
|
||||
} else {
|
||||
ftable[i] = qqrd2e/r * fgamma;
|
||||
ctable[i] = qqrd2e/r;
|
||||
}
|
||||
}
|
||||
}
|
||||
minrsq_lookup.f = MIN(minrsq_lookup.f,rsq_lookup.f);
|
||||
}
|
||||
|
||||
tabinnersq = minrsq_lookup.f;
|
||||
|
||||
int ntablem1 = ntable - 1;
|
||||
|
||||
for (int i = 0; i < ntablem1; i++) {
|
||||
drtable[i] = 1.0/(rtable[i+1] - rtable[i]);
|
||||
dftable[i] = ftable[i+1] - ftable[i];
|
||||
dctable[i] = ctable[i+1] - ctable[i];
|
||||
detable[i] = etable[i+1] - etable[i];
|
||||
}
|
||||
|
||||
if (cut_respa) {
|
||||
for (int i = 0; i < ntablem1; i++) {
|
||||
dvtable[i] = vtable[i+1] - vtable[i];
|
||||
dptable[i] = ptable[i+1] - ptable[i];
|
||||
}
|
||||
}
|
||||
|
||||
// get the delta values for the last table entries
|
||||
// tables are connected periodically between 0 and ntablem1
|
||||
|
||||
drtable[ntablem1] = 1.0/(rtable[0] - rtable[ntablem1]);
|
||||
dftable[ntablem1] = ftable[0] - ftable[ntablem1];
|
||||
dctable[ntablem1] = ctable[0] - ctable[ntablem1];
|
||||
detable[ntablem1] = etable[0] - etable[ntablem1];
|
||||
if (cut_respa) {
|
||||
dvtable[ntablem1] = vtable[0] - vtable[ntablem1];
|
||||
dptable[ntablem1] = ptable[0] - ptable[ntablem1];
|
||||
}
|
||||
|
||||
// get the correct delta values at itablemax
|
||||
// smallest r is in bin itablemin
|
||||
// largest r is in bin itablemax, which is itablemin-1,
|
||||
// or ntablem1 if itablemin=0
|
||||
// deltas at itablemax only needed if corresponding rsq < cut*cut
|
||||
// if so, compute deltas between rsq and cut*cut
|
||||
|
||||
double f_tmp,c_tmp,e_tmp,p_tmp,v_tmp;
|
||||
itablemin = minrsq_lookup.i & ncoulmask;
|
||||
itablemin >>= ncoulshiftbits;
|
||||
int itablemax = itablemin - 1;
|
||||
if (itablemin == 0) itablemax = ntablem1;
|
||||
rsq_lookup.i = itablemax << ncoulshiftbits;
|
||||
rsq_lookup.i |= maskhi;
|
||||
|
||||
if (rsq_lookup.f < cut_coulsq) {
|
||||
rsq_lookup.f = cut_coulsq;
|
||||
r = sqrtf(rsq_lookup.f);
|
||||
egamma = 1.0 - (r/cut_coul)*force->kspace->gamma(r/cut_coul);
|
||||
fgamma = 1.0 + (rsq_lookup.f/cut_coulsq)*force->kspace->dgamma(r/cut_coul);
|
||||
|
||||
if (cut_respa == NULL) {
|
||||
f_tmp = qqrd2e/r * fgamma;
|
||||
c_tmp = qqrd2e/r;
|
||||
e_tmp = qqrd2e/r * egamma;
|
||||
} else {
|
||||
f_tmp = qqrd2e/r * (fgamma - 1.0);
|
||||
c_tmp = 0.0;
|
||||
e_tmp = qqrd2e/r * egamma;
|
||||
p_tmp = qqrd2e/r;
|
||||
v_tmp = qqrd2e/r * fgamma;
|
||||
if (rsq_lookup.f > cut_respa[2]*cut_respa[2]) {
|
||||
if (rsq_lookup.f < cut_respa[3]*cut_respa[3]) {
|
||||
rsw = (r - cut_respa[2])/(cut_respa[3] - cut_respa[2]);
|
||||
f_tmp += qqrd2e/r * rsw*rsw*(3.0 - 2.0*rsw);
|
||||
c_tmp = qqrd2e/r * rsw*rsw*(3.0 - 2.0*rsw);
|
||||
} else {
|
||||
f_tmp = qqrd2e/r * fgamma;
|
||||
c_tmp = qqrd2e/r;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
drtable[itablemax] = 1.0/(rsq_lookup.f - rtable[itablemax]);
|
||||
dftable[itablemax] = f_tmp - ftable[itablemax];
|
||||
dctable[itablemax] = c_tmp - ctable[itablemax];
|
||||
detable[itablemax] = e_tmp - etable[itablemax];
|
||||
if (cut_respa) {
|
||||
dvtable[itablemax] = v_tmp - vtable[itablemax];
|
||||
dptable[itablemax] = p_tmp - ptable[itablemax];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairLJCutCoulMSM::single(int i, int j, int itype, int jtype,
|
||||
double rsq,
|
||||
double factor_coul, double factor_lj,
|
||||
double &fforce)
|
||||
{
|
||||
double r2inv,r6inv,r,egamma,fgamma,prefactor;
|
||||
double fraction,table,forcecoul,forcelj,phicoul,philj;
|
||||
int itable;
|
||||
|
||||
r2inv = 1.0/rsq;
|
||||
if (rsq < cut_coulsq) {
|
||||
if (!ncoultablebits || rsq <= tabinnersq) {
|
||||
r = sqrt(rsq);
|
||||
prefactor = force->qqrd2e * atom->q[i]*atom->q[j]/r;
|
||||
egamma = 1.0 - (r/cut_coul)*force->kspace->gamma(r/cut_coul);
|
||||
fgamma = 1.0 + (rsq/cut_coulsq)*force->kspace->dgamma(r/cut_coul);
|
||||
forcecoul = prefactor * fgamma;
|
||||
if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
} else {
|
||||
union_int_float_t rsq_lookup_single;
|
||||
rsq_lookup_single.f = rsq;
|
||||
itable = rsq_lookup_single.i & ncoulmask;
|
||||
itable >>= ncoulshiftbits;
|
||||
fraction = (rsq_lookup_single.f - rtable[itable]) * drtable[itable];
|
||||
table = ftable[itable] + fraction*dftable[itable];
|
||||
forcecoul = atom->q[i]*atom->q[j] * table;
|
||||
if (factor_coul < 1.0) {
|
||||
table = ctable[itable] + fraction*dctable[itable];
|
||||
prefactor = atom->q[i]*atom->q[j] * table;
|
||||
forcecoul -= (1.0-factor_coul)*prefactor;
|
||||
}
|
||||
}
|
||||
} else forcecoul = 0.0;
|
||||
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
} else forcelj = 0.0;
|
||||
|
||||
fforce = (forcecoul + factor_lj*forcelj) * r2inv;
|
||||
|
||||
double eng = 0.0;
|
||||
if (rsq < cut_coulsq) {
|
||||
if (!ncoultablebits || rsq <= tabinnersq)
|
||||
phicoul = prefactor*egamma;
|
||||
else {
|
||||
table = etable[itable] + fraction*detable[itable];
|
||||
phicoul = atom->q[i]*atom->q[j] * table;
|
||||
}
|
||||
if (factor_coul < 1.0) phicoul -= (1.0-factor_coul)*prefactor;
|
||||
eng += phicoul;
|
||||
}
|
||||
|
||||
if (rsq < cut_ljsq[itype][jtype]) {
|
||||
philj = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]) -
|
||||
offset[itype][jtype];
|
||||
eng += factor_lj*philj;
|
||||
}
|
||||
|
||||
return eng;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void *PairLJCutCoulMSM::extract(const char *str, int &dim)
|
||||
{
|
||||
dim = 0;
|
||||
if (strcmp(str,"cut_msm") == 0) return (void *) &cut_coul;
|
||||
dim = 2;
|
||||
if (strcmp(str,"epsilon") == 0) return (void *) epsilon;
|
||||
return NULL;
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
/* ----------------------------------------------------------------------
|
||||
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 PAIR_CLASS
|
||||
|
||||
PairStyle(lj/cut/coul/msm,PairLJCutCoulMSM)
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_PAIR_LJ_CUT_COUL_MSM_H
|
||||
#define LMP_PAIR_LJ_CUT_COUL_MSM_H
|
||||
|
||||
#include "pair_lj_cut_coul_long.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class PairLJCutCoulMSM : public PairLJCutCoulLong {
|
||||
public:
|
||||
PairLJCutCoulMSM(class LAMMPS *);
|
||||
virtual ~PairLJCutCoulMSM(){};
|
||||
virtual void compute(int, int);
|
||||
virtual double single(int, int, int, int, double, double, double, double &);
|
||||
virtual void compute_outer(int, int);
|
||||
virtual void *extract(const char *, int &);
|
||||
|
||||
protected:
|
||||
virtual void init_tables();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Illegal ... command
|
||||
|
||||
Self-explanatory. Check the input script syntax and compare to the
|
||||
documentation for the command. You can use -echo screen as a
|
||||
command-line option when running LAMMPS to see the offending line.
|
||||
|
||||
E: Incorrect args for pair coefficients
|
||||
|
||||
Self-explanatory. Check the input script or data file.
|
||||
|
||||
E: Pair style lj/cut/coul/msm requires atom attribute q
|
||||
|
||||
The atom style defined does not have this attribute.
|
||||
|
||||
E: Pair style is incompatible with KSpace style
|
||||
|
||||
If a pair style with a long-range Coulombic component is selected,
|
||||
then a kspace style must also be used.
|
||||
|
||||
E: Pair cutoff < Respa interior cutoff
|
||||
|
||||
One or more pairwise cutoffs are too short to use with the specified
|
||||
rRESPA cutoffs.
|
||||
|
||||
*/
|
Loading…
Reference in New Issue