git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@638 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp 2007-06-21 18:58:43 +00:00
parent 59dda9f04b
commit ff535daa9f
46 changed files with 80 additions and 54 deletions

View File

@ -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;
}
/* ---------------------------------------------------------------------- */

View File

@ -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;

View File

@ -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");
}

View File

@ -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 =

View File

@ -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");
}

View File

@ -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

View File

@ -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");
}

View File

@ -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;

View File

@ -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;
}
/* ----------------------------------------------------------------------

View File

@ -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;

View File

@ -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];

View File

@ -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");
}

View File

@ -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);
}

View File

@ -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");
}

View File

@ -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);

View File

@ -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");
}

View File

@ -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");

View File

@ -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;

View File

@ -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;

View File

@ -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");

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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");

View File

@ -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:

View File

@ -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;
}
/* ----------------------------------------------------------------------

View File

@ -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;
}
/* ----------------------------------------------------------------------

View File

@ -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;
}
/* ----------------------------------------------------------------------

View File

@ -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;
}
/* ----------------------------------------------------------------------

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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;
}
/* ----------------------------------------------------------------------

View File

@ -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;

View File

@ -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");

View File

@ -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");
}
/* ---------------------------------------------------------------------- */

View File

@ -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

View File

@ -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");
}
/* ---------------------------------------------------------------------- */

View File

@ -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

View File

@ -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");
}

View File

@ -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");
}

View File

@ -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

View File

@ -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;

View File

@ -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);