Commit 5d667835 authored by sjplimp's avatar sjplimp
Browse files

git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@5343 f3b2605a-c512-4ea7-a41b-209d697bcdaa
parent 0e72c6f0
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -76,6 +76,8 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp)
  spin = NULL;
  eradius = ervel = erforce = NULL;

  length = theta = NULL;

  maxspecial = 1;
  nspecial = NULL;
  special = NULL;
@@ -102,6 +104,7 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp)
  quat_flag = omega_flag = angmom_flag = torque_flag = 0;
  radius_flag = density_flag = rmass_flag = vfrac_flag = 0;
  spin_flag = eradius_flag = ervel_flag = erforce_flag = 0;
  line_flag = 0;

  // ntype-length arrays

@@ -185,6 +188,9 @@ Atom::~Atom()
  memory->sfree(ervel);
  memory->sfree(erforce);

  memory->sfree(length);
  memory->sfree(theta);

  memory->sfree(molecule);

  memory->destroy_2d_int_array(nspecial);
@@ -262,6 +268,7 @@ void Atom::create_avec(const char *style, int narg, char **arg)
  quat_flag = omega_flag = angmom_flag = torque_flag = 0;
  radius_flag = density_flag = rmass_flag = vfrac_flag = 0;
  spin_flag = eradius_flag = ervel_flag = erforce_flag = 0;
  line_flag = 0;
    
  avec = new_avec(style,narg,arg);
  int n = strlen(style) + 1;
+3 −0
Original line number Diff line number Diff line
@@ -55,6 +55,8 @@ class Atom : protected Pointers {
  int *spin;
  double *eradius,*ervel,*erforce;

  double *length,*theta;

  int **nspecial;               // 0,1,2 = cummulative # of 1-2,1-3,1-4 neighs
  int **special;                // IDs of 1-2,1-3,1-4 neighs of each atom
  int maxspecial;               // special[nlocal][maxspecial]
@@ -84,6 +86,7 @@ class Atom : protected Pointers {
  int quat_flag,omega_flag,angmom_flag,torque_flag;
  int radius_flag,density_flag,rmass_flag,vfrac_flag;
  int spin_flag,eradius_flag,ervel_flag,erforce_flag;
  int line_flag;

  // extra peratom info in restart file destined for fix & diag 

+13 −1
Original line number Diff line number Diff line
@@ -23,7 +23,8 @@

using namespace LAMMPS_NS;

#define INERTIA 0.4          // moment of inertia for sphere
//#define INERTIA 0.4          // moment of inertia for sphere
#define INERTIA (1.0/12.0)          // moment of inertia for sphere

/* ---------------------------------------------------------------------- */

@@ -37,11 +38,13 @@ ComputeERotateSphere::ComputeERotateSphere(LAMMPS *lmp, int narg, char **arg) :

  // error checks

  /*
  if (!atom->omega_flag) 
    error->all("Compute erotate/sphere requires atom attribute omega");
  if (!atom->radius_flag && !atom->avec->shape_type)
    error->all("Compute erotate/sphere requires atom attribute "
	       "radius or shape");
  */
}

/* ---------------------------------------------------------------------- */
@@ -53,6 +56,7 @@ void ComputeERotateSphere::init()
  // if shape used, check that all particles are spherical
  // point particles are allowed

  /*
  if (atom->radius == NULL) {
    double **shape = atom->shape;
    int *type = atom->type;
@@ -68,6 +72,7 @@ void ComputeERotateSphere::init()
		     "spherical particle shapes");
      }
  }
  */

  pfactor = 0.5 * force->mvv2e * INERTIA;
}
@@ -112,6 +117,13 @@ double ComputeERotateSphere::compute_scalar()
    
  } else {
    if (rmass) {
      for (i = 0; i < nlocal; i++) 
	if (mask[i] & groupbit) {
	  erotate += (omega[i][0]*omega[i][0] + omega[i][1]*omega[i][1] + 
		      omega[i][2]*omega[i][2]) * 
	    atom->length[i]*atom->length[i]*rmass[i];
	}
    } else if (rmass) {
      for (i = 0; i < nlocal; i++) 
	if (mask[i] & groupbit) {
	  itype = type[i];
+131 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@
   See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */

#include "math.h"
#include "string.h"
#include "compute_property_atom.h"
#include "atom.h"
@@ -218,6 +219,37 @@ ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) :
		   "atom property that isn't allocated");
      pack_choice[i] = &ComputePropertyAtom::pack_erforce;

    } else if (strcmp(arg[iarg],"end1x") == 0) {
      if (!atom->line_flag)
	error->all("Compute property/atom for "
		   "atom property that isn't allocated");
      pack_choice[i] = &ComputePropertyAtom::pack_end1x;
    } else if (strcmp(arg[iarg],"end1y") == 0) {
      if (!atom->line_flag)
	error->all("Compute property/atom for "
		   "atom property that isn't allocated");
      pack_choice[i] = &ComputePropertyAtom::pack_end1y;
    } else if (strcmp(arg[iarg],"end1z") == 0) {
      if (!atom->line_flag)
	error->all("Compute property/atom for "
		   "atom property that isn't allocated");
      pack_choice[i] = &ComputePropertyAtom::pack_end1z;
    } else if (strcmp(arg[iarg],"end2x") == 0) {
      if (!atom->line_flag)
	error->all("Compute property/atom for "
		   "atom property that isn't allocated");
      pack_choice[i] = &ComputePropertyAtom::pack_end2x;
    } else if (strcmp(arg[iarg],"end2y") == 0) {
      if (!atom->line_flag)
	error->all("Compute property/atom for "
		   "atom property that isn't allocated");
      pack_choice[i] = &ComputePropertyAtom::pack_end2y;
    } else if (strcmp(arg[iarg],"end2z") == 0) {
      if (!atom->line_flag)
	error->all("Compute property/atom for "
		   "atom property that isn't allocated");
      pack_choice[i] = &ComputePropertyAtom::pack_end2z;

    } else error->all("Invalid keyword in compute property/atom command");
  }

