From 460379ce2003d95af094143fba1356e9fb201fc6 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Wed, 17 Nov 2010 18:25:24 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@5250 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/CLASS2/angle_class2.cpp | 80 ++++---- src/CLASS2/angle_class2.h | 2 +- src/CLASS2/dihedral_class2.cpp | 227 +++++++++++------------ src/CLASS2/dihedral_class2.h | 2 +- src/CLASS2/improper_class2.cpp | 57 +++--- src/CLASS2/improper_class2.h | 2 +- src/MOLECULE/angle_charmm.cpp | 3 +- src/MOLECULE/angle_charmm.h | 2 +- src/MOLECULE/angle_cosine.cpp | 3 +- src/MOLECULE/angle_cosine.h | 2 +- src/MOLECULE/angle_cosine_periodic.cpp | 3 +- src/MOLECULE/angle_cosine_periodic.h | 2 +- src/MOLECULE/angle_cosine_squared.cpp | 3 +- src/MOLECULE/angle_cosine_squared.h | 2 +- src/MOLECULE/angle_harmonic.cpp | 3 +- src/MOLECULE/angle_harmonic.h | 2 +- src/MOLECULE/angle_hybrid.cpp | 4 +- src/MOLECULE/angle_hybrid.h | 2 +- src/MOLECULE/angle_table.cpp | 3 +- src/MOLECULE/angle_table.h | 2 +- src/MOLECULE/dihedral_charmm.cpp | 3 +- src/MOLECULE/dihedral_charmm.h | 2 +- src/MOLECULE/dihedral_harmonic.cpp | 3 +- src/MOLECULE/dihedral_harmonic.h | 2 +- src/MOLECULE/dihedral_helix.cpp | 3 +- src/MOLECULE/dihedral_helix.h | 2 +- src/MOLECULE/dihedral_hybrid.cpp | 4 +- src/MOLECULE/dihedral_hybrid.h | 2 +- src/MOLECULE/dihedral_multi_harmonic.cpp | 3 +- src/MOLECULE/dihedral_multi_harmonic.h | 2 +- src/MOLECULE/dihedral_opls.cpp | 3 +- src/MOLECULE/dihedral_opls.h | 2 +- src/MOLECULE/improper_cvff.cpp | 3 +- src/MOLECULE/improper_cvff.h | 2 +- src/MOLECULE/improper_harmonic.cpp | 3 +- src/MOLECULE/improper_harmonic.h | 2 +- src/MOLECULE/improper_hybrid.cpp | 4 +- src/MOLECULE/improper_hybrid.h | 2 +- src/MOLECULE/improper_umbrella.cpp | 3 +- src/MOLECULE/improper_umbrella.h | 2 +- src/USER-CG-CMM/angle_cg_cmm.cpp | 3 +- src/USER-CG-CMM/angle_cg_cmm.h | 2 +- src/angle.h | 2 +- src/dihedral.h | 2 +- src/improper.h | 2 +- src/input.cpp | 6 +- src/read_data.cpp | 34 ++-- src/read_data.h | 2 +- 48 files changed, 249 insertions(+), 262 deletions(-) diff --git a/src/CLASS2/angle_class2.cpp b/src/CLASS2/angle_class2.cpp index c72f34685c..7a7e816afa 100644 --- a/src/CLASS2/angle_class2.cpp +++ b/src/CLASS2/angle_class2.cpp @@ -16,6 +16,7 @@ ------------------------------------------------------------------------- */ #include "math.h" +#include "string.h" #include "stdlib.h" #include "angle_class2.h" #include "atom.h" @@ -259,15 +260,14 @@ void AngleClass2::allocate() /* ---------------------------------------------------------------------- set coeffs for one or more types - which = 0 -> Angle coeffs - which = 1 -> BondBond coeffs - which = 2 -> BondAngle coeffs + arg1 = "bb" -> BondBond coeffs + arg1 = "ba" -> BondAngle coeffs + else -> Angle coeffs ------------------------------------------------------------------------- */ -void AngleClass2::coeff(int which, int narg, char **arg) +void AngleClass2::coeff(int narg, char **arg) { - if (which < 0 || which > 2) - error->all("Invalid coeffs for this angle style"); + if (narg < 2) error->all("Incorrect args for angle coefficients"); if (!allocated) allocate(); int ilo,ihi; @@ -275,7 +275,39 @@ void AngleClass2::coeff(int which, int narg, char **arg) int count = 0; - if (which == 0) { + if (strcmp(arg[1],"bb") == 0) { + if (narg != 5) error->all("Incorrect args for angle coefficients"); + + double bb_k_one = force->numeric(arg[2]); + double bb_r1_one = force->numeric(arg[3]); + double bb_r2_one = force->numeric(arg[4]); + + for (int i = ilo; i <= ihi; i++) { + bb_k[i] = bb_k_one; + bb_r1[i] = bb_r1_one; + bb_r2[i] = bb_r2_one; + setflag_bb[i] = 1; + count++; + } + + } else if (strcmp(arg[1],"ba") == 0) { + if (narg != 6) error->all("Incorrect args for angle coefficients"); + + double ba_k1_one = force->numeric(arg[2]); + double ba_k2_one = force->numeric(arg[3]); + double ba_r1_one = force->numeric(arg[4]); + double ba_r2_one = force->numeric(arg[5]); + + for (int i = ilo; i <= ihi; i++) { + ba_k1[i] = ba_k1_one; + ba_k2[i] = ba_k2_one; + ba_r1[i] = ba_r1_one; + ba_r2[i] = ba_r2_one; + setflag_ba[i] = 1; + count++; + } + + } else { if (narg != 5) error->all("Incorrect args for angle coefficients"); double theta0_one = force->numeric(arg[1]); @@ -295,40 +327,6 @@ void AngleClass2::coeff(int which, int narg, char **arg) } } - if (which == 1) { - if (narg != 4) error->all("Incorrect args for angle coefficients"); - - double bb_k_one = force->numeric(arg[1]); - double bb_r1_one = force->numeric(arg[2]); - double bb_r2_one = force->numeric(arg[3]); - - for (int i = ilo; i <= ihi; i++) { - bb_k[i] = bb_k_one; - bb_r1[i] = bb_r1_one; - bb_r2[i] = bb_r2_one; - setflag_bb[i] = 1; - count++; - } - } - - if (which == 2) { - if (narg != 5) error->all("Incorrect args for angle coefficients"); - - double ba_k1_one = force->numeric(arg[1]); - double ba_k2_one = force->numeric(arg[2]); - double ba_r1_one = force->numeric(arg[3]); - double ba_r2_one = force->numeric(arg[4]); - - for (int i = ilo; i <= ihi; i++) { - ba_k1[i] = ba_k1_one; - ba_k2[i] = ba_k2_one; - ba_r1[i] = ba_r1_one; - ba_r2[i] = ba_r2_one; - setflag_ba[i] = 1; - count++; - } - } - if (count == 0) error->all("Incorrect args for angle coefficients"); for (int i = ilo; i <= ihi; i++) diff --git a/src/CLASS2/angle_class2.h b/src/CLASS2/angle_class2.h index a2c6e99711..cbea3cfe7e 100644 --- a/src/CLASS2/angle_class2.h +++ b/src/CLASS2/angle_class2.h @@ -30,7 +30,7 @@ class AngleClass2 : public Angle { AngleClass2(class LAMMPS *); ~AngleClass2(); void compute(int, int); - void coeff(int, int, char **); + void coeff(int, char **); double equilibrium_angle(int); void write_restart(FILE *); void read_restart(FILE *); diff --git a/src/CLASS2/dihedral_class2.cpp b/src/CLASS2/dihedral_class2.cpp index 7b03fbbec1..e4a42b18f9 100644 --- a/src/CLASS2/dihedral_class2.cpp +++ b/src/CLASS2/dihedral_class2.cpp @@ -16,6 +16,7 @@ ------------------------------------------------------------------------- */ #include "math.h" +#include "string.h" #include "stdlib.h" #include "dihedral_class2.h" #include "atom.h" @@ -644,18 +645,17 @@ void DihedralClass2::allocate() /* ---------------------------------------------------------------------- set coeffs for one or more types - which = 0 -> Dihedral coeffs - which = 1 -> MiddleBondTorsion coeffs - which = 2 -> EndBondTorsion coeffs - which = 3 -> AngleTorsion coeffs - which = 4 -> AngleAngleTorsion coeffs - which = 5 -> BondBond13Torsion coeffs + arg1 = "mbt" -> MiddleBondTorsion coeffs + arg1 = "ebt" -> EndBondTorsion coeffs + arg1 = "at" -> AngleTorsion coeffs + arg1 = "aat" -> AngleAngleTorsion coeffs + arg1 = "bb13" -> BondBond13Torsion coeffs + arg1 -> Dihedral coeffs ------------------------------------------------------------------------- */ -void DihedralClass2::coeff(int which, int narg, char **arg) +void DihedralClass2::coeff(int narg, char **arg) { - if (which < 0 || which > 5) - error->all("Invalid coeffs for this dihedral style"); + if (narg < 2) error->all("Invalid coeffs for this dihedral style"); if (!allocated) allocate(); int ilo,ihi; @@ -663,7 +663,108 @@ void DihedralClass2::coeff(int which, int narg, char **arg) int count = 0; - if (which == 0) { + if (strcmp(arg[1],"mbt") == 0) { + if (narg != 6) error->all("Incorrect args for dihedral coefficients"); + + double f1_one = force->numeric(arg[2]); + double f2_one = force->numeric(arg[3]); + double f3_one = force->numeric(arg[4]); + double r0_one = force->numeric(arg[5]); + + for (int i = ilo; i <= ihi; i++) { + mbt_f1[i] = f1_one; + mbt_f2[i] = f2_one; + mbt_f3[i] = f3_one; + mbt_r0[i] = r0_one; + setflag_mbt[i] = 1; + count++; + } + + } else if (strcmp(arg[1],"ebt") == 0) { + if (narg != 10) error->all("Incorrect args for dihedral coefficients"); + + double f1_1_one = force->numeric(arg[2]); + double f2_1_one = force->numeric(arg[3]); + double f3_1_one = force->numeric(arg[4]); + double f1_2_one = force->numeric(arg[5]); + double f2_2_one = force->numeric(arg[6]); + double f3_2_one = force->numeric(arg[7]); + double r0_1_one = force->numeric(arg[8]); + double r0_2_one = force->numeric(arg[9]); + + for (int i = ilo; i <= ihi; i++) { + ebt_f1_1[i] = f1_1_one; + ebt_f2_1[i] = f2_1_one; + ebt_f3_1[i] = f3_1_one; + ebt_f1_2[i] = f1_2_one; + ebt_f2_2[i] = f2_2_one; + ebt_f3_2[i] = f3_2_one; + ebt_r0_1[i] = r0_1_one; + ebt_r0_2[i] = r0_2_one; + setflag_ebt[i] = 1; + count++; + } + + } else if (strcmp(arg[1],"at") == 0) { + if (narg != 10) error->all("Incorrect args for dihedral coefficients"); + + double f1_1_one = force->numeric(arg[2]); + double f2_1_one = force->numeric(arg[3]); + double f3_1_one = force->numeric(arg[4]); + double f1_2_one = force->numeric(arg[5]); + double f2_2_one = force->numeric(arg[6]); + double f3_2_one = force->numeric(arg[7]); + double theta0_1_one = force->numeric(arg[8]); + double theta0_2_one = force->numeric(arg[9]); + + // convert theta0's from degrees to radians + + for (int i = ilo; i <= ihi; i++) { + at_f1_1[i] = f1_1_one; + at_f2_1[i] = f2_1_one; + at_f3_1[i] = f3_1_one; + at_f1_2[i] = f1_2_one; + at_f2_2[i] = f2_2_one; + at_f3_2[i] = f3_2_one; + at_theta0_1[i] = theta0_1_one/180.0 * PI; + at_theta0_2[i] = theta0_2_one/180.0 * PI; + setflag_at[i] = 1; + count++; + } + + } else if (strcmp(arg[1],"aat") == 0) { + if (narg != 5) error->all("Incorrect args for dihedral coefficients"); + + double k_one = force->numeric(arg[2]); + double theta0_1_one = force->numeric(arg[3]); + double theta0_2_one = force->numeric(arg[4]); + + // convert theta0's from degrees to radians + + for (int i = ilo; i <= ihi; i++) { + aat_k[i] = k_one; + aat_theta0_1[i] = theta0_1_one/180.0 * PI; + aat_theta0_2[i] = theta0_2_one/180.0 * PI; + setflag_aat[i] = 1; + count++; + } + + } else if (strcmp(arg[1],"bb13") == 0) { + if (narg != 5) error->all("Incorrect args for dihedral coefficients"); + + double k_one = force->numeric(arg[2]); + double r10_one = force->numeric(arg[3]); + double r30_one = force->numeric(arg[4]); + + for (int i = ilo; i <= ihi; i++) { + bb13t_k[i] = k_one; + bb13t_r10[i] = r10_one; + bb13t_r30[i] = r30_one; + setflag_bb13t[i] = 1; + count++; + } + + } else { if (narg != 7) error->all("Incorrect args for dihedral coefficients"); double k1_one = force->numeric(arg[1]); @@ -687,112 +788,6 @@ void DihedralClass2::coeff(int which, int narg, char **arg) } } - if (which == 1) { - if (narg != 5) error->all("Incorrect args for dihedral coefficients"); - - double f1_one = force->numeric(arg[1]); - double f2_one = force->numeric(arg[2]); - double f3_one = force->numeric(arg[3]); - double r0_one = force->numeric(arg[4]); - - for (int i = ilo; i <= ihi; i++) { - mbt_f1[i] = f1_one; - mbt_f2[i] = f2_one; - mbt_f3[i] = f3_one; - mbt_r0[i] = r0_one; - setflag_mbt[i] = 1; - count++; - } - } - - if (which == 2) { - if (narg != 9) error->all("Incorrect args for dihedral coefficients"); - - double f1_1_one = force->numeric(arg[1]); - double f2_1_one = force->numeric(arg[2]); - double f3_1_one = force->numeric(arg[3]); - double f1_2_one = force->numeric(arg[4]); - double f2_2_one = force->numeric(arg[5]); - double f3_2_one = force->numeric(arg[6]); - double r0_1_one = force->numeric(arg[7]); - double r0_2_one = force->numeric(arg[8]); - - for (int i = ilo; i <= ihi; i++) { - ebt_f1_1[i] = f1_1_one; - ebt_f2_1[i] = f2_1_one; - ebt_f3_1[i] = f3_1_one; - ebt_f1_2[i] = f1_2_one; - ebt_f2_2[i] = f2_2_one; - ebt_f3_2[i] = f3_2_one; - ebt_r0_1[i] = r0_1_one; - ebt_r0_2[i] = r0_2_one; - setflag_ebt[i] = 1; - count++; - } - } - - if (which == 3) { - if (narg != 9) error->all("Incorrect args for dihedral coefficients"); - - double f1_1_one = force->numeric(arg[1]); - double f2_1_one = force->numeric(arg[2]); - double f3_1_one = force->numeric(arg[3]); - double f1_2_one = force->numeric(arg[4]); - double f2_2_one = force->numeric(arg[5]); - double f3_2_one = force->numeric(arg[6]); - double theta0_1_one = force->numeric(arg[7]); - double theta0_2_one = force->numeric(arg[8]); - - // convert theta0's from degrees to radians - - for (int i = ilo; i <= ihi; i++) { - at_f1_1[i] = f1_1_one; - at_f2_1[i] = f2_1_one; - at_f3_1[i] = f3_1_one; - at_f1_2[i] = f1_2_one; - at_f2_2[i] = f2_2_one; - at_f3_2[i] = f3_2_one; - at_theta0_1[i] = theta0_1_one/180.0 * PI; - at_theta0_2[i] = theta0_2_one/180.0 * PI; - setflag_at[i] = 1; - count++; - } - } - - if (which == 4) { - if (narg != 4) error->all("Incorrect args for dihedral coefficients"); - - double k_one = force->numeric(arg[1]); - double theta0_1_one = force->numeric(arg[2]); - double theta0_2_one = force->numeric(arg[3]); - - // convert theta0's from degrees to radians - - for (int i = ilo; i <= ihi; i++) { - aat_k[i] = k_one; - aat_theta0_1[i] = theta0_1_one/180.0 * PI; - aat_theta0_2[i] = theta0_2_one/180.0 * PI; - setflag_aat[i] = 1; - count++; - } - } - - if (which == 5) { - if (narg != 4) error->all("Incorrect args for dihedral coefficients"); - - double k_one = force->numeric(arg[1]); - double r10_one = force->numeric(arg[2]); - double r30_one = force->numeric(arg[3]); - - for (int i = ilo; i <= ihi; i++) { - bb13t_k[i] = k_one; - bb13t_r10[i] = r10_one; - bb13t_r30[i] = r30_one; - setflag_bb13t[i] = 1; - count++; - } - } - if (count == 0) error->all("Incorrect args for dihedral coefficients"); for (int i = ilo; i <= ihi; i++) diff --git a/src/CLASS2/dihedral_class2.h b/src/CLASS2/dihedral_class2.h index b679851c87..09bf894405 100644 --- a/src/CLASS2/dihedral_class2.h +++ b/src/CLASS2/dihedral_class2.h @@ -30,7 +30,7 @@ class DihedralClass2 : public Dihedral { DihedralClass2(class LAMMPS *); ~DihedralClass2(); void compute(int, int); - void coeff(int, int, char **); + void coeff(int, char **); void write_restart(FILE *); void read_restart(FILE *); diff --git a/src/CLASS2/improper_class2.cpp b/src/CLASS2/improper_class2.cpp index 37f7f9aeaf..ff24cb55f1 100644 --- a/src/CLASS2/improper_class2.cpp +++ b/src/CLASS2/improper_class2.cpp @@ -16,6 +16,7 @@ ------------------------------------------------------------------------- */ #include "math.h" +#include "string.h" #include "stdlib.h" #include "improper_class2.h" #include "atom.h" @@ -522,14 +523,13 @@ void ImproperClass2::allocate() /* ---------------------------------------------------------------------- set coeffs for one or more types - which = 0 -> improper coeffs - which = 1 -> AngleAngle coeffs + arg1 = "aa" -> AngleAngle coeffs + else arg1 -> improper coeffs ------------------------------------------------------------------------- */ -void ImproperClass2::coeff(int which, int narg, char **arg) +void ImproperClass2::coeff(int narg, char **arg) { - if (which < 0 || which > 1) - error->all("Invalid coeffs for this improper style"); + if (narg < 2) error->all("Incorrect args for improper coefficients"); if (!allocated) allocate(); int ilo,ihi; @@ -537,31 +537,15 @@ void ImproperClass2::coeff(int which, int narg, char **arg) int count = 0; - if (which == 0) { - if (narg != 3) error->all("Incorrect args for improper coefficients"); + if (strcmp(arg[1],"aa") == 0) { + if (narg != 8) error->all("Incorrect args for improper coefficients"); - double k0_one = force->numeric(arg[1]); - double chi0_one = force->numeric(arg[2]); - - // convert chi0 from degrees to radians - - for (int i = ilo; i <= ihi; i++) { - k0[i] = k0_one; - chi0[i] = chi0_one/180.0 * PI; - setflag_i[i] = 1; - count++; - } - } - - if (which == 1) { - if (narg != 7) error->all("Incorrect args for improper coefficients"); - - double k1_one = force->numeric(arg[1]); - double k2_one = force->numeric(arg[2]); - double k3_one = force->numeric(arg[3]); - double theta0_1_one = force->numeric(arg[4]); - double theta0_2_one = force->numeric(arg[5]); - double theta0_3_one = force->numeric(arg[6]); + double k1_one = force->numeric(arg[2]); + double k2_one = force->numeric(arg[3]); + double k3_one = force->numeric(arg[4]); + double theta0_1_one = force->numeric(arg[5]); + double theta0_2_one = force->numeric(arg[6]); + double theta0_3_one = force->numeric(arg[7]); // convert theta0's from degrees to radians @@ -575,6 +559,21 @@ void ImproperClass2::coeff(int which, int narg, char **arg) setflag_aa[i] = 1; count++; } + + } else { + if (narg != 3) error->all("Incorrect args for improper coefficients"); + + double k0_one = force->numeric(arg[1]); + double chi0_one = force->numeric(arg[2]); + + // convert chi0 from degrees to radians + + for (int i = ilo; i <= ihi; i++) { + k0[i] = k0_one; + chi0[i] = chi0_one/180.0 * PI; + setflag_i[i] = 1; + count++; + } } if (count == 0) error->all("Incorrect args for improper coefficients"); diff --git a/src/CLASS2/improper_class2.h b/src/CLASS2/improper_class2.h index 93cbdc8416..56c7c9d14a 100644 --- a/src/CLASS2/improper_class2.h +++ b/src/CLASS2/improper_class2.h @@ -30,7 +30,7 @@ class ImproperClass2 : public Improper { ImproperClass2(class LAMMPS *); ~ImproperClass2(); void compute(int, int); - void coeff(int, int, char **); + void coeff(int, char **); void write_restart(FILE *); void read_restart(FILE *); diff --git a/src/MOLECULE/angle_charmm.cpp b/src/MOLECULE/angle_charmm.cpp index 981cfd67df..2dbad318f9 100644 --- a/src/MOLECULE/angle_charmm.cpp +++ b/src/MOLECULE/angle_charmm.cpp @@ -191,9 +191,8 @@ void AngleCharmm::allocate() set coeffs for one type ------------------------------------------------------------------------- */ -void AngleCharmm::coeff(int which, int narg, char **arg) +void AngleCharmm::coeff(int narg, char **arg) { - if (which > 0) return; if (narg != 5) error->all("Incorrect args for angle coefficients"); if (!allocated) allocate(); diff --git a/src/MOLECULE/angle_charmm.h b/src/MOLECULE/angle_charmm.h index feb0881861..81d23867b6 100644 --- a/src/MOLECULE/angle_charmm.h +++ b/src/MOLECULE/angle_charmm.h @@ -30,7 +30,7 @@ class AngleCharmm : public Angle { AngleCharmm(class LAMMPS *); ~AngleCharmm(); void compute(int, int); - void coeff(int, int, char **); + void coeff(int, char **); double equilibrium_angle(int); void write_restart(FILE *); void read_restart(FILE *); diff --git a/src/MOLECULE/angle_cosine.cpp b/src/MOLECULE/angle_cosine.cpp index 8b44138ae2..5f331b2142 100644 --- a/src/MOLECULE/angle_cosine.cpp +++ b/src/MOLECULE/angle_cosine.cpp @@ -150,9 +150,8 @@ void AngleCosine::allocate() set coeffs for one type ------------------------------------------------------------------------- */ -void AngleCosine::coeff(int which, int narg, char **arg) +void AngleCosine::coeff(int narg, char **arg) { - if (which > 0) return; if (narg != 2) error->all("Incorrect args for angle coefficients"); if (!allocated) allocate(); diff --git a/src/MOLECULE/angle_cosine.h b/src/MOLECULE/angle_cosine.h index cb6b72bc9f..1f4aabe456 100644 --- a/src/MOLECULE/angle_cosine.h +++ b/src/MOLECULE/angle_cosine.h @@ -30,7 +30,7 @@ class AngleCosine : public Angle { AngleCosine(class LAMMPS *); ~AngleCosine(); void compute(int, int); - void coeff(int, int, char **); + void coeff(int, char **); double equilibrium_angle(int); void write_restart(FILE *); void read_restart(FILE *); diff --git a/src/MOLECULE/angle_cosine_periodic.cpp b/src/MOLECULE/angle_cosine_periodic.cpp index 9c17021a89..c9e55b3f12 100644 --- a/src/MOLECULE/angle_cosine_periodic.cpp +++ b/src/MOLECULE/angle_cosine_periodic.cpp @@ -198,9 +198,8 @@ void AngleCosinePeriodic::allocate() set coeffs for one or more types ------------------------------------------------------------------------- */ -void AngleCosinePeriodic::coeff(int which, int narg, char **arg) +void AngleCosinePeriodic::coeff(int narg, char **arg) { - if (which > 0) return; if (narg != 4) error->all("Incorrect args for angle coefficients"); if (!allocated) allocate(); diff --git a/src/MOLECULE/angle_cosine_periodic.h b/src/MOLECULE/angle_cosine_periodic.h index a871a4a2da..4fb901ebe5 100644 --- a/src/MOLECULE/angle_cosine_periodic.h +++ b/src/MOLECULE/angle_cosine_periodic.h @@ -30,7 +30,7 @@ class AngleCosinePeriodic : public Angle { AngleCosinePeriodic(class LAMMPS *); ~AngleCosinePeriodic(); void compute(int, int); - void coeff(int, int, char **); + void coeff(int, char **); double equilibrium_angle(int); void write_restart(FILE *); void read_restart(FILE *); diff --git a/src/MOLECULE/angle_cosine_squared.cpp b/src/MOLECULE/angle_cosine_squared.cpp index 174a4c5baf..bdf978a7d9 100644 --- a/src/MOLECULE/angle_cosine_squared.cpp +++ b/src/MOLECULE/angle_cosine_squared.cpp @@ -162,9 +162,8 @@ void AngleCosineSquared::allocate() set coeffs for one or more types ------------------------------------------------------------------------- */ -void AngleCosineSquared::coeff(int which, int narg, char **arg) +void AngleCosineSquared::coeff(int narg, char **arg) { - if (which > 0) return; if (narg != 3) error->all("Incorrect args for angle coefficients"); if (!allocated) allocate(); diff --git a/src/MOLECULE/angle_cosine_squared.h b/src/MOLECULE/angle_cosine_squared.h index ca138d791e..ee6ce023f2 100644 --- a/src/MOLECULE/angle_cosine_squared.h +++ b/src/MOLECULE/angle_cosine_squared.h @@ -30,7 +30,7 @@ class AngleCosineSquared : public Angle { AngleCosineSquared(class LAMMPS *); virtual ~AngleCosineSquared(); virtual void compute(int, int); - void coeff(int, int, char **); + void coeff(int, char **); double equilibrium_angle(int); void write_restart(FILE *); void read_restart(FILE *); diff --git a/src/MOLECULE/angle_harmonic.cpp b/src/MOLECULE/angle_harmonic.cpp index c3e54788dc..38f8173f8f 100644 --- a/src/MOLECULE/angle_harmonic.cpp +++ b/src/MOLECULE/angle_harmonic.cpp @@ -162,9 +162,8 @@ void AngleHarmonic::allocate() set coeffs for one or more types ------------------------------------------------------------------------- */ -void AngleHarmonic::coeff(int which, int narg, char **arg) +void AngleHarmonic::coeff(int narg, char **arg) { - if (which > 0) return; if (narg != 3) error->all("Incorrect args for angle coefficients"); if (!allocated) allocate(); diff --git a/src/MOLECULE/angle_harmonic.h b/src/MOLECULE/angle_harmonic.h index 7df64a9313..f91a84f7fa 100644 --- a/src/MOLECULE/angle_harmonic.h +++ b/src/MOLECULE/angle_harmonic.h @@ -30,7 +30,7 @@ class AngleHarmonic : public Angle { AngleHarmonic(class LAMMPS *); ~AngleHarmonic(); void compute(int, int); - void coeff(int, int, char **); + void coeff(int, char **); double equilibrium_angle(int); void write_restart(FILE *); void read_restart(FILE *); diff --git a/src/MOLECULE/angle_hybrid.cpp b/src/MOLECULE/angle_hybrid.cpp index 08b35de0ec..ba9ed9ee96 100644 --- a/src/MOLECULE/angle_hybrid.cpp +++ b/src/MOLECULE/angle_hybrid.cpp @@ -234,7 +234,7 @@ void AngleHybrid::settings(int narg, char **arg) set coeffs for one type ---------------------------------------------------------------------- */ -void AngleHybrid::coeff(int which, int narg, char **arg) +void AngleHybrid::coeff(int narg, char **arg) { if (!allocated) allocate(); @@ -261,7 +261,7 @@ void AngleHybrid::coeff(int which, int narg, char **arg) // invoke sub-style coeff() starting with 1st arg - if (!none) styles[m]->coeff(which,narg-1,&arg[1]); + if (!none) styles[m]->coeff(narg-1,&arg[1]); // set setflag and which type maps to which sub-style // if sub-style is none: set hybrid setflag, wipe out map diff --git a/src/MOLECULE/angle_hybrid.h b/src/MOLECULE/angle_hybrid.h index 4884ef754f..9671e3a6cd 100644 --- a/src/MOLECULE/angle_hybrid.h +++ b/src/MOLECULE/angle_hybrid.h @@ -31,7 +31,7 @@ class AngleHybrid : public Angle { ~AngleHybrid(); void compute(int, int); void settings(int, char **); - void coeff(int, int, char **); + void coeff(int, char **); double equilibrium_angle(int); void write_restart(FILE *); void read_restart(FILE *); diff --git a/src/MOLECULE/angle_table.cpp b/src/MOLECULE/angle_table.cpp index 034db79e7e..046ec5f03d 100644 --- a/src/MOLECULE/angle_table.cpp +++ b/src/MOLECULE/angle_table.cpp @@ -211,9 +211,8 @@ void AngleTable::settings(int narg, char **arg) set coeffs for one or more type pairs ------------------------------------------------------------------------- */ -void AngleTable::coeff(int which, int narg, char **arg) +void AngleTable::coeff(int narg, char **arg) { - if (which > 0) return; if (narg != 3) error->all("Illegal angle_coeff command"); if (!allocated) allocate(); diff --git a/src/MOLECULE/angle_table.h b/src/MOLECULE/angle_table.h index 452ae13e13..23ce4874ca 100644 --- a/src/MOLECULE/angle_table.h +++ b/src/MOLECULE/angle_table.h @@ -31,7 +31,7 @@ class AngleTable : public Angle { ~AngleTable(); void compute(int, int); void settings(int, char **); - void coeff(int, int, char **); + void coeff(int, char **); double equilibrium_angle(int); void write_restart(FILE *); void read_restart(FILE *); diff --git a/src/MOLECULE/dihedral_charmm.cpp b/src/MOLECULE/dihedral_charmm.cpp index d1878beb1a..f2b7d4945f 100644 --- a/src/MOLECULE/dihedral_charmm.cpp +++ b/src/MOLECULE/dihedral_charmm.cpp @@ -325,9 +325,8 @@ void DihedralCharmm::allocate() set coeffs for one type ------------------------------------------------------------------------- */ -void DihedralCharmm::coeff(int which, int narg, char **arg) +void DihedralCharmm::coeff(int narg, char **arg) { - if (which > 0) return; if (narg != 5) error->all("Incorrect args for dihedral coefficients"); if (!allocated) allocate(); diff --git a/src/MOLECULE/dihedral_charmm.h b/src/MOLECULE/dihedral_charmm.h index 1833cda6a9..f999ec2c22 100644 --- a/src/MOLECULE/dihedral_charmm.h +++ b/src/MOLECULE/dihedral_charmm.h @@ -30,7 +30,7 @@ class DihedralCharmm : public Dihedral { DihedralCharmm(class LAMMPS *); ~DihedralCharmm(); void compute(int, int); - void coeff(int, int, char **); + void coeff(int, char **); void init_style(); void write_restart(FILE *); void read_restart(FILE *); diff --git a/src/MOLECULE/dihedral_harmonic.cpp b/src/MOLECULE/dihedral_harmonic.cpp index 17f7dbf9cb..6e76a66dd8 100644 --- a/src/MOLECULE/dihedral_harmonic.cpp +++ b/src/MOLECULE/dihedral_harmonic.cpp @@ -272,9 +272,8 @@ void DihedralHarmonic::allocate() set coeffs for one type ------------------------------------------------------------------------- */ -void DihedralHarmonic::coeff(int which, int narg, char **arg) +void DihedralHarmonic::coeff(int narg, char **arg) { - if (which > 0) return; if (narg != 4) error->all("Incorrect args for dihedral coefficients"); if (!allocated) allocate(); diff --git a/src/MOLECULE/dihedral_harmonic.h b/src/MOLECULE/dihedral_harmonic.h index 64a1e96e24..959159d475 100644 --- a/src/MOLECULE/dihedral_harmonic.h +++ b/src/MOLECULE/dihedral_harmonic.h @@ -30,7 +30,7 @@ class DihedralHarmonic : public Dihedral { DihedralHarmonic(class LAMMPS *); ~DihedralHarmonic(); void compute(int, int); - void coeff(int, int, char **); + void coeff(int, char **); void write_restart(FILE *); void read_restart(FILE *); diff --git a/src/MOLECULE/dihedral_helix.cpp b/src/MOLECULE/dihedral_helix.cpp index ce12bcca16..f5b56b3e46 100644 --- a/src/MOLECULE/dihedral_helix.cpp +++ b/src/MOLECULE/dihedral_helix.cpp @@ -281,9 +281,8 @@ void DihedralHelix::allocate() set coeffs from one line in input script ------------------------------------------------------------------------- */ -void DihedralHelix::coeff(int which, int narg, char **arg) +void DihedralHelix::coeff(int narg, char **arg) { - if (which > 0) return; if (narg != 4) error->all("Incorrect args for dihedral coefficients"); if (!allocated) allocate(); diff --git a/src/MOLECULE/dihedral_helix.h b/src/MOLECULE/dihedral_helix.h index df51d2b2dc..f0bfabf1d8 100644 --- a/src/MOLECULE/dihedral_helix.h +++ b/src/MOLECULE/dihedral_helix.h @@ -30,7 +30,7 @@ class DihedralHelix : public Dihedral { DihedralHelix(class LAMMPS *); ~DihedralHelix(); void compute(int, int); - void coeff(int, int, char **); + void coeff(int, char **); void write_restart(FILE *); void read_restart(FILE *); diff --git a/src/MOLECULE/dihedral_hybrid.cpp b/src/MOLECULE/dihedral_hybrid.cpp index 31d6990ae5..dde226fae2 100644 --- a/src/MOLECULE/dihedral_hybrid.cpp +++ b/src/MOLECULE/dihedral_hybrid.cpp @@ -184,7 +184,7 @@ void DihedralHybrid::settings(int narg, char **arg) set coeffs for one type ---------------------------------------------------------------------- */ -void DihedralHybrid::coeff(int which, int narg, char **arg) +void DihedralHybrid::coeff(int narg, char **arg) { if (!allocated) allocate(); @@ -211,7 +211,7 @@ void DihedralHybrid::coeff(int which, int narg, char **arg) // invoke sub-style coeff() starting with 1st arg - if (!none) styles[m]->coeff(which,narg-1,&arg[1]); + if (!none) styles[m]->coeff(narg-1,&arg[1]); // set setflag and which type maps to which sub-style // if sub-style is none: set hybrid setflag, wipe out map diff --git a/src/MOLECULE/dihedral_hybrid.h b/src/MOLECULE/dihedral_hybrid.h index 129c4dceab..551a49d775 100644 --- a/src/MOLECULE/dihedral_hybrid.h +++ b/src/MOLECULE/dihedral_hybrid.h @@ -31,7 +31,7 @@ class DihedralHybrid : public Dihedral { ~DihedralHybrid(); void compute(int, int); void settings(int, char **); - void coeff(int, int, char **); + void coeff(int, char **); void init_style(); void write_restart(FILE *); void read_restart(FILE *); diff --git a/src/MOLECULE/dihedral_multi_harmonic.cpp b/src/MOLECULE/dihedral_multi_harmonic.cpp index 4eb323ba85..e9758cf47e 100644 --- a/src/MOLECULE/dihedral_multi_harmonic.cpp +++ b/src/MOLECULE/dihedral_multi_harmonic.cpp @@ -270,9 +270,8 @@ void DihedralMultiHarmonic::allocate() set coeffs for one type ------------------------------------------------------------------------- */ -void DihedralMultiHarmonic::coeff(int which, int narg, char **arg) +void DihedralMultiHarmonic::coeff(int narg, char **arg) { - if (which > 0) return; if (narg != 6) error->all("Incorrect args for dihedral coefficients"); if (!allocated) allocate(); diff --git a/src/MOLECULE/dihedral_multi_harmonic.h b/src/MOLECULE/dihedral_multi_harmonic.h index 67bd4a33e7..851eda9cf4 100644 --- a/src/MOLECULE/dihedral_multi_harmonic.h +++ b/src/MOLECULE/dihedral_multi_harmonic.h @@ -30,7 +30,7 @@ class DihedralMultiHarmonic : public Dihedral { DihedralMultiHarmonic(class LAMMPS *); ~DihedralMultiHarmonic(); void compute(int, int); - void coeff(int, int, char **); + void coeff(int, char **); void write_restart(FILE *); void read_restart(FILE *); diff --git a/src/MOLECULE/dihedral_opls.cpp b/src/MOLECULE/dihedral_opls.cpp index e4d0e5327b..bb3579e1cb 100644 --- a/src/MOLECULE/dihedral_opls.cpp +++ b/src/MOLECULE/dihedral_opls.cpp @@ -283,9 +283,8 @@ void DihedralOPLS::allocate() set coeffs for one type ------------------------------------------------------------------------- */ -void DihedralOPLS::coeff(int which, int narg, char **arg) +void DihedralOPLS::coeff(int narg, char **arg) { - if (which > 0) return; if (narg != 5) error->all("Incorrect args for dihedral coefficients"); if (!allocated) allocate(); diff --git a/src/MOLECULE/dihedral_opls.h b/src/MOLECULE/dihedral_opls.h index d4ec3f8b7d..ab3d5c1da0 100644 --- a/src/MOLECULE/dihedral_opls.h +++ b/src/MOLECULE/dihedral_opls.h @@ -30,7 +30,7 @@ class DihedralOPLS : public Dihedral { DihedralOPLS(class LAMMPS *); ~DihedralOPLS(); void compute(int, int); - void coeff(int, int, char **); + void coeff(int, char **); void write_restart(FILE *); void read_restart(FILE *); diff --git a/src/MOLECULE/improper_cvff.cpp b/src/MOLECULE/improper_cvff.cpp index 6cbf7e8876..6ce9e7fd56 100644 --- a/src/MOLECULE/improper_cvff.cpp +++ b/src/MOLECULE/improper_cvff.cpp @@ -292,9 +292,8 @@ void ImproperCvff::allocate() set coeffs for one type ------------------------------------------------------------------------- */ -void ImproperCvff::coeff(int which, int narg, char **arg) +void ImproperCvff::coeff(int narg, char **arg) { - if (which > 0) return; if (narg != 4) error->all("Incorrect args for improper coefficients"); if (!allocated) allocate(); diff --git a/src/MOLECULE/improper_cvff.h b/src/MOLECULE/improper_cvff.h index b7636edb20..ccef917d3a 100644 --- a/src/MOLECULE/improper_cvff.h +++ b/src/MOLECULE/improper_cvff.h @@ -30,7 +30,7 @@ class ImproperCvff : public Improper { ImproperCvff(class LAMMPS *); ~ImproperCvff(); void compute(int, int); - void coeff(int, int, char **); + void coeff(int, char **); void write_restart(FILE *); void read_restart(FILE *); diff --git a/src/MOLECULE/improper_harmonic.cpp b/src/MOLECULE/improper_harmonic.cpp index 008b73e8d1..4487b9e7a4 100644 --- a/src/MOLECULE/improper_harmonic.cpp +++ b/src/MOLECULE/improper_harmonic.cpp @@ -230,9 +230,8 @@ void ImproperHarmonic::allocate() set coeffs for one type ------------------------------------------------------------------------- */ -void ImproperHarmonic::coeff(int which, int narg, char **arg) +void ImproperHarmonic::coeff(int narg, char **arg) { - if (which > 0) return; if (narg != 3) error->all("Incorrect args for improper coefficients"); if (!allocated) allocate(); diff --git a/src/MOLECULE/improper_harmonic.h b/src/MOLECULE/improper_harmonic.h index 01645cf2a9..a14e222d60 100644 --- a/src/MOLECULE/improper_harmonic.h +++ b/src/MOLECULE/improper_harmonic.h @@ -30,7 +30,7 @@ class ImproperHarmonic : public Improper { ImproperHarmonic(class LAMMPS *); ~ImproperHarmonic(); void compute(int, int); - void coeff(int, int, char **); + void coeff(int, char **); void write_restart(FILE *); void read_restart(FILE *); diff --git a/src/MOLECULE/improper_hybrid.cpp b/src/MOLECULE/improper_hybrid.cpp index 424df3c3e6..4e83f8b5b7 100644 --- a/src/MOLECULE/improper_hybrid.cpp +++ b/src/MOLECULE/improper_hybrid.cpp @@ -184,7 +184,7 @@ void ImproperHybrid::settings(int narg, char **arg) set coeffs for one type ---------------------------------------------------------------------- */ -void ImproperHybrid::coeff(int which, int narg, char **arg) +void ImproperHybrid::coeff(int narg, char **arg) { if (!allocated) allocate(); @@ -211,7 +211,7 @@ void ImproperHybrid::coeff(int which, int narg, char **arg) // invoke sub-style coeff() starting with 1st arg - if (!none) styles[m]->coeff(which,narg-1,&arg[1]); + if (!none) styles[m]->coeff(narg-1,&arg[1]); // set setflag and which type maps to which sub-style // if sub-style is none: set hybrid setflag, wipe out map diff --git a/src/MOLECULE/improper_hybrid.h b/src/MOLECULE/improper_hybrid.h index 3e0639f750..ceb75d0100 100644 --- a/src/MOLECULE/improper_hybrid.h +++ b/src/MOLECULE/improper_hybrid.h @@ -31,7 +31,7 @@ class ImproperHybrid : public Improper { ~ImproperHybrid(); void compute(int, int); void settings(int, char **); - void coeff(int, int, char **); + void coeff(int, char **); void write_restart(FILE *); void read_restart(FILE *); double memory_usage(); diff --git a/src/MOLECULE/improper_umbrella.cpp b/src/MOLECULE/improper_umbrella.cpp index 631c712b8f..9d2cc9cbac 100644 --- a/src/MOLECULE/improper_umbrella.cpp +++ b/src/MOLECULE/improper_umbrella.cpp @@ -250,9 +250,8 @@ void ImproperUmbrella::allocate() set coeffs for one type ------------------------------------------------------------------------- */ -void ImproperUmbrella::coeff(int which, int narg, char **arg) +void ImproperUmbrella::coeff(int narg, char **arg) { - if (which > 0) return; if (narg != 3) error->all("Incorrect args for improper coefficients"); if (!allocated) allocate(); diff --git a/src/MOLECULE/improper_umbrella.h b/src/MOLECULE/improper_umbrella.h index 387eaa9eb1..cef7583743 100644 --- a/src/MOLECULE/improper_umbrella.h +++ b/src/MOLECULE/improper_umbrella.h @@ -30,7 +30,7 @@ class ImproperUmbrella : public Improper { ImproperUmbrella(class LAMMPS *); ~ImproperUmbrella(); void compute(int, int); - void coeff(int, int, char **); + void coeff(int, char **); void write_restart(FILE *); void read_restart(FILE *); diff --git a/src/USER-CG-CMM/angle_cg_cmm.cpp b/src/USER-CG-CMM/angle_cg_cmm.cpp index 6b11c70924..6eb8911480 100644 --- a/src/USER-CG-CMM/angle_cg_cmm.cpp +++ b/src/USER-CG-CMM/angle_cg_cmm.cpp @@ -295,9 +295,8 @@ void AngleCGCMM::allocate() set coeffs for one or more types ------------------------------------------------------------------------- */ -void AngleCGCMM::coeff(int which, int narg, char **arg) +void AngleCGCMM::coeff(int narg, char **arg) { - if (which > 0) return; if (narg != 6) error->all("Incorrect args for angle coefficients"); if (!allocated) allocate(); diff --git a/src/USER-CG-CMM/angle_cg_cmm.h b/src/USER-CG-CMM/angle_cg_cmm.h index 02fdadba03..7fef95d5a8 100644 --- a/src/USER-CG-CMM/angle_cg_cmm.h +++ b/src/USER-CG-CMM/angle_cg_cmm.h @@ -31,7 +31,7 @@ class AngleCGCMM : public Angle, public CGCMMParms { AngleCGCMM(class LAMMPS *); ~AngleCGCMM(); void compute(int, int); - void coeff(int, int, char **); + void coeff(int, char **); double equilibrium_angle(int); void write_restart(FILE *); void read_restart(FILE *); diff --git a/src/angle.h b/src/angle.h index db1a6ae02f..99d8dc105f 100644 --- a/src/angle.h +++ b/src/angle.h @@ -32,7 +32,7 @@ class Angle : protected Pointers { virtual void init(); virtual void compute(int, int) = 0; virtual void settings(int, char **) {} - virtual void coeff(int, int, char **) = 0; + virtual void coeff(int, char **) = 0; virtual double equilibrium_angle(int) = 0; virtual void write_restart(FILE *) = 0; virtual void read_restart(FILE *) = 0; diff --git a/src/dihedral.h b/src/dihedral.h index 15866a8bba..2a4feed6b9 100644 --- a/src/dihedral.h +++ b/src/dihedral.h @@ -33,7 +33,7 @@ class Dihedral : protected Pointers { virtual void init_style() {} virtual void compute(int, int) = 0; virtual void settings(int, char **) {} - virtual void coeff(int, int, char **) = 0; + virtual void coeff(int, char **) = 0; virtual void write_restart(FILE *) = 0; virtual void read_restart(FILE *) = 0; virtual double memory_usage(); diff --git a/src/improper.h b/src/improper.h index acc4771e63..711f124c20 100644 --- a/src/improper.h +++ b/src/improper.h @@ -32,7 +32,7 @@ class Improper : protected Pointers { virtual void init(); virtual void compute(int, int) = 0; virtual void settings(int, char **) {} - virtual void coeff(int, int, char **) = 0; + virtual void coeff(int, char **) = 0; virtual void write_restart(FILE *) = 0; virtual void read_restart(FILE *) = 0; virtual double memory_usage(); diff --git a/src/input.cpp b/src/input.cpp index 82daa8d5e0..df4a2dfd7e 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -727,7 +727,7 @@ void Input::angle_coeff() error->all("Angle_coeff command before angle_style is defined"); if (atom->avec->angles_allow == 0) error->all("Angle_coeff command when no angles allowed"); - force->angle->coeff(0,narg,arg); + force->angle->coeff(narg,arg); } /* ---------------------------------------------------------------------- */ @@ -830,7 +830,7 @@ void Input::dihedral_coeff() error->all("Dihedral_coeff command before dihedral_style is defined"); if (atom->avec->dihedrals_allow == 0) error->all("Dihedral_coeff command when no dihedrals allowed"); - force->dihedral->coeff(0,narg,arg); + force->dihedral->coeff(narg,arg); } /* ---------------------------------------------------------------------- */ @@ -917,7 +917,7 @@ void Input::improper_coeff() error->all("Improper_coeff command before improper_style is defined"); if (atom->avec->impropers_allow == 0) error->all("Improper_coeff command when no impropers allowed"); - force->improper->coeff(0,narg,arg); + force->improper->coeff(narg,arg); } /* ---------------------------------------------------------------------- */ diff --git a/src/read_data.cpp b/src/read_data.cpp index 11e36fc830..1e769eda3c 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -36,7 +36,7 @@ using namespace LAMMPS_NS; #define MAXLINE 256 #define LB_FACTOR 1.1 #define CHUNK 1024 -#define DELTA 4 +#define DELTA 4 // must be 2 or larger #define NSECTIONS 22 // change when add to header::section_keywords @@ -813,7 +813,7 @@ void ReadData::paircoeffs() for (i = 0; i < atom->ntypes; i++) { m = strlen(buf) + 1; - parse_coeffs(1,buf); + parse_coeffs(buf,NULL,1); force->pair->coeff(narg,arg); buf += m; } @@ -844,7 +844,7 @@ void ReadData::bondcoeffs() for (i = 0; i < atom->nbondtypes; i++) { m = strlen(buf) + 1; - parse_coeffs(0,buf); + parse_coeffs(buf,NULL,0); force->bond->coeff(narg,arg); buf += m; } @@ -875,8 +875,10 @@ void ReadData::anglecoeffs(int which) for (i = 0; i < atom->nangletypes; i++) { m = strlen(buf) + 1; - parse_coeffs(0,buf); - force->angle->coeff(which,narg,arg); + if (which == 0) parse_coeffs(buf,NULL,0); + else if (which == 1) parse_coeffs(buf,"bb",0); + else if (which == 2) parse_coeffs(buf,"ba",0); + force->angle->coeff(narg,arg); buf += m; } delete [] original; @@ -906,8 +908,13 @@ void ReadData::dihedralcoeffs(int which) for (i = 0; i < atom->ndihedraltypes; i++) { m = strlen(buf) + 1; - parse_coeffs(0,buf); - force->dihedral->coeff(which,narg,arg); + if (which == 0) parse_coeffs(buf,NULL,0); + else if (which == 1) parse_coeffs(buf,"mbt",0); + else if (which == 2) parse_coeffs(buf,"ebt",0); + else if (which == 3) parse_coeffs(buf,"at",0); + else if (which == 4) parse_coeffs(buf,"aat",0); + else if (which == 5) parse_coeffs(buf,"bb13",0); + force->dihedral->coeff(narg,arg); buf += m; } delete [] original; @@ -937,8 +944,9 @@ void ReadData::impropercoeffs(int which) for (i = 0; i < atom->nimpropertypes; i++) { m = strlen(buf) + 1; - parse_coeffs(0,buf); - force->improper->coeff(which,narg,arg); + if (which == 0) parse_coeffs(buf,NULL,0); + else if (which == 1) parse_coeffs(buf,"aa",0); + force->improper->coeff(narg,arg); buf += m; } delete [] original; @@ -1314,10 +1322,11 @@ void ReadData::skip_lines(int n) parse a line of coeffs into words, storing them in narg,arg trim anything from '#' onward word strings remain in line, are not copied - if addflag, duplicate 1st word, so pair_coeff "2" looks like "2 2" + if addstr != NULL, add addstr as 2nd arg for class2 angle/dihedral/improper + if dupflag, duplicate 1st word, so pair_coeff "2" becomes "2 2" ------------------------------------------------------------------------- */ -void ReadData::parse_coeffs(int addflag, char *line) +void ReadData::parse_coeffs(char *line, char *addstr, int dupflag) { char *ptr; if (ptr = strchr(line,'#')) *ptr = '\0'; @@ -1331,7 +1340,8 @@ void ReadData::parse_coeffs(int addflag, char *line) memory->srealloc(arg,maxarg*sizeof(char *),"read_data:arg"); } arg[narg++] = word; - if (addflag && narg == 1) continue; + if (addstr && narg == 1) arg[narg++] = addstr; + if (dupflag && narg == 1) arg[narg++] = word; word = strtok(NULL," \t\n\r\f"); } } diff --git a/src/read_data.h b/src/read_data.h index f0f85792e1..6f0dfacd71 100644 --- a/src/read_data.h +++ b/src/read_data.h @@ -44,7 +44,7 @@ class ReadData : protected Pointers { void header(int); void parse_keyword(int, int); void skip_lines(int); - void parse_coeffs(int, char *); + void parse_coeffs(char *, char *, int); void atoms(); void velocities();