From ff535daa9fb6ba27e80613df7387c2cd03a96399 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Thu, 21 Jun 2007 18:58:43 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@638 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/ASPHERE/atom_vec_ellipsoid.cpp | 2 ++ src/ASPHERE/compute_temp_asphere.cpp | 2 +- src/ASPHERE/fix_npt_asphere.cpp | 2 +- src/ASPHERE/fix_nve_asphere.cpp | 2 +- src/ASPHERE/fix_nvt_asphere.cpp | 2 +- src/ASPHERE/pair_gayberne.cpp | 2 +- src/CLASS2/pair_lj_class2_coul_cut.cpp | 2 +- src/CLASS2/pair_lj_class2_coul_long.cpp | 2 +- src/DIPOLE/atom_vec_dipole.cpp | 2 ++ src/DIPOLE/compute_temp_dipole.cpp | 2 +- src/DIPOLE/fix_nve_dipole.cpp | 4 ++-- src/DIPOLE/pair_dipole_cut.cpp | 4 ++-- src/GRANULAR/atom_vec_granular.cpp | 3 +++ src/GRANULAR/fix_freeze.cpp | 2 +- src/GRANULAR/fix_gran_diag.cpp | 2 +- src/GRANULAR/fix_nve_gran.cpp | 2 +- src/GRANULAR/fix_pour.cpp | 4 +--- src/GRANULAR/fix_wall_gran.cpp | 2 +- src/GRANULAR/pair_gran_history.cpp | 2 +- src/KSPACE/ewald.cpp | 3 +-- src/KSPACE/pair_buck_coul_long.cpp | 2 +- src/KSPACE/pair_lj_charmm_coul_long.cpp | 2 +- src/KSPACE/pair_lj_cut_coul_long.cpp | 2 +- src/KSPACE/pair_lj_cut_coul_long_tip4p.cpp | 2 +- src/KSPACE/pppm.cpp | 3 +-- src/MAKE/Makefile.g++_meam | 2 +- src/MOLECULE/atom_vec_angle.cpp | 2 ++ src/MOLECULE/atom_vec_bond.cpp | 2 ++ src/MOLECULE/atom_vec_full.cpp | 2 ++ src/MOLECULE/atom_vec_molecular.cpp | 2 ++ src/MOLECULE/pair_lj_charmm_coul_charmm.cpp | 2 +- src/POEMS/fix_poems.cpp | 8 +------- src/atom.cpp | 10 +++++++++- src/atom.h | 8 ++++++++ src/atom_vec_charge.cpp | 2 ++ src/compute_rotate_dipole.cpp | 2 +- src/compute_rotate_gran.cpp | 2 +- src/compute_temp_deform.cpp | 6 +++--- src/fix_deform.cpp | 2 +- src/fix_nvt_sllod.cpp | 6 +++--- src/fix_rigid.cpp | 2 +- src/pair_buck_coul_cut.cpp | 2 +- src/pair_lj_cut_coul_cut.cpp | 2 +- src/variable.cpp | 2 +- src/verlet.cpp | 2 +- src/write_restart.cpp | 7 +++++-- 46 files changed, 80 insertions(+), 54 deletions(-) diff --git a/src/ASPHERE/atom_vec_ellipsoid.cpp b/src/ASPHERE/atom_vec_ellipsoid.cpp index e85b699dec..2f8c868eed 100755 --- a/src/ASPHERE/atom_vec_ellipsoid.cpp +++ b/src/ASPHERE/atom_vec_ellipsoid.cpp @@ -44,6 +44,8 @@ AtomVecEllipsoid::AtomVecEllipsoid(LAMMPS *lmp, int narg, char **arg) : size_data_atom = 9; size_data_vel = 7; xcol_data = 3; + + atom->angmom_flag = atom->torque_flag = atom->quat_flag = 1; } /* ---------------------------------------------------------------------- */ diff --git a/src/ASPHERE/compute_temp_asphere.cpp b/src/ASPHERE/compute_temp_asphere.cpp index d22c1cda3e..6604435487 100755 --- a/src/ASPHERE/compute_temp_asphere.cpp +++ b/src/ASPHERE/compute_temp_asphere.cpp @@ -35,7 +35,7 @@ ComputeTempAsphere::ComputeTempAsphere(LAMMPS *lmp, int narg, char **arg) : { if (narg != 3) error->all("Illegal compute temp command"); - if (atom->quat == NULL || atom->angmom == NULL) + if (!atom->quat_flag || !atom->angmom_flag) error->all("Compute temp/asphere requires atom attributes quat, angmom"); scalar_flag = vector_flag = 1; diff --git a/src/ASPHERE/fix_npt_asphere.cpp b/src/ASPHERE/fix_npt_asphere.cpp index 419ad03c32..b47c9d3d95 100755 --- a/src/ASPHERE/fix_npt_asphere.cpp +++ b/src/ASPHERE/fix_npt_asphere.cpp @@ -34,7 +34,7 @@ using namespace LAMMPS_NS; FixNPTASphere::FixNPTASphere(LAMMPS *lmp, int narg, char **arg) : FixNPT(lmp, narg, arg) { - if (atom->quat == NULL || atom->angmom == NULL || atom->torque == NULL) + if (!atom->quat_flag || !atom->angmom_flag || !atom->torque_flag) error->all("Fix npt/asphere requires atom attributes " "quat, angmom, torque"); } diff --git a/src/ASPHERE/fix_nve_asphere.cpp b/src/ASPHERE/fix_nve_asphere.cpp index 17fdb23f02..07b7389b24 100755 --- a/src/ASPHERE/fix_nve_asphere.cpp +++ b/src/ASPHERE/fix_nve_asphere.cpp @@ -37,7 +37,7 @@ FixNVEASphere::FixNVEASphere(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { if (narg < 3) error->all("Illegal fix nve/asphere command"); - if (atom->quat == NULL || atom->angmom == NULL || atom->torque == NULL) + if (!atom->quat_flag || !atom->angmom_flag || !atom->torque_flag) error->all("Fix nve/asphere requires atom attributes " "quat, angmom, torque"); inertia = diff --git a/src/ASPHERE/fix_nvt_asphere.cpp b/src/ASPHERE/fix_nvt_asphere.cpp index df2e8b3bc3..8d65a83264 100755 --- a/src/ASPHERE/fix_nvt_asphere.cpp +++ b/src/ASPHERE/fix_nvt_asphere.cpp @@ -36,7 +36,7 @@ using namespace LAMMPS_NS; FixNVTASphere::FixNVTASphere(LAMMPS *lmp, int narg, char **arg) : FixNVT(lmp, narg, arg) { - if (atom->quat == NULL || atom->angmom == NULL || atom->torque == NULL) + if (!atom->quat_flag || !atom->angmom_flag || !atom->torque_flag) error->all("Fix nvt/asphere requires atom attributes " "quat, angmom, torque"); } diff --git a/src/ASPHERE/pair_gayberne.cpp b/src/ASPHERE/pair_gayberne.cpp index 0d42ae3469..c280f9481d 100755 --- a/src/ASPHERE/pair_gayberne.cpp +++ b/src/ASPHERE/pair_gayberne.cpp @@ -375,7 +375,7 @@ double PairGayBerne::init_one(int i, int j) void PairGayBerne::init_style() { - if (atom->quat == NULL || atom->torque == NULL) + if (!atom->quat_flag || !atom->torque_flag) error->all("Pair gayberne requires atom attributes quat, torque"); // per-type shape precalculations diff --git a/src/CLASS2/pair_lj_class2_coul_cut.cpp b/src/CLASS2/pair_lj_class2_coul_cut.cpp index d8783b6af6..0af2410d73 100644 --- a/src/CLASS2/pair_lj_class2_coul_cut.cpp +++ b/src/CLASS2/pair_lj_class2_coul_cut.cpp @@ -327,7 +327,7 @@ double PairLJClass2CoulCut::init_one(int i, int j) void PairLJClass2CoulCut::init_style() { - if (atom->q == NULL) + if (!atom->q_flag) error->all("Pair style lj/class2/coul/cut requires atom attribute q"); } diff --git a/src/CLASS2/pair_lj_class2_coul_long.cpp b/src/CLASS2/pair_lj_class2_coul_long.cpp index 86f2c36ed0..afdfe7dc8e 100644 --- a/src/CLASS2/pair_lj_class2_coul_long.cpp +++ b/src/CLASS2/pair_lj_class2_coul_long.cpp @@ -333,7 +333,7 @@ double PairLJClass2CoulLong::init_one(int i, int j) void PairLJClass2CoulLong::init_style() { - if (atom->q == NULL) + if (!atom->q_flag) error->all("Pair style lj/class2/coul/long requires atom attribute q"); cut_coulsq = cut_coul * cut_coul; diff --git a/src/DIPOLE/atom_vec_dipole.cpp b/src/DIPOLE/atom_vec_dipole.cpp index 2114bff212..7203f2da73 100644 --- a/src/DIPOLE/atom_vec_dipole.cpp +++ b/src/DIPOLE/atom_vec_dipole.cpp @@ -39,6 +39,8 @@ AtomVecDipole::AtomVecDipole(LAMMPS *lmp, int narg, char **arg) : size_data_atom = 9; size_data_vel = 7; xcol_data = 4; + + atom->q_flag = atom->mu_flag = atom->omega_flag = atom->torque_flag = 1; } /* ---------------------------------------------------------------------- diff --git a/src/DIPOLE/compute_temp_dipole.cpp b/src/DIPOLE/compute_temp_dipole.cpp index abb5d54bd1..b0ed8c267e 100644 --- a/src/DIPOLE/compute_temp_dipole.cpp +++ b/src/DIPOLE/compute_temp_dipole.cpp @@ -33,7 +33,7 @@ ComputeTempDipole::ComputeTempDipole(LAMMPS *lmp, int narg, char **arg) : { if (narg != 3) error->all("Illegal compute temp/dipole command"); - if (atom->omega == NULL || atom->shape == NULL) + if (!atom->omega_flag || atom->shape == NULL) error->all("Compute temp/dipole requires atom attributes omega, shape"); scalar_flag = vector_flag = 1; diff --git a/src/DIPOLE/fix_nve_dipole.cpp b/src/DIPOLE/fix_nve_dipole.cpp index d056d324b6..6b59303b53 100644 --- a/src/DIPOLE/fix_nve_dipole.cpp +++ b/src/DIPOLE/fix_nve_dipole.cpp @@ -32,8 +32,8 @@ FixNVEDipole::FixNVEDipole(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { if (narg != 3) error->all("Illegal fix nve/dipole command"); - if (atom->mu == NULL || atom->omega == NULL || - atom->torque == NULL || atom->shape == NULL) + if (!atom->mu_flag || !atom->omega_flag || + !atom->torque_flag || atom->shape == NULL) error->all("Fix nve/dipole requires atom attributes " "mu, omega, torque, shape"); inertia = new double[atom->ntypes+1]; diff --git a/src/DIPOLE/pair_dipole_cut.cpp b/src/DIPOLE/pair_dipole_cut.cpp index 28b470f24a..6b7a7a81ed 100644 --- a/src/DIPOLE/pair_dipole_cut.cpp +++ b/src/DIPOLE/pair_dipole_cut.cpp @@ -406,8 +406,8 @@ double PairDipoleCut::init_one(int i, int j) void PairDipoleCut::init_style() { - if (atom->q == NULL || atom->mu == NULL || - atom->torque == NULL || atom->dipole == NULL) + if (!atom->q_flag || !atom->mu_flag || + !atom->torque_flag || atom->dipole == NULL) error->all("Pair dipole/cut requires atom attributes " "q, mu, torque, dipole"); } diff --git a/src/GRANULAR/atom_vec_granular.cpp b/src/GRANULAR/atom_vec_granular.cpp index f68d00412b..744fc35968 100644 --- a/src/GRANULAR/atom_vec_granular.cpp +++ b/src/GRANULAR/atom_vec_granular.cpp @@ -39,6 +39,9 @@ AtomVecGranular::AtomVecGranular(LAMMPS *lmp, int narg, char **arg) : size_data_vel = 7; xcol_data = 5; + atom->radius_flag = atom->density_flag = atom->rmass_flag = 1; + atom->xphi_flag = atom->omega_flag = atom->torque_flag = 1; + PI = 4.0*atan(1.0); } diff --git a/src/GRANULAR/fix_freeze.cpp b/src/GRANULAR/fix_freeze.cpp index cc5161c6f3..d1f7e4a0f8 100644 --- a/src/GRANULAR/fix_freeze.cpp +++ b/src/GRANULAR/fix_freeze.cpp @@ -27,7 +27,7 @@ FixFreeze::FixFreeze(LAMMPS *lmp, int narg, char **arg) : { if (narg != 3) error->all("Illegal fix freeze command"); - if (atom->torque == NULL) + if (!atom->torque_flag) error->all("Fix freeze requires atom attribute torque"); } diff --git a/src/GRANULAR/fix_gran_diag.cpp b/src/GRANULAR/fix_gran_diag.cpp index 51a41e61b5..778afc06e1 100644 --- a/src/GRANULAR/fix_gran_diag.cpp +++ b/src/GRANULAR/fix_gran_diag.cpp @@ -46,7 +46,7 @@ FixGranDiag::FixGranDiag(LAMMPS *lmp, int narg, char **arg) : if (nevery <= 0) error->all("Illegal fix gran/diag command"); first = 1; - if (atom->radius == NULL || atom->rmass == NULL || atom->omega == NULL) + if (!atom->radius_flag || !atom->rmass_flag || !atom->omega_flag) error->all("Fix gran/diag requires atom attributes radius, rmass, omega"); MPI_Comm_rank(world,&me); diff --git a/src/GRANULAR/fix_nve_gran.cpp b/src/GRANULAR/fix_nve_gran.cpp index d9c6193bb3..3b026fb333 100644 --- a/src/GRANULAR/fix_nve_gran.cpp +++ b/src/GRANULAR/fix_nve_gran.cpp @@ -33,7 +33,7 @@ FixNVEGran::FixNVEGran(LAMMPS *lmp, int narg, char **arg) : { if (narg != 3) error->all("Illegal fix nve/gran command"); - if (atom->xphi == NULL || atom->omega == NULL || atom->torque == NULL) + if (!atom->xphi_flag || !atom->omega_flag || !atom->torque_flag) error->all("Fix nve/gran requires atom attributes " "xphi, omega, torque"); } diff --git a/src/GRANULAR/fix_pour.cpp b/src/GRANULAR/fix_pour.cpp index 4cdbda2074..f48da3e644 100644 --- a/src/GRANULAR/fix_pour.cpp +++ b/src/GRANULAR/fix_pour.cpp @@ -42,10 +42,8 @@ FixPour::FixPour(LAMMPS *lmp, int narg, char **arg) : { if (narg < 6) error->all("Illegal fix pour command"); - /* - if (atom->radius == NULL || atom->rmass == NULL) + if (!atom->radius_flag || !atom->rmass_flag) error->all("Fix pour requires atom attributes radius, rmass"); - */ if (domain->triclinic) error->all("Cannot use fix pour with triclinic box"); diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index 92f9126a1b..150397689e 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -45,7 +45,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : { if (narg < 4) error->all("Illegal fix wall/gran command"); - if (atom->radius == NULL || atom->omega == NULL || atom->torque == NULL) + if (!atom->radius_flag || !atom->omega_flag || !atom->torque_flag) error->all("Fix wall/gran requires atom attributes radius, omega, torque"); restart_peratom = 1; diff --git a/src/GRANULAR/pair_gran_history.cpp b/src/GRANULAR/pair_gran_history.cpp index ecf91bab8f..b1f94cdf49 100644 --- a/src/GRANULAR/pair_gran_history.cpp +++ b/src/GRANULAR/pair_gran_history.cpp @@ -325,7 +325,7 @@ void PairGranHistory::init_style() { int i; - if (atom->radius == NULL || atom->omega == NULL || atom->torque == NULL) + if (!atom->radius_flag || !atom->omega_flag || !atom->torque_flag) error->all("Pair granular requires atom attributes radius, omega, torque"); xkkt = xkk * 2.0/7.0; diff --git a/src/KSPACE/ewald.cpp b/src/KSPACE/ewald.cpp index 9d4dab9299..c9dd68ed2a 100644 --- a/src/KSPACE/ewald.cpp +++ b/src/KSPACE/ewald.cpp @@ -83,8 +83,7 @@ void Ewald::init() if (domain->triclinic) error->all("Cannot use Ewald with triclinic box"); if (force->dimension == 2) error->all("Cannot use Ewald with 2d simulation"); - if (atom->q == NULL) - error->all("Must use charged atom style with kspace style"); + if (!atom->q_flag) error->all("Kspace style requires atom attribute q"); if (slabflag == 0 && domain->nonperiodic > 0) error->all("Cannot use nonperiodic boundaries with Ewald"); diff --git a/src/KSPACE/pair_buck_coul_long.cpp b/src/KSPACE/pair_buck_coul_long.cpp index 30a48bb2bd..fabc8c1f1b 100644 --- a/src/KSPACE/pair_buck_coul_long.cpp +++ b/src/KSPACE/pair_buck_coul_long.cpp @@ -300,7 +300,7 @@ double PairBuckCoulLong::init_one(int i, int j) void PairBuckCoulLong::init_style() { - if (atom->q == NULL) + if (!atom->q_flag) error->all("Pair style buck/coul/long requires atom attribute q"); cut_coulsq = cut_coul * cut_coul; diff --git a/src/KSPACE/pair_lj_charmm_coul_long.cpp b/src/KSPACE/pair_lj_charmm_coul_long.cpp index c64d694405..bc158fef0b 100644 --- a/src/KSPACE/pair_lj_charmm_coul_long.cpp +++ b/src/KSPACE/pair_lj_charmm_coul_long.cpp @@ -747,7 +747,7 @@ double PairLJCharmmCoulLong::init_one(int i, int j) void PairLJCharmmCoulLong::init_style() { - if (atom->q == NULL) + if (!atom->q_flag) error->all("Pair style lj/charmm/coul/long requires atom attribute q"); // require cut_lj_inner < cut_lj diff --git a/src/KSPACE/pair_lj_cut_coul_long.cpp b/src/KSPACE/pair_lj_cut_coul_long.cpp index f13f6368d5..3c0e008fc6 100644 --- a/src/KSPACE/pair_lj_cut_coul_long.cpp +++ b/src/KSPACE/pair_lj_cut_coul_long.cpp @@ -721,7 +721,7 @@ void PairLJCutCoulLong::init_style() { int i,j; - if (atom->q == NULL) + if (!atom->q_flag) error->all("Pair style lj/cut/coul/long requires atom attribute q"); cut_coulsq = cut_coul * cut_coul; diff --git a/src/KSPACE/pair_lj_cut_coul_long_tip4p.cpp b/src/KSPACE/pair_lj_cut_coul_long_tip4p.cpp index e994db763b..1a6a0e7f02 100644 --- a/src/KSPACE/pair_lj_cut_coul_long_tip4p.cpp +++ b/src/KSPACE/pair_lj_cut_coul_long_tip4p.cpp @@ -410,7 +410,7 @@ void PairLJCutCoulLongTIP4P::init_style() error->all("Pair style lj/cut/coul/long/tip4p requires atom IDs"); if (!force->newton_pair) error->all("Pair style lj/cut/coul/long/tip4p requires newton pair on"); - if (atom->q == NULL) + if (!atom->q_flag) error->all("Pair style lj/cut/coul/long/tip4p requires atom attribute q"); cut_coulsq = cut_coul * cut_coul; diff --git a/src/KSPACE/pppm.cpp b/src/KSPACE/pppm.cpp index 79dec55436..a687a17e79 100644 --- a/src/KSPACE/pppm.cpp +++ b/src/KSPACE/pppm.cpp @@ -109,8 +109,7 @@ void PPPM::init() error->all("Cannot (yet) use PPPM with triclinic box"); if (force->dimension == 2) error->all("Cannot use PPPM with 2d simulation"); - if (atom->q == NULL) - error->all("Must use charged atom style with kspace style"); + if (!atom->q_flag) error->all("Kspace style requires atom attribute q"); if (slabflag == 0 && domain->nonperiodic > 0) error->all("Cannot use nonperiodic boundaries with PPPM"); diff --git a/src/MAKE/Makefile.g++_meam b/src/MAKE/Makefile.g++_meam index 3e5ac6771a..5303e447cd 100755 --- a/src/MAKE/Makefile.g++_meam +++ b/src/MAKE/Makefile.g++_meam @@ -1,4 +1,4 @@ -# g++_meam = RedHat Linux box, g++, MPICH, FFTW, MEAM +# g++_meam = RedHat Linux box, g++, MPICH, FFTW, MEAM library SHELL = /bin/sh #.IGNORE: diff --git a/src/MOLECULE/atom_vec_angle.cpp b/src/MOLECULE/atom_vec_angle.cpp index 2b7296c718..076305efc1 100644 --- a/src/MOLECULE/atom_vec_angle.cpp +++ b/src/MOLECULE/atom_vec_angle.cpp @@ -42,6 +42,8 @@ AtomVecAngle::AtomVecAngle(LAMMPS *lmp, int narg, char **arg) : size_data_atom = 6; size_data_vel = 4; xcol_data = 4; + + atom->molecule_flag = 1; } /* ---------------------------------------------------------------------- diff --git a/src/MOLECULE/atom_vec_bond.cpp b/src/MOLECULE/atom_vec_bond.cpp index a86afc3bab..fa998b0d47 100644 --- a/src/MOLECULE/atom_vec_bond.cpp +++ b/src/MOLECULE/atom_vec_bond.cpp @@ -41,6 +41,8 @@ AtomVecBond::AtomVecBond(LAMMPS *lmp, int narg, char **arg) : size_data_atom = 6; size_data_vel = 4; xcol_data = 4; + + atom->molecule_flag = 1; } /* ---------------------------------------------------------------------- diff --git a/src/MOLECULE/atom_vec_full.cpp b/src/MOLECULE/atom_vec_full.cpp index 5595849688..bab3347fd8 100644 --- a/src/MOLECULE/atom_vec_full.cpp +++ b/src/MOLECULE/atom_vec_full.cpp @@ -44,6 +44,8 @@ AtomVecFull::AtomVecFull(LAMMPS *lmp, int narg, char **arg) : size_data_atom = 7; size_data_vel = 4; xcol_data = 5; + + atom->molecule_flag = atom->q_flag = 1; } /* ---------------------------------------------------------------------- diff --git a/src/MOLECULE/atom_vec_molecular.cpp b/src/MOLECULE/atom_vec_molecular.cpp index 489d009ef8..04f1b24f8a 100644 --- a/src/MOLECULE/atom_vec_molecular.cpp +++ b/src/MOLECULE/atom_vec_molecular.cpp @@ -44,6 +44,8 @@ AtomVecMolecular::AtomVecMolecular(LAMMPS *lmp, int narg, char **arg) : size_data_atom = 6; size_data_vel = 4; xcol_data = 4; + + atom->molecule_flag = 1; } /* ---------------------------------------------------------------------- diff --git a/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp b/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp index aed79757d4..8eb722cb26 100644 --- a/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp +++ b/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp @@ -323,7 +323,7 @@ double PairLJCharmmCoulCharmm::init_one(int i, int j) void PairLJCharmmCoulCharmm::init_style() { - if (atom->q == NULL) + if (!atom->q_flag) error->all("Pair style lj/charmm/coul/charmm requires atom attribute q"); // require cut_lj_inner < cut_lj, cut_coul_inner < cut_coul diff --git a/src/POEMS/fix_poems.cpp b/src/POEMS/fix_poems.cpp index ed704cce13..94142190d8 100644 --- a/src/POEMS/fix_poems.cpp +++ b/src/POEMS/fix_poems.cpp @@ -59,12 +59,6 @@ FixPOEMS::FixPOEMS(LAMMPS *lmp, int narg, char **arg) : virial_flag = 1; MPI_Comm_rank(world,&me); - // can't use with pure granular style since mass arrays are different - // hybrid granular style would be OK if fix were on non-granular atoms - - if (atom->check_style("granular")) - error->all("Cannot use fix poems with atom style granular"); - // perform initial allocation of atom-based arrays // register with atom class @@ -337,7 +331,7 @@ void FixPOEMS::init() int count = 0; for (int i = 0; i < modify->nfix; i++) if (strcmp(modify->fix[i]->style,"poems") == 0) count++; - if (count > 1 && comm->me == 0) error->warning("More than one poems fix"); + if (count > 1 && comm->me == 0) error->warning("More than one fix poems"); // error if npt,nph fix comes before rigid fix diff --git a/src/atom.cpp b/src/atom.cpp index 0eebda62f1..2b02a844ee 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -52,7 +52,7 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp) nbonds = nangles = ndihedrals = nimpropers = 0; bond_per_atom = angle_per_atom = dihedral_per_atom = improper_per_atom = 0; - // atom arrays + // initialize atom arrays // customize by adding new array tag = type = mask = image = NULL; @@ -82,6 +82,14 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp) improper_type = improper_atom1 = improper_atom2 = NULL; improper_atom3 = improper_atom4 = NULL; + // initialize atom array existence flags + // customize by adding new flag + + molecule_flag = 0; + q_flag = mu_flag = 0; + xphi_flag = quat_flag = omega_flag = angmom_flag = torque_flag = 0; + radius_flag = density_flag = rmass_flag = vfrac_flag = 0; + // ntype-length arrays mass = NULL; diff --git a/src/atom.h b/src/atom.h index cf96cd953e..e46c024dcd 100644 --- a/src/atom.h +++ b/src/atom.h @@ -65,6 +65,14 @@ class Atom : protected Pointers { int **improper_type; int **improper_atom1,**improper_atom2,**improper_atom3,**improper_atom4; + // per-atom array existence flags + // customize by adding new flag + + int molecule_flag; + int q_flag,mu_flag; + int xphi_flag,quat_flag,omega_flag,angmom_flag,torque_flag; + int radius_flag,density_flag,rmass_flag,vfrac_flag; + // extra peratom info in restart file destined for fix & diag double **extra; diff --git a/src/atom_vec_charge.cpp b/src/atom_vec_charge.cpp index 25ba6147b7..0cb94f5129 100644 --- a/src/atom_vec_charge.cpp +++ b/src/atom_vec_charge.cpp @@ -36,6 +36,8 @@ AtomVecCharge::AtomVecCharge(LAMMPS *lmp, int narg, char **arg) : size_data_atom = 6; size_data_vel = 4; xcol_data = 4; + + atom->q_flag = 1; } /* ---------------------------------------------------------------------- diff --git a/src/compute_rotate_dipole.cpp b/src/compute_rotate_dipole.cpp index 74c510ed13..f6bc4e4015 100644 --- a/src/compute_rotate_dipole.cpp +++ b/src/compute_rotate_dipole.cpp @@ -30,7 +30,7 @@ ComputeRotateDipole::ComputeRotateDipole(LAMMPS *lmp, int narg, char **arg) : { if (narg != 3) error->all("Illegal compute rotate/dipole command"); - if (atom->dipole == NULL || atom->omega == NULL) + if (atom->dipole == NULL || !atom->omega_flag) error->all("Compute rotate/dipole requires atom attributes dipole, omega"); scalar_flag = 1; diff --git a/src/compute_rotate_gran.cpp b/src/compute_rotate_gran.cpp index 7707d0eef3..3f1c475770 100644 --- a/src/compute_rotate_gran.cpp +++ b/src/compute_rotate_gran.cpp @@ -30,7 +30,7 @@ ComputeRotateGran::ComputeRotateGran(LAMMPS *lmp, int narg, char **arg) : { if (narg != 3) error->all("Illegal compute rotate/gran command"); - if (atom->radius == NULL || atom->rmass == NULL || atom->omega == NULL) + if (!atom->radius_flag || !atom->rmass_flag || !atom->omega_flag) error->all("Compute rotate/gran requires atom attributes " "radius, rmass, omega"); diff --git a/src/compute_temp_deform.cpp b/src/compute_temp_deform.cpp index 35831ec4f0..8c883d46db 100644 --- a/src/compute_temp_deform.cpp +++ b/src/compute_temp_deform.cpp @@ -69,13 +69,13 @@ void ComputeTempDeform::init() for (i = 0; i < modify->nfix; i++) if (strcmp(modify->fix[i]->style,"deform") == 0) { - if (((FixDeform *) modify->fix[i])->remapflag != V_REMAP && + if (((FixDeform *) modify->fix[i])->remapflag == X_REMAP && comm->me == 0) - error->warning("Using fix nvt/sllod with inconsistent fix deform remapping"); + error->warning("Using compute temp/deform with inconsistent fix deform remap option"); break; } if (i == modify->nfix && comm->me == 0) - error->warning("Using fix nvt/sllod with no fix deform defined"); + error->warning("Using compute temp/deform with no fix deform defined"); } /* ---------------------------------------------------------------------- */ diff --git a/src/fix_deform.cpp b/src/fix_deform.cpp index c3e325d40b..1e577a60d7 100644 --- a/src/fix_deform.cpp +++ b/src/fix_deform.cpp @@ -315,7 +315,7 @@ void FixDeform::init() int count = 0; for (int i = 0; i < modify->nfix; i++) if (strcmp(modify->fix[i]->style,"deform") == 0) count++; - if (count > 1) error->warning("More than one fix deform"); + if (count > 1) error->all("More than one fix deform"); // Kspace setting diff --git a/src/fix_nvt_sllod.cpp b/src/fix_nvt_sllod.cpp index a18357a90d..4528203ad5 100644 --- a/src/fix_nvt_sllod.cpp +++ b/src/fix_nvt_sllod.cpp @@ -53,13 +53,13 @@ void FixNVTSlodd::init() int i; for (i = 0; i < modify->nfix; i++) if (strcmp(modify->fix[i]->style,"deform") == 0) { - if (((FixDeform *) modify->fix[i])->remapflag == X_REMAP && + if (((FixDeform *) modify->fix[i])->remapflag != V_REMAP && comm->me == 0) - error->warning("Using compute temp/deform with fix deform remapping coords"); + error->warning("Using fix nvt/sllod with inconsistent fix deform remap option"); break; } if (i == modify->nfix && comm->me == 0) - error->warning("Using compute temp/deform with no fix deform defined"); + error->warning("Using fix nvt/sllod with no fix deform defined"); } /* ---------------------------------------------------------------------- */ diff --git a/src/fix_rigid.cpp b/src/fix_rigid.cpp index 5de40253ba..92c4bcc64d 100644 --- a/src/fix_rigid.cpp +++ b/src/fix_rigid.cpp @@ -162,7 +162,7 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : // error check on nbody - if (nbody == 0) error->all("No rigid bodies defined by fix rigid"); + if (nbody == 0) error->all("No rigid bodies defined"); // create all nbody-length arrays diff --git a/src/pair_buck_coul_cut.cpp b/src/pair_buck_coul_cut.cpp index a32a911e3c..9348c0f693 100644 --- a/src/pair_buck_coul_cut.cpp +++ b/src/pair_buck_coul_cut.cpp @@ -297,7 +297,7 @@ double PairBuckCoulCut::init_one(int i, int j) void PairBuckCoulCut::init_style() { - if (atom->q == NULL) + if (!atom->q_flag) error->all("Pair style buck/coul/cut requires atom attribute q"); } diff --git a/src/pair_lj_cut_coul_cut.cpp b/src/pair_lj_cut_coul_cut.cpp index f3a0d0142f..9993f0edd7 100644 --- a/src/pair_lj_cut_coul_cut.cpp +++ b/src/pair_lj_cut_coul_cut.cpp @@ -322,7 +322,7 @@ double PairLJCutCoulCut::init_one(int i, int j) void PairLJCutCoulCut::init_style() { - if (atom->q == NULL) + if (!atom->q_flag) error->all("Pair style lj/cut/coul/cut requires atom attribute q"); } diff --git a/src/variable.cpp b/src/variable.cpp index eb173a12bc..3df410d573 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -719,7 +719,7 @@ double Variable::evaluate(char *str, Tree *tree) } else if (tree) { - if (strlen(arg)) error->all("Invalid atom vector argument in variable"); + if (strlen(arg)) error->all("Invalid atom vector in variable"); // customize by adding atom vector to this list and to if statement // mass,x,y,z,vx,vy,vz,fx,fy,fz diff --git a/src/verlet.cpp b/src/verlet.cpp index 9df786b745..5d4ff28b87 100644 --- a/src/verlet.cpp +++ b/src/verlet.cpp @@ -96,7 +96,7 @@ void Verlet::init() // don't need to clear f_pair if atom_style is only granular (no virial) torqueflag = 0; - if (atom->torque) torqueflag = 1; + if (atom->torque_flag) torqueflag = 1; pairflag = 1; if (strcmp(atom->atom_style,"granular") == 0) pairflag = 0; diff --git a/src/write_restart.cpp b/src/write_restart.cpp index b7d7397242..9c67385369 100644 --- a/src/write_restart.cpp +++ b/src/write_restart.cpp @@ -219,9 +219,12 @@ void WriteRestart::write(char *file) sprintf(perproc,"%s%d%s",file,me,ptr+1); *ptr = '%'; fp = fopen(perproc,"wb"); + if (fp == NULL) { + char str[128]; + sprintf(str,"Cannot open restart file %s",perproc); + error->one(str); + } delete [] perproc; - if (fp == NULL) error->one("Cannot open restart file"); - fwrite(&send_size,sizeof(int),1,fp); fwrite(buf,sizeof(double),send_size,fp); fclose(fp);