@@ -1100,3 +1132,102 @@ void ComputePropertyAtom::pack_erforce(int n)
    n += nvalues;
  }
}

/* ---------------------------------------------------------------------- */

void ComputePropertyAtom::pack_end1x(int n)
{
  double **x = atom->x;
  double *length = atom->length;
  double *theta = atom->theta;
  int *mask = atom->mask;
  int nlocal = atom->nlocal;

  for (int i = 0; i < nlocal; i++) {
    if (mask[i] & groupbit) buf[n] = x[i][0] - 0.5*length[i]*cos(theta[i]);
    else buf[n] = 0.0;
    n += nvalues;
  }
}

/* ---------------------------------------------------------------------- */

void ComputePropertyAtom::pack_end1y(int n)
{
  double **x = atom->x;
  double *length = atom->length;
  double *theta = atom->theta;
  int *mask = atom->mask;
  int nlocal = atom->nlocal;

  for (int i = 0; i < nlocal; i++) {
    if (mask[i] & groupbit) buf[n] = x[i][1] - 0.5*length[i]*sin(theta[i]);
    else buf[n] = 0.0;
    n += nvalues;
  }
}

/* ---------------------------------------------------------------------- */

void ComputePropertyAtom::pack_end1z(int n)
{
  double **x = atom->x;
  int *mask = atom->mask;
  int nlocal = atom->nlocal;

  for (int i = 0; i < nlocal; i++) {
    if (mask[i] & groupbit) buf[n] = x[i][2];
    else buf[n] = 0.0;
    n += nvalues;
  }
}

/* ---------------------------------------------------------------------- */

void ComputePropertyAtom::pack_end2x(int n)
{
  double **x = atom->x;
  double *length = atom->length;
  double *theta = atom->theta;
  int *mask = atom->mask;
  int nlocal = atom->nlocal;

  for (int i = 0; i < nlocal; i++) {
    if (mask[i] & groupbit) buf[n] = x[i][0] + 0.5*length[i]*cos(theta[i]);
    else buf[n] = 0.0;
    n += nvalues;
  }
}

/* ---------------------------------------------------------------------- */

void ComputePropertyAtom::pack_end2y(int n)
{
  double **x = atom->x;
  double *length = atom->length;
  double *theta = atom->theta;
  int *mask = atom->mask;
  int nlocal = atom->nlocal;

  for (int i = 0; i < nlocal; i++) {
    if (mask[i] & groupbit) buf[n] = x[i][1] + 0.5*length[i]*sin(theta[i]);
    else buf[n] = 0.0;
    n += nvalues;
  }
}

/* ---------------------------------------------------------------------- */

void ComputePropertyAtom::pack_end2z(int n)
{
  double **x = atom->x;
  int *mask = atom->mask;
  int nlocal = atom->nlocal;

  for (int i = 0; i < nlocal; i++) {
    if (mask[i] & groupbit) buf[n] = x[i][2];
    else buf[n] = 0.0;
    n += nvalues;
  }
}
+6 −0
Original line number Diff line number Diff line
@@ -94,6 +94,12 @@ class ComputePropertyAtom : public Compute {
  void pack_eradius(int);
  void pack_ervel(int);
  void pack_erforce(int);
  void pack_end1x(int);
  void pack_end1y(int);
  void pack_end1z(int);
  void pack_end2x(int);
  void pack_end2y(int);
  void pack_end2z(int);
};

}
Loading