Commit ccca80a6 authored by Steve Plimpton's avatar Steve Plimpton
Browse files

changes to enable atom_style hybrid to work

parent 4f6cb135
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -35,21 +35,21 @@ AtomVecDipole::AtomVecDipole(LAMMPS *lmp) : AtomVec(lmp)

  // strings with peratom variables to include in each AtomVec method
  // strings cannot contain fields in corresponding AtomVec default strings
  // order of fields in the string does not matter
  //   except fields_data_atom and fields_data_vel which must match data file
  // order of fields in a string does not matter
  // except: fields_data_atom & fields_data_vel must match data file

  fields_grow = (char *) "q mu";
  fields_copy = (char *) "q mu";
  fields_comm = (char *) "mu3";
  fields_comm_vel = (char *) "mu3";
  fields_reverse = NULL;
  fields_reverse = (char *) "";
  fields_border = (char *) "q mu";
  fields_border_vel = (char *) "q mu";
  fields_exchange = (char *) "q mu";
  fields_restart = (char *) "q mu";
  fields_create = (char *) "q mu";
  fields_data_atom = (char *) "id type q x mu3";
  fields_data_vel = NULL;
  fields_data_vel = (char *) "id v";

  setup_fields();
}
+18 −18
Original line number Diff line number Diff line
@@ -28,8 +28,8 @@ AtomVecAngle::AtomVecAngle(LAMMPS *lmp) : AtomVec(lmp)

  // strings with peratom variables to include in each AtomVec method
  // strings cannot contain fields in corresponding AtomVec default strings
  // order of fields in the string does not matter
  //   except fields_data_atom and fields_data_vel which must match data file
  // order of fields in a string does not matter
  // except: fields_data_atom & fields_data_vel must match data file

  fields_grow = (char *) 
    "molecule num_bond bond_type bond_atom "
@@ -37,9 +37,9 @@ AtomVecAngle::AtomVecAngle(LAMMPS *lmp) : AtomVec(lmp)
  fields_copy = (char *)
    "molecule num_bond bond_type bond_atom "
    "num_angle angle_type angle_atom1 angle_atom2 angle_atom3 nspecial special";
  fields_comm = NULL;
  fields_comm_vel = NULL;
  fields_reverse = NULL;
  fields_comm = (char *) "";
  fields_comm_vel = (char *) "";
  fields_reverse = (char *) "";
  fields_border = (char *) "molecule";
  fields_border_vel = (char *) "molecule";
  fields_exchange = (char *)
@@ -50,7 +50,7 @@ AtomVecAngle::AtomVecAngle(LAMMPS *lmp) : AtomVec(lmp)
    "num_angle angle_type angle_atom1 angle_atom2 angle_atom3";
  fields_create = (char *) "molecule num_bond num_angle nspecial";
  fields_data_atom = (char *) "id molecule type x";
  fields_data_vel = NULL;
  fields_data_vel = (char *) "id v";

  setup_fields();

@@ -70,7 +70,7 @@ AtomVecAngle::~AtomVecAngle()
   modify values for AtomVec::pack_restart() to pack
------------------------------------------------------------------------- */

void AtomVecAngle::pack_restart_pre(int i)
void AtomVecAngle::pack_restart_pre(int ilocal)
{
  // insure negative vectors are needed length

@@ -93,19 +93,19 @@ void AtomVecAngle::pack_restart_pre(int i)
  int **angle_type = atom->angle_type;

  int any_bond_negative = 0;
  for (int m = 0; m < num_bond[i]; m++) {
    if (bond_type[i][m] < 0) {
  for (int m = 0; m < num_bond[ilocal]; m++) {
    if (bond_type[ilocal][m] < 0) {
      bond_negative[m] = 1;
      bond_type[i][m] = -bond_type[i][m];
      bond_type[ilocal][m] = -bond_type[ilocal][m];
      any_bond_negative = 1;
    } else bond_negative[m] = 0;
  }

  int any_angle_negative = 0;
  for (int m = 0; m < num_angle[i]; m++) {
    if (angle_type[i][m] < 0) {
  for (int m = 0; m < num_angle[ilocal]; m++) {
    if (angle_type[ilocal][m] < 0) {
      angle_negative[m] = 1;
      angle_type[i][m] = -angle_type[i][m];
      angle_type[ilocal][m] = -angle_type[ilocal][m];
      any_angle_negative = 1;
    } else angle_negative[m] = 0;
  }
@@ -115,22 +115,22 @@ void AtomVecAngle::pack_restart_pre(int i)
   unmodify values packed by AtomVec::pack_restart()
------------------------------------------------------------------------- */

void AtomVecAngle::pack_restart_post(int i)
void AtomVecAngle::pack_restart_post(int ilocal)
{
  // restore the flagged types to their negative values

  if (any_bond_negative) {
    int *num_bond = atom->num_bond;
    int **bond_type = atom->bond_type;
    for (int m = 0; m < num_bond[i]; m++)
      if (bond_negative[m]) bond_type[i][m] = -bond_type[i][m];
    for (int m = 0; m < num_bond[ilocal]; m++)
      if (bond_negative[m]) bond_type[ilocal][m] = -bond_type[ilocal][m];
  }

  if (any_angle_negative) {
    int *num_angle = atom->num_angle;
    int **angle_type = atom->angle_type;
    for (int m = 0; m < num_angle[i]; m++)
      if (angle_negative[m]) angle_type[i][m] = -angle_type[i][m];
    for (int m = 0; m < num_angle[ilocal]; m++)
      if (angle_negative[m]) angle_type[ilocal][m] = -angle_type[ilocal][m];
  }
}

+13 −13
Original line number Diff line number Diff line
@@ -28,16 +28,16 @@ AtomVecBond::AtomVecBond(LAMMPS *lmp) : AtomVec(lmp)

  // strings with peratom variables to include in each AtomVec method
  // strings cannot contain fields in corresponding AtomVec default strings
  // order of fields in the string does not matter
  //   except fields_data_atom and fields_data_vel which must match data file
  // order of fields in a string does not matter
  // except: fields_data_atom & fields_data_vel must match data file

  fields_grow = (char *) 
    "molecule num_bond bond_type bond_atom nspecial special";
  fields_copy = (char *)
    "molecule num_bond bond_type bond_atom nspecial special";
  fields_comm = NULL;
  fields_comm_vel = NULL;
  fields_reverse = NULL;
  fields_comm = (char *) "";
  fields_comm_vel = (char *) "";
  fields_reverse = (char *) "";
  fields_border = (char *) "molecule";
  fields_border_vel = (char *) "molecule";
  fields_exchange = (char *)
@@ -45,7 +45,7 @@ AtomVecBond::AtomVecBond(LAMMPS *lmp) : AtomVec(lmp)
  fields_restart = (char *) "molecule num_bond bond_type bond_atom";
  fields_create = (char *) "molecule num_bond nspecial";
  fields_data_atom = (char *) "id molecule type x";
  fields_data_vel = NULL;
  fields_data_vel = (char *) "id v";

  setup_fields();

@@ -64,7 +64,7 @@ AtomVecBond::~AtomVecBond()
   modify values for AtomVec::pack_restart() to pack
------------------------------------------------------------------------- */

void AtomVecBond::pack_restart_pre(int i)
void AtomVecBond::pack_restart_pre(int ilocal)
{
  // insure bond_negative vector is needed length

@@ -80,10 +80,10 @@ void AtomVecBond::pack_restart_pre(int i)
  int **bond_type = atom->bond_type;

  any_bond_negative = 0;
  for (int m = 0; m < num_bond[i]; m++) {
    if (bond_type[i][m] < 0) {
  for (int m = 0; m < num_bond[ilocal]; m++) {
    if (bond_type[ilocal][m] < 0) {
      bond_negative[m] = 1;
      bond_type[i][m] = -bond_type[i][m];
      bond_type[ilocal][m] = -bond_type[ilocal][m];
      any_bond_negative = 1;
    } else bond_negative[m] = 0;
  }
@@ -93,15 +93,15 @@ void AtomVecBond::pack_restart_pre(int i)
   unmodify values packed by AtomVec::pack_restart()
------------------------------------------------------------------------- */

void AtomVecBond::pack_restart_post(int i)
void AtomVecBond::pack_restart_post(int ilocal)
{
  // restore the flagged types to their negative values

  if (any_bond_negative) {
    int *num_bond = atom->num_bond;
    int **bond_type = atom->bond_type;
    for (int m = 0; m < num_bond[i]; m++)
      if (bond_negative[m]) bond_type[i][m] = -bond_type[i][m];
    for (int m = 0; m < num_bond[ilocal]; m++)
      if (bond_negative[m]) bond_type[ilocal][m] = -bond_type[ilocal][m];
  }
}

+30 −28
Original line number Diff line number Diff line
@@ -28,8 +28,8 @@ AtomVecFull::AtomVecFull(LAMMPS *lmp) : AtomVec(lmp)

  // strings with peratom variables to include in each AtomVec method
  // strings cannot contain fields in corresponding AtomVec default strings
  // order of fields in the string does not matter
  //   except fields_data_atom and fields_data_vel which must match data file
  // order of fields in a string does not matter
  // except: fields_data_atom & fields_data_vel must match data file

  fields_grow = (char *) 
    "q molecule num_bond bond_type bond_atom "
@@ -47,9 +47,9 @@ AtomVecFull::AtomVecFull(LAMMPS *lmp) : AtomVec(lmp)
    "num_improper improper_type improper_atom1 improper_atom2 "
    "improper_atom3 improper_atom4 "
    "nspecial special";
  fields_comm = NULL;
  fields_comm_vel = NULL;
  fields_reverse = NULL;
  fields_comm = (char *) "";
  fields_comm_vel = (char *) "";
  fields_reverse = (char *) "";
  fields_border = (char *) "q molecule";
  fields_border_vel = (char *) "q molecule";
  fields_exchange = (char *)
@@ -70,7 +70,7 @@ AtomVecFull::AtomVecFull(LAMMPS *lmp) : AtomVec(lmp)
  fields_create = (char *) 
    "q molecule num_bond num_angle num_dihedral num_improper nspecial";
  fields_data_atom = (char *) "id molecule type q x";
  fields_data_vel = NULL;
  fields_data_vel = (char *) "id v";

  setup_fields();

@@ -92,7 +92,7 @@ AtomVecFull::~AtomVecFull()
   modify values for AtomVec::pack_restart() to pack
------------------------------------------------------------------------- */

void AtomVecFull::pack_restart_pre(int i)
void AtomVecFull::pack_restart_pre(int ilocal)
{
  // insure negative vectors are needed length

@@ -129,37 +129,37 @@ void AtomVecFull::pack_restart_pre(int i)
  int **improper_type = atom->improper_type;

  int any_bond_negative = 0;
  for (int m = 0; m < num_bond[i]; m++) {
    if (bond_type[i][m] < 0) {
  for (int m = 0; m < num_bond[ilocal]; m++) {
    if (bond_type[ilocal][m] < 0) {
      bond_negative[m] = 1;
      bond_type[i][m] = -bond_type[i][m];
      bond_type[ilocal][m] = -bond_type[ilocal][m];
      any_bond_negative = 1;
    } else bond_negative[m] = 0;
  }

  int any_angle_negative = 0;
  for (int m = 0; m < num_angle[i]; m++) {
    if (angle_type[i][m] < 0) {
  for (int m = 0; m < num_angle[ilocal]; m++) {
    if (angle_type[ilocal][m] < 0) {
      angle_negative[m] = 1;
      angle_type[i][m] = -angle_type[i][m];
      angle_type[ilocal][m] = -angle_type[ilocal][m];
      any_angle_negative = 1;
    } else angle_negative[m] = 0;
  }

  int any_dihedral_negative = 0;
  for (int m = 0; m < num_dihedral[i]; m++) {
    if (dihedral_type[i][m] < 0) {
  for (int m = 0; m < num_dihedral[ilocal]; m++) {
    if (dihedral_type[ilocal][m] < 0) {
      dihedral_negative[m] = 1;
      dihedral_type[i][m] = -dihedral_type[i][m];
      dihedral_type[ilocal][m] = -dihedral_type[ilocal][m];
      any_dihedral_negative = 1;
    } else dihedral_negative[m] = 0;
  }

  int any_improper_negative = 0;
  for (int m = 0; m < num_improper[i]; m++) {
    if (improper_type[i][m] < 0) {
  for (int m = 0; m < num_improper[ilocal]; m++) {
    if (improper_type[ilocal][m] < 0) {
      improper_negative[m] = 1;
      improper_type[i][m] = -improper_type[i][m];
      improper_type[ilocal][m] = -improper_type[ilocal][m];
      any_improper_negative = 1;
    } else improper_negative[m] = 0;
  }
@@ -169,36 +169,38 @@ void AtomVecFull::pack_restart_pre(int i)
   unmodify values packed by AtomVec::pack_restart()
------------------------------------------------------------------------- */

void AtomVecFull::pack_restart_post(int i)
void AtomVecFull::pack_restart_post(int ilocal)
{
  // restore the flagged types to their negative values

  if (any_bond_negative) {
    int *num_bond = atom->num_bond;
    int **bond_type = atom->bond_type;
    for (int m = 0; m < num_bond[i]; m++)
      if (bond_negative[m]) bond_type[i][m] = -bond_type[i][m];
    for (int m = 0; m < num_bond[ilocal]; m++)
      if (bond_negative[m]) bond_type[ilocal][m] = -bond_type[ilocal][m];
  }

  if (any_angle_negative) {
    int *num_angle = atom->num_angle;
    int **angle_type = atom->angle_type;
    for (int m = 0; m < num_angle[i]; m++)
      if (angle_negative[m]) angle_type[i][m] = -angle_type[i][m];
    for (int m = 0; m < num_angle[ilocal]; m++)
      if (angle_negative[m]) angle_type[ilocal][m] = -angle_type[ilocal][m];
  }

  if (any_dihedral_negative) {
    int *num_dihedral = atom->num_dihedral;
    int **dihedral_type = atom->dihedral_type;
    for (int m = 0; m < num_dihedral[i]; m++)
      if (dihedral_negative[m]) dihedral_type[i][m] = -dihedral_type[i][m];
    for (int m = 0; m < num_dihedral[ilocal]; m++)
      if (dihedral_negative[m]) 
        dihedral_type[ilocal][m] = -dihedral_type[ilocal][m];
  }

  if (any_improper_negative) {
    int *num_improper = atom->num_improper;
    int **improper_type = atom->improper_type;
    for (int m = 0; m < num_improper[i]; m++)
      if (improper_negative[m]) improper_type[i][m] = -improper_type[i][m];
    for (int m = 0; m < num_improper[ilocal]; m++)
      if (improper_negative[m]) 
        improper_type[ilocal][m] = -improper_type[ilocal][m];
  }
}

+30 −28
Original line number Diff line number Diff line
@@ -28,8 +28,8 @@ AtomVecMolecular::AtomVecMolecular(LAMMPS *lmp) : AtomVec(lmp)

  // strings with peratom variables to include in each AtomVec method
  // strings cannot contain fields in corresponding AtomVec default strings
  // order of fields in the string does not matter
  //   except fields_data_atom and fields_data_vel which must match data file
  // order of fields in a string does not matter
  // except: fields_data_atom & fields_data_vel must match data file

  fields_grow = (char *) 
    "molecule num_bond bond_type bond_atom "
@@ -47,9 +47,9 @@ AtomVecMolecular::AtomVecMolecular(LAMMPS *lmp) : AtomVec(lmp)
    "num_improper improper_type improper_atom1 improper_atom2 "
    "improper_atom3 improper_atom4 "
    "nspecial special";
  fields_comm = NULL;
  fields_comm_vel = NULL;
  fields_reverse = NULL;
  fields_comm = (char *) "";
  fields_comm_vel = (char *) "";
  fields_reverse = (char *) "";
  fields_border = (char *) "molecule";
  fields_border_vel = (char *) "molecule";
  fields_exchange = (char *)
@@ -70,7 +70,7 @@ AtomVecMolecular::AtomVecMolecular(LAMMPS *lmp) : AtomVec(lmp)
  fields_create = (char *) 
    "molecule num_bond num_angle num_dihedral num_improper nspecial";
  fields_data_atom = (char *) "id molecule type x";
  fields_data_vel = NULL;
  fields_data_vel = (char *) "id v";

  setup_fields();

@@ -92,7 +92,7 @@ AtomVecMolecular::~AtomVecMolecular()
   modify values for AtomVec::pack_restart() to pack
------------------------------------------------------------------------- */

void AtomVecMolecular::pack_restart_pre(int i)
void AtomVecMolecular::pack_restart_pre(int ilocal)
{
  // insure negative vectors are needed length

@@ -129,37 +129,37 @@ void AtomVecMolecular::pack_restart_pre(int i)
  int **improper_type = atom->improper_type;

  int any_bond_negative = 0;
  for (int m = 0; m < num_bond[i]; m++) {
    if (bond_type[i][m] < 0) {
  for (int m = 0; m < num_bond[ilocal]; m++) {
    if (bond_type[ilocal][m] < 0) {
      bond_negative[m] = 1;
      bond_type[i][m] = -bond_type[i][m];
      bond_type[ilocal][m] = -bond_type[ilocal][m];
      any_bond_negative = 1;
    } else bond_negative[m] = 0;
  }

  int any_angle_negative = 0;
  for (int m = 0; m < num_angle[i]; m++) {
    if (angle_type[i][m] < 0) {
  for (int m = 0; m < num_angle[ilocal]; m++) {
    if (angle_type[ilocal][m] < 0) {
      angle_negative[m] = 1;
      angle_type[i][m] = -angle_type[i][m];
      angle_type[ilocal][m] = -angle_type[ilocal][m];
      any_angle_negative = 1;
    } else angle_negative[m] = 0;
  }

  int any_dihedral_negative = 0;
  for (int m = 0; m < num_dihedral[i]; m++) {
    if (dihedral_type[i][m] < 0) {
  for (int m = 0; m < num_dihedral[ilocal]; m++) {
    if (dihedral_type[ilocal][m] < 0) {
      dihedral_negative[m] = 1;
      dihedral_type[i][m] = -dihedral_type[i][m];
      dihedral_type[ilocal][m] = -dihedral_type[ilocal][m];
      any_dihedral_negative = 1;
    } else dihedral_negative[m] = 0;
  }

  int any_improper_negative = 0;
  for (int m = 0; m < num_improper[i]; m++) {
    if (improper_type[i][m] < 0) {
  for (int m = 0; m < num_improper[ilocal]; m++) {
    if (improper_type[ilocal][m] < 0) {
      improper_negative[m] = 1;
      improper_type[i][m] = -improper_type[i][m];
      improper_type[ilocal][m] = -improper_type[ilocal][m];
      any_improper_negative = 1;
    } else improper_negative[m] = 0;
  }
@@ -169,36 +169,38 @@ void AtomVecMolecular::pack_restart_pre(int i)
   unmodify values packed by AtomVec::pack_restart()
------------------------------------------------------------------------- */

void AtomVecMolecular::pack_restart_post(int i)
void AtomVecMolecular::pack_restart_post(int ilocal)
{
  // restore the flagged types to their negative values

  if (any_bond_negative) {
    int *num_bond = atom->num_bond;
    int **bond_type = atom->bond_type;
    for (int m = 0; m < num_bond[i]; m++)
      if (bond_negative[m]) bond_type[i][m] = -bond_type[i][m];
    for (int m = 0; m < num_bond[ilocal]; m++)
      if (bond_negative[m]) bond_type[ilocal][m] = -bond_type[ilocal][m];
  }

  if (any_angle_negative) {
    int *num_angle = atom->num_angle;
    int **angle_type = atom->angle_type;
    for (int m = 0; m < num_angle[i]; m++)
      if (angle_negative[m]) angle_type[i][m] = -angle_type[i][m];
    for (int m = 0; m < num_angle[ilocal]; m++)
      if (angle_negative[m]) angle_type[ilocal][m] = -angle_type[ilocal][m];
  }

  if (any_dihedral_negative) {
    int *num_dihedral = atom->num_dihedral;
    int **dihedral_type = atom->dihedral_type;
    for (int m = 0; m < num_dihedral[i]; m++)
      if (dihedral_negative[m]) dihedral_type[i][m] = -dihedral_type[i][m];
    for (int m = 0; m < num_dihedral[ilocal]; m++)
      if (dihedral_negative[m]) 
        dihedral_type[ilocal][m] = -dihedral_type[ilocal][m];
  }

  if (any_improper_negative) {
    int *num_improper = atom->num_improper;
    int **improper_type = atom->improper_type;
    for (int m = 0; m < num_improper[i]; m++)
      if (improper_negative[m]) improper_type[i][m] = -improper_type[i][m];
    for (int m = 0; m < num_improper[ilocal]; m++)
      if (improper_negative[m]) 
        improper_type[ilocal][m] = -improper_type[ilocal][m];
  }
}

Loading