From a15113ed1f4f35d02b36303bcbeb062df36ceddc Mon Sep 17 00:00:00 2001 From: sjplimp Date: Fri, 8 Feb 2008 19:47:58 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@1470 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/ASPHERE/fix_npt_asphere.cpp | 6 ++++-- src/ASPHERE/fix_nve_asphere.cpp | 6 ++++-- src/ASPHERE/fix_nvt_asphere.cpp | 6 ++++-- src/DIPOLE/fix_nve_dipole.cpp | 3 ++- src/DPD/atom_vec_dpd.cpp | 1 + src/DPD/pair_dpd.cpp | 10 ++++------ src/GRANULAR/atom_vec_granular.cpp | 1 + src/GRANULAR/pair_gran_history.cpp | 3 +++ src/MOLECULE/dihedral_charmm.cpp | 1 - src/atom_vec.cpp | 1 + src/atom_vec.h | 2 ++ src/atom_vec_hybrid.cpp | 2 ++ src/pair_lj_cut.cpp | 8 ++++++++ src/pair_lj_cut.h | 1 + 14 files changed, 37 insertions(+), 14 deletions(-) diff --git a/src/ASPHERE/fix_npt_asphere.cpp b/src/ASPHERE/fix_npt_asphere.cpp index 4c1403f83d..16cc8b7071 100755 --- a/src/ASPHERE/fix_npt_asphere.cpp +++ b/src/ASPHERE/fix_npt_asphere.cpp @@ -21,6 +21,7 @@ #include "fix_npt_asphere.h" #include "math_extra.h" #include "atom.h" +#include "atom_vec.h" #include "force.h" #include "compute.h" #include "kspace.h" @@ -34,9 +35,10 @@ using namespace LAMMPS_NS; FixNPTASphere::FixNPTASphere(LAMMPS *lmp, int narg, char **arg) : FixNPT(lmp, narg, arg) { - if (!atom->quat_flag || !atom->angmom_flag || !atom->torque_flag) + if (!atom->quat_flag || !atom->angmom_flag || !atom->torque_flag || + !atom->avec->shape_type) error->all("Fix npt/asphere requires atom attributes " - "quat, angmom, torque"); + "quat, angmom, torque, shape"); } /* ---------------------------------------------------------------------- diff --git a/src/ASPHERE/fix_nve_asphere.cpp b/src/ASPHERE/fix_nve_asphere.cpp index 722a8d0838..19c1b6f681 100755 --- a/src/ASPHERE/fix_nve_asphere.cpp +++ b/src/ASPHERE/fix_nve_asphere.cpp @@ -21,6 +21,7 @@ #include "fix_nve_asphere.h" #include "math_extra.h" #include "atom.h" +#include "atom_vec.h" #include "force.h" #include "update.h" #include "memory.h" @@ -36,9 +37,10 @@ using namespace LAMMPS_NS; FixNVEASphere::FixNVEASphere(LAMMPS *lmp, int narg, char **arg) : FixNVE(lmp, narg, arg) { - if (!atom->quat_flag || !atom->angmom_flag || !atom->torque_flag) + if (!atom->quat_flag || !atom->angmom_flag || !atom->torque_flag || + !atom->avec->shape_type) error->all("Fix nve/asphere requires atom attributes " - "quat, angmom, torque"); + "quat, angmom, torque, shape"); inertia = memory->create_2d_double_array(atom->ntypes+1,3,"fix_temp_sphere:inertia"); } diff --git a/src/ASPHERE/fix_nvt_asphere.cpp b/src/ASPHERE/fix_nvt_asphere.cpp index 5fec36e1fe..f4a9bb2b8f 100755 --- a/src/ASPHERE/fix_nvt_asphere.cpp +++ b/src/ASPHERE/fix_nvt_asphere.cpp @@ -21,6 +21,7 @@ #include "fix_nvt_asphere.h" #include "math_extra.h" #include "atom.h" +#include "atom_vec.h" #include "force.h" #include "comm.h" #include "group.h" @@ -36,9 +37,10 @@ using namespace LAMMPS_NS; FixNVTASphere::FixNVTASphere(LAMMPS *lmp, int narg, char **arg) : FixNVT(lmp, narg, arg) { - if (!atom->quat_flag || !atom->angmom_flag || !atom->torque_flag) + if (!atom->quat_flag || !atom->angmom_flag || !atom->torque_flag || + !atom->avec->shape_type) error->all("Fix nvt/asphere requires atom attributes " - "quat, angmom, torque"); + "quat, angmom, torque, shape"); } /* ---------------------------------------------------------------------- */ diff --git a/src/DIPOLE/fix_nve_dipole.cpp b/src/DIPOLE/fix_nve_dipole.cpp index 8cbccf9541..f9b847aaed 100644 --- a/src/DIPOLE/fix_nve_dipole.cpp +++ b/src/DIPOLE/fix_nve_dipole.cpp @@ -15,6 +15,7 @@ #include "string.h" #include "fix_nve_dipole.h" #include "atom.h" +#include "atom_vec.h" #include "force.h" #include "update.h" #include "respa.h" @@ -33,7 +34,7 @@ FixNVEDipole::FixNVEDipole(LAMMPS *lmp, int narg, char **arg) : { if (narg != 3) error->all("Illegal fix nve/dipole command"); if (!atom->mu_flag || !atom->omega_flag || - !atom->torque_flag || atom->shape == NULL) + !atom->torque_flag || !atom->avec->shape_type) error->all("Fix nve/dipole requires atom attributes " "mu, omega, torque, shape"); inertia = new double[atom->ntypes+1]; diff --git a/src/DPD/atom_vec_dpd.cpp b/src/DPD/atom_vec_dpd.cpp index 040e2e375a..ac82a4bd54 100644 --- a/src/DPD/atom_vec_dpd.cpp +++ b/src/DPD/atom_vec_dpd.cpp @@ -31,6 +31,7 @@ AtomVecDPD::AtomVecDPD(LAMMPS *lmp, int narg, char **arg) : { mass_type = 1; comm_x_only = 0; + ghost_velocity = 1; size_comm = 6; size_reverse = 3; size_border = 9; diff --git a/src/DPD/pair_dpd.cpp b/src/DPD/pair_dpd.cpp index 8548fa4dc1..4ca95610b7 100644 --- a/src/DPD/pair_dpd.cpp +++ b/src/DPD/pair_dpd.cpp @@ -20,6 +20,7 @@ #include "stdlib.h" #include "pair_dpd.h" #include "atom.h" +#include "atom_vec.h" #include "comm.h" #include "update.h" #include "force.h" @@ -250,17 +251,14 @@ void PairDPD::coeff(int narg, char **arg) void PairDPD::init_style() { - // check that atom style is dpd or hybrid with dpd - // else compute() will not have ghost atom velocities - - if (atom->style_match("dpd") == 0) - error->all("Pair style dpd requires atom style dpd"); + if (atom->avec->ghost_velocity == 0) + error->all("Pair dpd requires ghost atoms store velocity"); // if newton off, forces between atoms ij will be double computed // using different random numbers if (force->newton_pair == 0 && comm->me == 0) error->warning( - "Pair style dpd needs newton pair on for momentum conservation"); + "Pair dpd needs newton pair on for momentum conservation"); int irequest = neighbor->request(this); } diff --git a/src/GRANULAR/atom_vec_granular.cpp b/src/GRANULAR/atom_vec_granular.cpp index 070a44d1fc..a5e523576b 100644 --- a/src/GRANULAR/atom_vec_granular.cpp +++ b/src/GRANULAR/atom_vec_granular.cpp @@ -32,6 +32,7 @@ AtomVecGranular::AtomVecGranular(LAMMPS *lmp, int narg, char **arg) : AtomVec(lmp, narg, arg) { comm_x_only = comm_f_only = 0; + ghost_velocity = 1; size_comm = 9; size_reverse = 6; size_border = 14; diff --git a/src/GRANULAR/pair_gran_history.cpp b/src/GRANULAR/pair_gran_history.cpp index e769c1ac60..c46e8c409f 100644 --- a/src/GRANULAR/pair_gran_history.cpp +++ b/src/GRANULAR/pair_gran_history.cpp @@ -21,6 +21,7 @@ #include "string.h" #include "pair_gran_history.h" #include "atom.h" +#include "atom_vec.h" #include "domain.h" #include "force.h" #include "update.h" @@ -326,6 +327,8 @@ void PairGranHistory::init_style() if (!atom->radius_flag || !atom->omega_flag || !atom->torque_flag) error->all("Pair granular requires atom attributes radius, omega, torque"); + if (atom->avec->ghost_velocity == 0) + error->all("Pair granular requires ghost atoms store velocity"); // need a half neigh list and optionally a granular history neigh list diff --git a/src/MOLECULE/dihedral_charmm.cpp b/src/MOLECULE/dihedral_charmm.cpp index b1aaf73c77..0efd658e09 100644 --- a/src/MOLECULE/dihedral_charmm.cpp +++ b/src/MOLECULE/dihedral_charmm.cpp @@ -32,7 +32,6 @@ using namespace LAMMPS_NS; #define TOLERANCE 0.05 -#define SMALL 0.001 /* ---------------------------------------------------------------------- */ diff --git a/src/atom_vec.cpp b/src/atom_vec.cpp index 7da3e3c7c7..6d919f3901 100644 --- a/src/atom_vec.cpp +++ b/src/atom_vec.cpp @@ -26,6 +26,7 @@ AtomVec::AtomVec(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) bonds_allow = angles_allow = dihedrals_allow = impropers_allow = 0; mass_type = shape_type = dipole_type = 0; comm_x_only = comm_f_only = 1; + ghost_velocity = 0; size_comm = size_reverse = size_border = 0; } diff --git a/src/atom_vec.h b/src/atom_vec.h index 6556e6c317..ae5c29142e 100644 --- a/src/atom_vec.h +++ b/src/atom_vec.h @@ -28,6 +28,8 @@ class AtomVec : protected Pointers { int dipole_type; // 1 if per-type dipole moments int comm_x_only; // 1 if only exchange x in forward comm int comm_f_only; // 1 if only exchange f in reverse comm + int ghost_velocity; // 1 if ghost atoms store velocity + int size_comm; // # of values per atom in comm int size_reverse; // # in reverse comm int size_border; // # in border comm diff --git a/src/atom_vec_hybrid.cpp b/src/atom_vec_hybrid.cpp index bf911c5aca..8a371c6aa3 100644 --- a/src/atom_vec_hybrid.cpp +++ b/src/atom_vec_hybrid.cpp @@ -75,6 +75,8 @@ AtomVecHybrid::AtomVecHybrid(LAMMPS *lmp, int narg, char **arg) : dipole_type = MAX(dipole_type,styles[k]->dipole_type); comm_x_only = MIN(comm_x_only,styles[k]->comm_x_only); comm_f_only = MIN(comm_f_only,styles[k]->comm_f_only); + ghost_velocity = MAX(ghost_velocity,styles[k]->ghost_velocity); + size_comm += styles[k]->size_comm - 3; size_reverse += styles[k]->size_reverse - 3; size_border += styles[k]->size_border - 6; diff --git a/src/pair_lj_cut.cpp b/src/pair_lj_cut.cpp index 403cb1a1c1..6ab2b0bbe6 100644 --- a/src/pair_lj_cut.cpp +++ b/src/pair_lj_cut.cpp @@ -712,3 +712,11 @@ double PairLJCut::single(int i, int j, int itype, int jtype, double rsq, offset[itype][jtype]; return factor_lj*philj; } + +/* ---------------------------------------------------------------------- */ + +void *PairLJCut::extract(char *str) +{ + if (strcmp(str,"sigma") == 0) return (void *) sigma; + return NULL; +} diff --git a/src/pair_lj_cut.h b/src/pair_lj_cut.h index ab6f7d0ceb..715e9f194c 100644 --- a/src/pair_lj_cut.h +++ b/src/pair_lj_cut.h @@ -37,6 +37,7 @@ class PairLJCut : public Pair { void compute_inner(); void compute_middle(); void compute_outer(int, int); + void *extract(char *); protected: double cut_global;