From 7000d43d107abf595be57619fed608843e69b17a Mon Sep 17 00:00:00 2001 From: sjplimp Date: Wed, 20 Jun 2012 13:46:30 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@8348 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/compute_angle_local.cpp | 6 ++- src/compute_bond_local.cpp | 6 ++- src/compute_dihedral_local.cpp | 6 ++- src/compute_improper_local.cpp | 6 ++- src/compute_property_local.cpp | 78 ++++++++++++++++++++++------------ 5 files changed, 68 insertions(+), 34 deletions(-) diff --git a/src/compute_angle_local.cpp b/src/compute_angle_local.cpp index 3ed2a0cb88..626fc7df84 100644 --- a/src/compute_angle_local.cpp +++ b/src/compute_angle_local.cpp @@ -129,8 +129,10 @@ int ComputeAngleLocal::compute_angles(int flag) if (tflag >= 0) tbuf = vector; if (eflag >= 0) ebuf = vector; } else { - if (tflag >= 0) tbuf = &array[0][tflag]; - if (eflag >= 0) ebuf = &array[0][eflag]; + if (tflag >= 0 && array) tbuf = &array[0][tflag]; + else tbuf = NULL; + if (eflag >= 0 && array) ebuf = &array[0][eflag]; + else ebuf = NULL; } } diff --git a/src/compute_bond_local.cpp b/src/compute_bond_local.cpp index 2ffea3556c..ad3ca626bc 100644 --- a/src/compute_bond_local.cpp +++ b/src/compute_bond_local.cpp @@ -125,8 +125,10 @@ int ComputeBondLocal::compute_bonds(int flag) if (dflag >= 0) dbuf = vector; if (eflag >= 0) ebuf = vector; } else { - if (dflag >= 0) dbuf = &array[0][dflag]; - if (eflag >= 0) ebuf = &array[0][eflag]; + if (dflag >= 0 && array) dbuf = &array[0][dflag]; + else dbuf = NULL; + if (eflag >= 0 && array) ebuf = &array[0][eflag]; + else ebuf = NULL; } } diff --git a/src/compute_dihedral_local.cpp b/src/compute_dihedral_local.cpp index 36feeca32e..e0f600521c 100644 --- a/src/compute_dihedral_local.cpp +++ b/src/compute_dihedral_local.cpp @@ -38,7 +38,8 @@ ComputeDihedralLocal::ComputeDihedralLocal(LAMMPS *lmp, int narg, char **arg) : if (narg < 4) error->all(FLERR,"Illegal compute dihedral/local command"); if (atom->avec->dihedrals_allow == 0) - error->all(FLERR,"Compute dihedral/local used when dihedrals are not allowed"); + error->all(FLERR, + "Compute dihedral/local used when dihedrals are not allowed"); local_flag = 1; nvalues = narg - 3; @@ -126,7 +127,8 @@ int ComputeDihedralLocal::compute_dihedrals(int flag) if (nvalues == 1) { if (pflag >= 0) pbuf = vector; } else { - if (pflag >= 0) pbuf = &array[0][pflag]; + if (pflag >= 0 && array) pbuf = &array[0][pflag]; + else pbuf = NULL; } } diff --git a/src/compute_improper_local.cpp b/src/compute_improper_local.cpp index 708b27d6f3..862169fbbc 100644 --- a/src/compute_improper_local.cpp +++ b/src/compute_improper_local.cpp @@ -39,7 +39,8 @@ ComputeImproperLocal::ComputeImproperLocal(LAMMPS *lmp, int narg, char **arg) : if (narg < 4) error->all(FLERR,"Illegal compute improper/local command"); if (atom->avec->impropers_allow == 0) - error->all(FLERR,"Compute improper/local used when impropers are not allowed"); + error->all(FLERR, + "Compute improper/local used when impropers are not allowed"); local_flag = 1; nvalues = narg - 3; @@ -127,7 +128,8 @@ int ComputeImproperLocal::compute_impropers(int flag) if (nvalues == 1) { if (cflag >= 0) cbuf = vector; } else { - if (cflag >= 0) cbuf = &array[0][cflag]; + if (cflag >= 0 && array) cbuf = &array[0][cflag]; + else cbuf = NULL; } } diff --git a/src/compute_property_local.cpp b/src/compute_property_local.cpp index b8e6f1e5a7..32787313ef 100644 --- a/src/compute_property_local.cpp +++ b/src/compute_property_local.cpp @@ -53,127 +53,153 @@ ComputePropertyLocal::ComputePropertyLocal(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg],"natom1") == 0) { pack_choice[i] = &ComputePropertyLocal::pack_patom1; if (kindflag != NONE && kindflag != NEIGH) - error->all(FLERR,"Compute property/local cannot use these inputs together"); + error->all(FLERR, + "Compute property/local cannot use these inputs together"); kindflag = NEIGH; } else if (strcmp(arg[iarg],"natom2") == 0) { pack_choice[i] = &ComputePropertyLocal::pack_patom2; if (kindflag != NONE && kindflag != NEIGH) - error->all(FLERR,"Compute property/local cannot use these inputs together"); + error->all(FLERR, + "Compute property/local cannot use these inputs together"); kindflag = NEIGH; } else if (strcmp(arg[iarg],"patom1") == 0) { pack_choice[i] = &ComputePropertyLocal::pack_patom1; if (kindflag != NONE && kindflag != PAIR) - error->all(FLERR,"Compute property/local cannot use these inputs together"); + error->all(FLERR, + "Compute property/local cannot use these inputs together"); kindflag = PAIR; } else if (strcmp(arg[iarg],"patom2") == 0) { pack_choice[i] = &ComputePropertyLocal::pack_patom2; if (kindflag != NONE && kindflag != PAIR) - error->all(FLERR,"Compute property/local cannot use these inputs together"); + error->all(FLERR, + "Compute property/local cannot use these inputs together"); kindflag = PAIR; } else if (strcmp(arg[iarg],"batom1") == 0) { pack_choice[i] = &ComputePropertyLocal::pack_batom1; if (kindflag != NONE && kindflag != BOND) - error->all(FLERR,"Compute property/local cannot use these inputs together"); + error->all(FLERR, + "Compute property/local cannot use these inputs together"); kindflag = BOND; } else if (strcmp(arg[iarg],"batom2") == 0) { pack_choice[i] = &ComputePropertyLocal::pack_batom2; if (kindflag != NONE && kindflag != BOND) - error->all(FLERR,"Compute property/local cannot use these inputs together"); + error->all(FLERR, + "Compute property/local cannot use these inputs together"); kindflag = BOND; } else if (strcmp(arg[iarg],"btype") == 0) { pack_choice[i] = &ComputePropertyLocal::pack_btype; if (kindflag != NONE && kindflag != BOND) - error->all(FLERR,"Compute property/local cannot use these inputs together"); + error->all(FLERR, + "Compute property/local cannot use these inputs together"); kindflag = BOND; } else if (strcmp(arg[iarg],"aatom1") == 0) { pack_choice[i] = &ComputePropertyLocal::pack_aatom1; if (kindflag != NONE && kindflag != ANGLE) - error->all(FLERR,"Compute property/local cannot use these inputs together"); + error->all(FLERR, + "Compute property/local cannot use these inputs together"); kindflag = ANGLE; } else if (strcmp(arg[iarg],"aatom2") == 0) { pack_choice[i] = &ComputePropertyLocal::pack_aatom2; if (kindflag != NONE && kindflag != ANGLE) - error->all(FLERR,"Compute property/local cannot use these inputs together"); + error->all(FLERR, + "Compute property/local cannot use these inputs together"); kindflag = ANGLE; } else if (strcmp(arg[iarg],"aatom3") == 0) { pack_choice[i] = &ComputePropertyLocal::pack_aatom3; if (kindflag != NONE && kindflag != ANGLE) - error->all(FLERR,"Compute property/local cannot use these inputs together"); + error->all(FLERR, + "Compute property/local cannot use these inputs together"); kindflag = ANGLE; } else if (strcmp(arg[iarg],"atype") == 0) { pack_choice[i] = &ComputePropertyLocal::pack_atype; if (kindflag != NONE && kindflag != ANGLE) - error->all(FLERR,"Compute property/local cannot use these inputs together"); + error->all(FLERR, + "Compute property/local cannot use these inputs together"); kindflag = ANGLE; } else if (strcmp(arg[iarg],"datom1") == 0) { pack_choice[i] = &ComputePropertyLocal::pack_datom1; if (kindflag != NONE && kindflag != DIHEDRAL) - error->all(FLERR,"Compute property/local cannot use these inputs together"); + error->all(FLERR, + "Compute property/local cannot use these inputs together"); kindflag = DIHEDRAL; } else if (strcmp(arg[iarg],"datom2") == 0) { pack_choice[i] = &ComputePropertyLocal::pack_datom2; if (kindflag != NONE && kindflag != DIHEDRAL) - error->all(FLERR,"Compute property/local cannot use these inputs together"); + error->all(FLERR, + "Compute property/local cannot use these inputs together"); kindflag = DIHEDRAL; } else if (strcmp(arg[iarg],"datom3") == 0) { pack_choice[i] = &ComputePropertyLocal::pack_datom3; if (kindflag != NONE && kindflag != DIHEDRAL) - error->all(FLERR,"Compute property/local cannot use these inputs together"); + error->all(FLERR, + "Compute property/local cannot use these inputs together"); kindflag = DIHEDRAL; } else if (strcmp(arg[iarg],"datom4") == 0) { pack_choice[i] = &ComputePropertyLocal::pack_datom4; if (kindflag != NONE && kindflag != DIHEDRAL) - error->all(FLERR,"Compute property/local cannot use these inputs together"); + error->all(FLERR, + "Compute property/local cannot use these inputs together"); kindflag = DIHEDRAL; } else if (strcmp(arg[iarg],"dtype") == 0) { pack_choice[i] = &ComputePropertyLocal::pack_dtype; if (kindflag != NONE && kindflag != DIHEDRAL) - error->all(FLERR,"Compute property/local cannot use these inputs together"); + error->all(FLERR, + "Compute property/local cannot use these inputs together"); kindflag = DIHEDRAL; } else if (strcmp(arg[iarg],"iatom1") == 0) { pack_choice[i] = &ComputePropertyLocal::pack_iatom1; if (kindflag != NONE && kindflag != IMPROPER) - error->all(FLERR,"Compute property/local cannot use these inputs together"); + error->all(FLERR, + "Compute property/local cannot use these inputs together"); kindflag = IMPROPER; } else if (strcmp(arg[iarg],"iatom2") == 0) { pack_choice[i] = &ComputePropertyLocal::pack_iatom2; if (kindflag != NONE && kindflag != IMPROPER) - error->all(FLERR,"Compute property/local cannot use these inputs together"); + error->all(FLERR, + "Compute property/local cannot use these inputs together"); kindflag = IMPROPER; } else if (strcmp(arg[iarg],"iatom3") == 0) { pack_choice[i] = &ComputePropertyLocal::pack_iatom3; if (kindflag != NONE && kindflag != IMPROPER) - error->all(FLERR,"Compute property/local cannot use these inputs together"); + error->all(FLERR, + "Compute property/local cannot use these inputs together"); kindflag = IMPROPER; } else if (strcmp(arg[iarg],"iatom4") == 0) { pack_choice[i] = &ComputePropertyLocal::pack_iatom4; if (kindflag != NONE && kindflag != IMPROPER) - error->all(FLERR,"Compute property/local cannot use these inputs together"); + error->all(FLERR, + "Compute property/local cannot use these inputs together"); kindflag = IMPROPER; } else if (strcmp(arg[iarg],"itype") == 0) { pack_choice[i] = &ComputePropertyLocal::pack_itype; if (kindflag != NONE && kindflag != IMPROPER) - error->all(FLERR,"Compute property/local cannot use these inputs together"); + error->all(FLERR, + "Compute property/local cannot use these inputs together"); kindflag = IMPROPER; - } else error->all(FLERR,"Invalid keyword in compute property/local command"); + } else error->all(FLERR, + "Invalid keyword in compute property/local command"); } // error check if (kindflag == BOND && atom->avec->bonds_allow == 0) - error->all(FLERR,"Compute property/local for property that isn't allocated"); + error->all(FLERR, + "Compute property/local for property that isn't allocated"); if (kindflag == ANGLE && atom->avec->angles_allow == 0) - error->all(FLERR,"Compute property/local for property that isn't allocated"); + error->all(FLERR, + "Compute property/local for property that isn't allocated"); if (kindflag == DIHEDRAL && atom->avec->dihedrals_allow == 0) - error->all(FLERR,"Compute property/local for property that isn't allocated"); + error->all(FLERR, + "Compute property/local for property that isn't allocated"); if (kindflag == IMPROPER && atom->avec->impropers_allow == 0) - error->all(FLERR,"Compute property/local for property that isn't allocated"); + error->all(FLERR, + "Compute property/local for property that isn't allocated"); nmax = 0; vector = NULL;