From 4f2bdac177d61bd55c51d9f4acf05f01bd25d321 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Mon, 14 Jan 2013 15:59:49 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@9271 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/ASPHERE/compute_erotate_asphere.cpp | 10 +++++----- src/ASPHERE/compute_temp_asphere.cpp | 11 ++++++----- src/ASPHERE/fix_nh_asphere.cpp | 7 ++++--- src/ASPHERE/fix_nve_asphere.cpp | 7 ++++--- src/ASPHERE/fix_nve_asphere_noforce.cpp | 12 ++++++------ src/ASPHERE/fix_nve_line.cpp | 10 +++++----- src/ASPHERE/fix_nve_tri.cpp | 10 +++++----- src/ASPHERE/pair_gayberne.cpp | 6 +++--- src/ASPHERE/pair_line_lj.cpp | 15 ++++++++++++--- src/ASPHERE/pair_line_lj.h | 1 + src/ASPHERE/pair_resquared.cpp | 6 +++--- src/ASPHERE/pair_tri_lj.cpp | 15 ++++++++++++--- src/ASPHERE/pair_tri_lj.h | 1 + 13 files changed, 67 insertions(+), 44 deletions(-) diff --git a/src/ASPHERE/compute_erotate_asphere.cpp b/src/ASPHERE/compute_erotate_asphere.cpp index 5a85385675..5b9612ee1e 100644 --- a/src/ASPHERE/compute_erotate_asphere.cpp +++ b/src/ASPHERE/compute_erotate_asphere.cpp @@ -35,7 +35,12 @@ ComputeERotateAsphere(LAMMPS *lmp, int narg, char **arg) : scalar_flag = 1; extscalar = 1; +} +/* ---------------------------------------------------------------------- */ + +void ComputeERotateAsphere::init() +{ // error check avec_ellipsoid = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); @@ -44,12 +49,7 @@ ComputeERotateAsphere(LAMMPS *lmp, int narg, char **arg) : if (!avec_ellipsoid && !avec_line && !avec_tri) error->all(FLERR,"Compute erotate/asphere requires " "atom style ellipsoid or line or tri"); -} -/* ---------------------------------------------------------------------- */ - -void ComputeERotateAsphere::init() -{ // check that all particles are finite-size // no point particles allowed, spherical is OK diff --git a/src/ASPHERE/compute_temp_asphere.cpp b/src/ASPHERE/compute_temp_asphere.cpp index 1df8fef867..26e625ee69 100755 --- a/src/ASPHERE/compute_temp_asphere.cpp +++ b/src/ASPHERE/compute_temp_asphere.cpp @@ -73,11 +73,6 @@ ComputeTempAsphere::ComputeTempAsphere(LAMMPS *lmp, int narg, char **arg) : vector = new double[6]; - // error check - - avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); - if (!avec) - error->all(FLERR,"Compute temp/asphere requires atom style ellipsoid"); } /* ---------------------------------------------------------------------- */ @@ -92,6 +87,12 @@ ComputeTempAsphere::~ComputeTempAsphere() void ComputeTempAsphere::init() { + // error check + + avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); + if (!avec) + error->all(FLERR,"Compute temp/asphere requires atom style ellipsoid"); + // check that all particles are finite-size, no point particles allowed int *ellipsoid = atom->ellipsoid; diff --git a/src/ASPHERE/fix_nh_asphere.cpp b/src/ASPHERE/fix_nh_asphere.cpp index 476d4a6e5c..dba5806fcd 100644 --- a/src/ASPHERE/fix_nh_asphere.cpp +++ b/src/ASPHERE/fix_nh_asphere.cpp @@ -34,15 +34,16 @@ using namespace FixConst; FixNHAsphere::FixNHAsphere(LAMMPS *lmp, int narg, char **arg) : FixNH(lmp, narg, arg) { - avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); - if (!avec) - error->all(FLERR,"Compute nvt/nph/npt asphere requires atom style ellipsoid"); } /* ---------------------------------------------------------------------- */ void FixNHAsphere::init() { + avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); + if (!avec) + error->all(FLERR,"Compute nvt/nph/npt asphere requires atom style ellipsoid"); + // check that all particles are finite-size // no point particles allowed, spherical is OK diff --git a/src/ASPHERE/fix_nve_asphere.cpp b/src/ASPHERE/fix_nve_asphere.cpp index 1590e1f20e..f14f33c138 100755 --- a/src/ASPHERE/fix_nve_asphere.cpp +++ b/src/ASPHERE/fix_nve_asphere.cpp @@ -37,15 +37,16 @@ using namespace FixConst; FixNVEAsphere::FixNVEAsphere(LAMMPS *lmp, int narg, char **arg) : FixNVE(lmp, narg, arg) { - avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); - if (!avec) - error->all(FLERR,"Compute nve/asphere requires atom style ellipsoid"); } /* ---------------------------------------------------------------------- */ void FixNVEAsphere::init() { + avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); + if (!avec) + error->all(FLERR,"Compute nve/asphere requires atom style ellipsoid"); + // check that all particles are finite-size ellipsoids // no point particles allowed, spherical is OK diff --git a/src/ASPHERE/fix_nve_asphere_noforce.cpp b/src/ASPHERE/fix_nve_asphere_noforce.cpp index 8ce195f120..2b93fb5a7b 100644 --- a/src/ASPHERE/fix_nve_asphere_noforce.cpp +++ b/src/ASPHERE/fix_nve_asphere_noforce.cpp @@ -34,18 +34,18 @@ FixNVEAsphereNoforce::FixNVEAsphereNoforce(LAMMPS *lmp, int narg, char **arg) : if (narg != 3) error->all(FLERR,"Illegal fix nve/asphere/noforce command"); time_integrate = 1; - - // error check - - avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); - if (!atom->ellipsoid_flag) - error->all(FLERR,"Fix nve/asphere/noforce requires atom style ellipsoid"); } /* ---------------------------------------------------------------------- */ void FixNVEAsphereNoforce::init() { + // error check + + avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); + if (!atom->ellipsoid_flag) + error->all(FLERR,"Fix nve/asphere/noforce requires atom style ellipsoid"); + FixNVENoforce::init(); dtq = 0.5 * dtv; diff --git a/src/ASPHERE/fix_nve_line.cpp b/src/ASPHERE/fix_nve_line.cpp index 1350713acf..1fd9b545a5 100644 --- a/src/ASPHERE/fix_nve_line.cpp +++ b/src/ASPHERE/fix_nve_line.cpp @@ -38,11 +38,6 @@ FixNVELine::FixNVELine(LAMMPS *lmp, int narg, char **arg) : MINUSPI = -MY_PI; TWOPI = 2.0*MY_PI; - - // error checks - - avec = (AtomVecLine *) atom->style_match("line"); - if (!avec) error->all(FLERR,"Fix nve/line requires atom style line"); } /* ---------------------------------------------------------------------- */ @@ -63,6 +58,11 @@ void FixNVELine::init() { int i,itype; + // error checks + + avec = (AtomVecLine *) atom->style_match("line"); + if (!avec) error->all(FLERR,"Fix nve/line requires atom style line"); + if (domain->dimension != 2) error->all(FLERR,"Fix nve/line can only be used for 2d simulations"); diff --git a/src/ASPHERE/fix_nve_tri.cpp b/src/ASPHERE/fix_nve_tri.cpp index eb90127346..a572013f49 100644 --- a/src/ASPHERE/fix_nve_tri.cpp +++ b/src/ASPHERE/fix_nve_tri.cpp @@ -32,11 +32,6 @@ FixNVETri::FixNVETri(LAMMPS *lmp, int narg, char **arg) : if (narg != 3) error->all(FLERR,"Illegal fix nve/tri command"); time_integrate = 1; - - // error checks - - avec = (AtomVecTri *) atom->style_match("tri"); - if (!avec) error->all(FLERR,"Fix nve/tri requires atom style tri"); } /* ---------------------------------------------------------------------- */ @@ -57,6 +52,11 @@ void FixNVETri::init() { int i,itype; + // error checks + + avec = (AtomVecTri *) atom->style_match("tri"); + if (!avec) error->all(FLERR,"Fix nve/tri requires atom style tri"); + if (domain->dimension != 3) error->all(FLERR,"Fix nve/tri can only be used for 3d simulations"); diff --git a/src/ASPHERE/pair_gayberne.cpp b/src/ASPHERE/pair_gayberne.cpp index 2793c31e51..4aa0436109 100755 --- a/src/ASPHERE/pair_gayberne.cpp +++ b/src/ASPHERE/pair_gayberne.cpp @@ -37,9 +37,6 @@ using namespace LAMMPS_NS; PairGayBerne::PairGayBerne(LAMMPS *lmp) : Pair(lmp) { - avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); - if (!avec) error->all(FLERR,"Pair gayberne requires atom style ellipsoid"); - single_enable = 0; } @@ -335,6 +332,9 @@ void PairGayBerne::coeff(int narg, char **arg) void PairGayBerne::init_style() { + avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); + if (!avec) error->all(FLERR,"Pair gayberne requires atom style ellipsoid"); + neighbor->request(this); // per-type shape precalculations diff --git a/src/ASPHERE/pair_line_lj.cpp b/src/ASPHERE/pair_line_lj.cpp index 2088ca20f2..37f68d8c7f 100644 --- a/src/ASPHERE/pair_line_lj.cpp +++ b/src/ASPHERE/pair_line_lj.cpp @@ -32,9 +32,6 @@ using namespace LAMMPS_NS; PairLineLJ::PairLineLJ(LAMMPS *lmp) : Pair(lmp) { - avec = (AtomVecLine *) atom->style_match("line"); - if (!avec) error->all(FLERR,"Pair line/lj requires atom style line"); - dmax = nmax = 0; discrete = NULL; dnum = dfirst = NULL; @@ -384,6 +381,18 @@ void PairLineLJ::coeff(int narg, char **arg) if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); } +/* ---------------------------------------------------------------------- + init specific to this pair style +------------------------------------------------------------------------- */ + +void PairLineLJ::init_style() +{ + avec = (AtomVecLine *) atom->style_match("line"); + if (!avec) error->all(FLERR,"Pair line/lj requires atom style line"); + + neighbor->request(this); +} + /* ---------------------------------------------------------------------- init for one type pair i,j and corresponding j,i ------------------------------------------------------------------------- */ diff --git a/src/ASPHERE/pair_line_lj.h b/src/ASPHERE/pair_line_lj.h index 8a802ad295..8d286447dc 100644 --- a/src/ASPHERE/pair_line_lj.h +++ b/src/ASPHERE/pair_line_lj.h @@ -31,6 +31,7 @@ class PairLineLJ : public Pair { virtual void compute(int, int); void settings(int, char **); void coeff(int, char **); + virtual void init_style(); double init_one(int, int); protected: diff --git a/src/ASPHERE/pair_resquared.cpp b/src/ASPHERE/pair_resquared.cpp index b8e0701635..22881d35e5 100755 --- a/src/ASPHERE/pair_resquared.cpp +++ b/src/ASPHERE/pair_resquared.cpp @@ -39,9 +39,6 @@ PairRESquared::PairRESquared(LAMMPS *lmp) : Pair(lmp), b_alpha(45.0/56.0), cr60(pow(60.0,1.0/3.0)) { - avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); - if (!avec) error->all(FLERR,"Pair resquared requires atom style ellipsoid"); - single_enable = 0; cr60 = pow(60.0,1.0/3.0); @@ -321,6 +318,9 @@ void PairRESquared::coeff(int narg, char **arg) void PairRESquared::init_style() { + avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); + if (!avec) error->all(FLERR,"Pair resquared requires atom style ellipsoid"); + neighbor->request(this); // per-type shape precalculations diff --git a/src/ASPHERE/pair_tri_lj.cpp b/src/ASPHERE/pair_tri_lj.cpp index ec0a07abee..55ef3c9c8b 100644 --- a/src/ASPHERE/pair_tri_lj.cpp +++ b/src/ASPHERE/pair_tri_lj.cpp @@ -33,9 +33,6 @@ using namespace LAMMPS_NS; PairTriLJ::PairTriLJ(LAMMPS *lmp) : Pair(lmp) { - avec = (AtomVecTri *) atom->style_match("tri"); - if (!avec) error->all(FLERR,"Pair tri/lj requires atom style tri"); - dmax = nmax = 0; discrete = NULL; dnum = dfirst = NULL; @@ -468,6 +465,18 @@ void PairTriLJ::coeff(int narg, char **arg) if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); } +/* ---------------------------------------------------------------------- + init specific to this pair style +------------------------------------------------------------------------- */ + +void PairTriLJ::init_style() +{ + avec = (AtomVecTri *) atom->style_match("tri"); + if (!avec) error->all(FLERR,"Pair tri/lj requires atom style tri"); + + neighbor->request(this); +} + /* ---------------------------------------------------------------------- init for one type pair i,j and corresponding j,i ------------------------------------------------------------------------- */ diff --git a/src/ASPHERE/pair_tri_lj.h b/src/ASPHERE/pair_tri_lj.h index f37903055b..f5e33359b4 100644 --- a/src/ASPHERE/pair_tri_lj.h +++ b/src/ASPHERE/pair_tri_lj.h @@ -31,6 +31,7 @@ class PairTriLJ : public Pair { virtual void compute(int, int); void settings(int, char **); void coeff(int, char **); + virtual void init_style(); double init_one(int, int); protected: