Commit 6c18e366 authored by Steve Plimpton's avatar Steve Plimpton
Browse files

changes to start to make atom style hybrid work

parent 3736af0a
Loading
Loading
Loading
Loading
+4 −8
Changes for src/DIPOLE/atom_vec_dipole.cpp: 4 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -55,16 +55,12 @@ AtomVecDipole::AtomVecDipole(LAMMPS *lmp) : AtomVec(lmp)
}

/* ----------------------------------------------------------------------
   unpack one line from Atoms section of data file
   modify what the default AtomVec::data_atom() just initialized
   modify what AtomVec::data_atom() just unpacked
   or initialize other atom quantities
------------------------------------------------------------------------- */

void AtomVecDipole::data_atom(double *coord, imageint imagetmp, char **values)
void AtomVecDipole::data_atom_post(int ilocal)
{
  AtomVec::data_atom(coord,imagetmp,values);

  int ilocal = atom->nlocal-1;
  double mu = atom->mu[ilocal];
  double *mu = atom->mu[ilocal];
  mu[3] = sqrt(mu[0]*mu[0] + mu[1]*mu[1] + mu[2]*mu[2]);
}
+1 −1
Changes for src/DIPOLE/atom_vec_dipole.h: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ namespace LAMMPS_NS {
class AtomVecDipole : public AtomVec {
 public:
  AtomVecDipole(class LAMMPS *);
  void data_atom(double *, imageint, char **);
  void data_atom_post(int);
};

}
+17 −20
Changes for src/MOLECULE/atom_vec_angle.cpp: 17 added lines, 20 removed lines.
Original line number Diff line number Diff line
@@ -67,11 +67,10 @@ AtomVecAngle::~AtomVecAngle()
}

/* ----------------------------------------------------------------------
   pack atom I's data for restart file
   modify/unmodify values for default AtomVec::pack_restart() to pack
   modify values for AtomVec::pack_restart() to pack
------------------------------------------------------------------------- */

int AtomVecAngle::pack_restart(int i, double *buf)
void AtomVecAngle::pack_restart_pre(int i)
{
  // insure negative vectors are needed length

@@ -110,51 +109,49 @@ int AtomVecAngle::pack_restart(int i, double *buf)
      any_angle_negative = 1;
    } else angle_negative[m] = 0;
  }
}

  // perform the pack with adjusted values

  int n = AtomVec::pack_restart(i,buf);
/* ----------------------------------------------------------------------
   unmodify values packed by AtomVec::pack_restart()
------------------------------------------------------------------------- */

void AtomVecAngle::pack_restart_post(int i)
{
  // 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];
  }

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

  return n;
}

/* ----------------------------------------------------------------------
   unpack data for one atom from restart file including extra quantities
   initialize other atom quantities
   initialize other atom quantities after AtomVec::unpack_restart()
------------------------------------------------------------------------- */

int AtomVecAngle::unpack_restart(double *buf)
void AtomVecAngle::unpack_restart_init(int ilocal)
{
  AtomVec::unpack_restart(buf);
  int ilocal = atom->nlocal-1;

  atom->nspecial[ilocal][0] = 0;
  atom->nspecial[ilocal][1] = 0;
  atom->nspecial[ilocal][2] = 0;
}

/* ----------------------------------------------------------------------
   unpack one line from Atoms section of data file
   modify what default AtomVec::data_atom() just unpacked
   modify what AtomVec::data_atom() just unpacked
   or initialize other atom quantities
------------------------------------------------------------------------- */

void AtomVecAngle::data_atom(double *coord, imageint imagetmp, char **values)
void AtomVecAngle::data_atom_post(int ilocal)
{
  AtomVec::data_atom(coord,imagetmp,values);
  int ilocal = atom->nlocal-1;

  atom->num_bond[ilocal] = 0;
  atom->num_angle[ilocal] = 0;
  atom->nspecial[ilocal][0] = 0;
+5 −3
Changes for src/MOLECULE/atom_vec_angle.h: 5 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -28,11 +28,13 @@ class AtomVecAngle : public AtomVec {
 public:
  AtomVecAngle(class LAMMPS *);
  ~AtomVecAngle();
  int pack_restart(int, double *);
  int unpack_restart(double *);
  void data_atom(double *, imageint, char **);
  void pack_restart_pre(int);
  void pack_restart_post(int);
  void unpack_restart_init(int);
  void data_atom_post(int);

 private:
  int any_bond_negative,any_angle_negative;
  int bond_per_atom,angle_per_atom;
  int *bond_negative,*angle_negative;
};
+15 −21
Changes for src/MOLECULE/atom_vec_bond.cpp: 15 added lines, 21 removed lines.
Original line number Diff line number Diff line
@@ -61,11 +61,10 @@ AtomVecBond::~AtomVecBond()
}

/* ----------------------------------------------------------------------
   pack atom I's data for restart file
   modify/unmodify values for default AtomVec::pack_restart() to pack
   modify values for AtomVec::pack_restart() to pack
------------------------------------------------------------------------- */

int AtomVecBond::pack_restart(int i, double *buf)
void AtomVecBond::pack_restart_pre(int i)
{
  // insure bond_negative vector is needed length

@@ -80,7 +79,7 @@ int AtomVecBond::pack_restart(int i, double *buf)
  int *num_bond = atom->num_bond;
  int **bond_type = atom->bond_type;

  int any_bond_negative = 0;
  any_bond_negative = 0;
  for (int m = 0; m < num_bond[i]; m++) {
    if (bond_type[i][m] < 0) {
      bond_negative[m] = 1;
@@ -88,47 +87,42 @@ int AtomVecBond::pack_restart(int i, double *buf)
      any_bond_negative = 1;
    } else bond_negative[m] = 0;
  }
}

  // perform the pack with adjusted values

  int n = AtomVec::pack_restart(i,buf);
/* ----------------------------------------------------------------------
   unmodify values packed by AtomVec::pack_restart()
------------------------------------------------------------------------- */

void AtomVecBond::pack_restart_post(int i)
{
  // 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];
  }

  return n;
}

/* ----------------------------------------------------------------------
   unpack data for one atom from restart file including extra quantities
   initialize other atom quantities
   initialize other atom quantities after AtomVec::unpack_restart()
------------------------------------------------------------------------- */

int AtomVecBond::unpack_restart(double *buf)
void AtomVecBond::unpack_restart_init(int ilocal)
{
  AtomVec::unpack_restart(buf);
  int ilocal = atom->nlocal-1;

  atom->nspecial[ilocal][0] = 0;
  atom->nspecial[ilocal][1] = 0;
  atom->nspecial[ilocal][2] = 0;
}

/* ----------------------------------------------------------------------
   unpack one line from Atoms section of data file
   modify what default AtomVec::data_atom() just unpacked
   modify what AtomVec::data_atom() just unpacked
   or initialize other atom quantities
------------------------------------------------------------------------- */

void AtomVecBond::data_atom(double *coord, imageint imagetmp, char **values)
void AtomVecBond::data_atom_post(int ilocal)
{
  AtomVec::data_atom(coord,imagetmp,values);
  int ilocal = atom->nlocal-1;

  atom->num_bond[ilocal] = 0;
  atom->nspecial[ilocal][0] = 0;
  atom->nspecial[ilocal][1] = 0;
Loading