git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@1608 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -41,7 +41,7 @@ AtomVecGranular::AtomVecGranular(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
xcol_data = 5;
|
xcol_data = 5;
|
||||||
|
|
||||||
atom->radius_flag = atom->density_flag = atom->rmass_flag = 1;
|
atom->radius_flag = atom->density_flag = atom->rmass_flag = 1;
|
||||||
atom->xorient_flag = atom->omega_flag = atom->torque_flag = 1;
|
atom->omega_flag = atom->torque_flag = 1;
|
||||||
|
|
||||||
PI = 4.0*atan(1.0);
|
PI = 4.0*atan(1.0);
|
||||||
}
|
}
|
||||||
@ -77,8 +77,6 @@ void AtomVecGranular::grow(int n)
|
|||||||
rmass = atom->rmass = (double *)
|
rmass = atom->rmass = (double *)
|
||||||
memory->srealloc(atom->rmass,nmax*sizeof(double),"atom:rmass");
|
memory->srealloc(atom->rmass,nmax*sizeof(double),"atom:rmass");
|
||||||
|
|
||||||
xorient = atom->xorient =
|
|
||||||
memory->grow_2d_double_array(atom->xorient,nmax,3,"atom:xorient");
|
|
||||||
omega = atom->omega =
|
omega = atom->omega =
|
||||||
memory->grow_2d_double_array(atom->omega,nmax,3,"atom:omega");
|
memory->grow_2d_double_array(atom->omega,nmax,3,"atom:omega");
|
||||||
torque = atom->torque =
|
torque = atom->torque =
|
||||||
@ -107,9 +105,6 @@ void AtomVecGranular::copy(int i, int j)
|
|||||||
radius[j] = radius[i];
|
radius[j] = radius[i];
|
||||||
density[j] = density[i];
|
density[j] = density[i];
|
||||||
rmass[j] = rmass[i];
|
rmass[j] = rmass[i];
|
||||||
xorient[j][0] = xorient[i][0];
|
|
||||||
xorient[j][1] = xorient[i][1];
|
|
||||||
xorient[j][2] = xorient[i][2];
|
|
||||||
omega[j][0] = omega[i][0];
|
omega[j][0] = omega[i][0];
|
||||||
omega[j][1] = omega[i][1];
|
omega[j][1] = omega[i][1];
|
||||||
omega[j][2] = omega[i][2];
|
omega[j][2] = omega[i][2];
|
||||||
@ -408,9 +403,6 @@ int AtomVecGranular::pack_exchange(int i, double *buf)
|
|||||||
buf[m++] = radius[i];
|
buf[m++] = radius[i];
|
||||||
buf[m++] = density[i];
|
buf[m++] = density[i];
|
||||||
buf[m++] = rmass[i];
|
buf[m++] = rmass[i];
|
||||||
buf[m++] = xorient[i][0];
|
|
||||||
buf[m++] = xorient[i][1];
|
|
||||||
buf[m++] = xorient[i][2];
|
|
||||||
buf[m++] = omega[i][0];
|
buf[m++] = omega[i][0];
|
||||||
buf[m++] = omega[i][1];
|
buf[m++] = omega[i][1];
|
||||||
buf[m++] = omega[i][2];
|
buf[m++] = omega[i][2];
|
||||||
@ -445,9 +437,6 @@ int AtomVecGranular::unpack_exchange(double *buf)
|
|||||||
radius[nlocal] = buf[m++];
|
radius[nlocal] = buf[m++];
|
||||||
density[nlocal] = buf[m++];
|
density[nlocal] = buf[m++];
|
||||||
rmass[nlocal] = buf[m++];
|
rmass[nlocal] = buf[m++];
|
||||||
xorient[nlocal][0] = buf[m++];
|
|
||||||
xorient[nlocal][1] = buf[m++];
|
|
||||||
xorient[nlocal][2] = buf[m++];
|
|
||||||
omega[nlocal][0] = buf[m++];
|
omega[nlocal][0] = buf[m++];
|
||||||
omega[nlocal][1] = buf[m++];
|
omega[nlocal][1] = buf[m++];
|
||||||
omega[nlocal][2] = buf[m++];
|
omega[nlocal][2] = buf[m++];
|
||||||
@ -503,9 +492,6 @@ int AtomVecGranular::pack_restart(int i, double *buf)
|
|||||||
|
|
||||||
buf[m++] = radius[i];
|
buf[m++] = radius[i];
|
||||||
buf[m++] = density[i];
|
buf[m++] = density[i];
|
||||||
buf[m++] = xorient[i][0];
|
|
||||||
buf[m++] = xorient[i][1];
|
|
||||||
buf[m++] = xorient[i][2];
|
|
||||||
buf[m++] = omega[i][0];
|
buf[m++] = omega[i][0];
|
||||||
buf[m++] = omega[i][1];
|
buf[m++] = omega[i][1];
|
||||||
buf[m++] = omega[i][2];
|
buf[m++] = omega[i][2];
|
||||||
@ -553,9 +539,6 @@ int AtomVecGranular::unpack_restart(double *buf)
|
|||||||
else
|
else
|
||||||
rmass[nlocal] = PI * radius[nlocal]*radius[nlocal] * density[nlocal];
|
rmass[nlocal] = PI * radius[nlocal]*radius[nlocal] * density[nlocal];
|
||||||
|
|
||||||
xorient[nlocal][0] = buf[m++];
|
|
||||||
xorient[nlocal][1] = buf[m++];
|
|
||||||
xorient[nlocal][2] = buf[m++];
|
|
||||||
omega[nlocal][0] = buf[m++];
|
omega[nlocal][0] = buf[m++];
|
||||||
omega[nlocal][1] = buf[m++];
|
omega[nlocal][1] = buf[m++];
|
||||||
omega[nlocal][2] = buf[m++];
|
omega[nlocal][2] = buf[m++];
|
||||||
@ -598,9 +581,6 @@ void AtomVecGranular::create_atom(int itype, double *coord)
|
|||||||
radius[nlocal]*radius[nlocal]*radius[nlocal] * density[nlocal];
|
radius[nlocal]*radius[nlocal]*radius[nlocal] * density[nlocal];
|
||||||
else
|
else
|
||||||
rmass[nlocal] = PI * radius[nlocal]*radius[nlocal] * density[nlocal];
|
rmass[nlocal] = PI * radius[nlocal]*radius[nlocal] * density[nlocal];
|
||||||
xorient[nlocal][0] = 0.0;
|
|
||||||
xorient[nlocal][1] = 0.0;
|
|
||||||
xorient[nlocal][2] = 0.0;
|
|
||||||
omega[nlocal][0] = 0.0;
|
omega[nlocal][0] = 0.0;
|
||||||
omega[nlocal][1] = 0.0;
|
omega[nlocal][1] = 0.0;
|
||||||
omega[nlocal][2] = 0.0;
|
omega[nlocal][2] = 0.0;
|
||||||
@ -644,9 +624,6 @@ void AtomVecGranular::data_atom(double *coord, int imagetmp, char **values)
|
|||||||
v[nlocal][0] = 0.0;
|
v[nlocal][0] = 0.0;
|
||||||
v[nlocal][1] = 0.0;
|
v[nlocal][1] = 0.0;
|
||||||
v[nlocal][2] = 0.0;
|
v[nlocal][2] = 0.0;
|
||||||
xorient[nlocal][0] = 1.0;
|
|
||||||
xorient[nlocal][1] = 0.0;
|
|
||||||
xorient[nlocal][2] = 0.0;
|
|
||||||
omega[nlocal][0] = 0.0;
|
omega[nlocal][0] = 0.0;
|
||||||
omega[nlocal][1] = 0.0;
|
omega[nlocal][1] = 0.0;
|
||||||
omega[nlocal][2] = 0.0;
|
omega[nlocal][2] = 0.0;
|
||||||
@ -672,9 +649,6 @@ int AtomVecGranular::data_atom_hybrid(int nlocal, char **values)
|
|||||||
v[nlocal][0] = 0.0;
|
v[nlocal][0] = 0.0;
|
||||||
v[nlocal][1] = 0.0;
|
v[nlocal][1] = 0.0;
|
||||||
v[nlocal][2] = 0.0;
|
v[nlocal][2] = 0.0;
|
||||||
xorient[nlocal][0] = 1.0;
|
|
||||||
xorient[nlocal][1] = 0.0;
|
|
||||||
xorient[nlocal][2] = 0.0;
|
|
||||||
omega[nlocal][0] = 0.0;
|
omega[nlocal][0] = 0.0;
|
||||||
omega[nlocal][1] = 0.0;
|
omega[nlocal][1] = 0.0;
|
||||||
omega[nlocal][2] = 0.0;
|
omega[nlocal][2] = 0.0;
|
||||||
@ -727,7 +701,6 @@ double AtomVecGranular::memory_usage()
|
|||||||
if (atom->memcheck("radius")) bytes += nmax * sizeof(double);
|
if (atom->memcheck("radius")) bytes += nmax * sizeof(double);
|
||||||
if (atom->memcheck("density")) bytes += nmax * sizeof(double);
|
if (atom->memcheck("density")) bytes += nmax * sizeof(double);
|
||||||
if (atom->memcheck("rmass")) bytes += nmax * sizeof(double);
|
if (atom->memcheck("rmass")) bytes += nmax * sizeof(double);
|
||||||
if (atom->memcheck("xorient")) bytes += nmax*3 * sizeof(double);
|
|
||||||
if (atom->memcheck("omega")) bytes += nmax*3 * sizeof(double);
|
if (atom->memcheck("omega")) bytes += nmax*3 * sizeof(double);
|
||||||
if (atom->memcheck("torque")) bytes += nmax*3 * sizeof(double);
|
if (atom->memcheck("torque")) bytes += nmax*3 * sizeof(double);
|
||||||
|
|
||||||
|
|||||||
@ -53,7 +53,7 @@ class AtomVecGranular : public AtomVec {
|
|||||||
int *tag,*type,*mask,*image;
|
int *tag,*type,*mask,*image;
|
||||||
double **x,**v,**f;
|
double **x,**v,**f;
|
||||||
double *radius,*density,*rmass;
|
double *radius,*density,*rmass;
|
||||||
double **xorient,**omega,**torque;
|
double **omega,**torque;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,7 +63,7 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp)
|
|||||||
molecule = NULL;
|
molecule = NULL;
|
||||||
q = NULL;
|
q = NULL;
|
||||||
mu = NULL;
|
mu = NULL;
|
||||||
xorient = quat = omega = angmom = torque = NULL;
|
quat = omega = angmom = torque = NULL;
|
||||||
radius = density = rmass = vfrac = NULL;
|
radius = density = rmass = vfrac = NULL;
|
||||||
|
|
||||||
maxspecial = 1;
|
maxspecial = 1;
|
||||||
@ -89,7 +89,7 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp)
|
|||||||
|
|
||||||
molecule_flag = 0;
|
molecule_flag = 0;
|
||||||
q_flag = mu_flag = 0;
|
q_flag = mu_flag = 0;
|
||||||
xorient_flag = quat_flag = omega_flag = angmom_flag = torque_flag = 0;
|
quat_flag = omega_flag = angmom_flag = torque_flag = 0;
|
||||||
radius_flag = density_flag = rmass_flag = vfrac_flag = 0;
|
radius_flag = density_flag = rmass_flag = vfrac_flag = 0;
|
||||||
|
|
||||||
// ntype-length arrays
|
// ntype-length arrays
|
||||||
@ -153,7 +153,6 @@ Atom::~Atom()
|
|||||||
|
|
||||||
memory->sfree(q);
|
memory->sfree(q);
|
||||||
memory->destroy_2d_double_array(mu);
|
memory->destroy_2d_double_array(mu);
|
||||||
memory->destroy_2d_double_array(xorient);
|
|
||||||
memory->destroy_2d_double_array(quat);
|
memory->destroy_2d_double_array(quat);
|
||||||
memory->destroy_2d_double_array(omega);
|
memory->destroy_2d_double_array(omega);
|
||||||
memory->destroy_2d_double_array(angmom);
|
memory->destroy_2d_double_array(angmom);
|
||||||
|
|||||||
@ -47,7 +47,7 @@ class Atom : protected Pointers {
|
|||||||
|
|
||||||
int *molecule;
|
int *molecule;
|
||||||
double *q,**mu;
|
double *q,**mu;
|
||||||
double **xorient,**quat,**omega,**angmom,**torque;
|
double **quat,**omega,**angmom,**torque;
|
||||||
double *radius,*density,*rmass,*vfrac;
|
double *radius,*density,*rmass,*vfrac;
|
||||||
|
|
||||||
int maxspecial;
|
int maxspecial;
|
||||||
@ -74,7 +74,7 @@ class Atom : protected Pointers {
|
|||||||
|
|
||||||
int molecule_flag;
|
int molecule_flag;
|
||||||
int q_flag,mu_flag;
|
int q_flag,mu_flag;
|
||||||
int xorient_flag,quat_flag,omega_flag,angmom_flag,torque_flag;
|
int quat_flag,omega_flag,angmom_flag,torque_flag;
|
||||||
int radius_flag,density_flag,rmass_flag,vfrac_flag;
|
int radius_flag,density_flag,rmass_flag,vfrac_flag;
|
||||||
|
|
||||||
// extra peratom info in restart file destined for fix & diag
|
// extra peratom info in restart file destined for fix & diag
|
||||||
|
|||||||
105
src/compute_erotate_sphere.cpp
Normal file
105
src/compute_erotate_sphere.cpp
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
|
http://lammps.sandia.gov, Sandia National Laboratories
|
||||||
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
|
|
||||||
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||||
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||||
|
certain rights in this software. This software is distributed under
|
||||||
|
the GNU General Public License.
|
||||||
|
|
||||||
|
See the README file in the top-level LAMMPS directory.
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include "mpi.h"
|
||||||
|
#include "compute_erotate_sphere.h"
|
||||||
|
#include "atom.h"
|
||||||
|
#include "force.h"
|
||||||
|
#include "domain.h"
|
||||||
|
#include "group.h"
|
||||||
|
#include "error.h"
|
||||||
|
|
||||||
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
|
#define INVOKED_SCALAR 1
|
||||||
|
|
||||||
|
#define INERTIA 0.4 // moment of inertia for sphere
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
ComputeERotateSphere::ComputeERotateSphere(LAMMPS *lmp, int narg, char **arg) :
|
||||||
|
Compute(lmp, narg, arg)
|
||||||
|
{
|
||||||
|
if (narg != 3) error->all("Illegal compute erotate/sphere command");
|
||||||
|
|
||||||
|
if (!atom->omega_flag)
|
||||||
|
error->all("Compute erotate/sphere requires atom attribute omega");
|
||||||
|
|
||||||
|
scalar_flag = 1;
|
||||||
|
extscalar = 1;
|
||||||
|
|
||||||
|
inertia = new double[atom->ntypes+1];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
ComputeERotateSphere::~ComputeERotateSphere()
|
||||||
|
{
|
||||||
|
delete [] inertia;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void ComputeERotateSphere::init()
|
||||||
|
{
|
||||||
|
pfactor = 0.5 * force->mvv2e * INERTIA;
|
||||||
|
|
||||||
|
if (atom->mass && !atom->shape)
|
||||||
|
error->all("Compute erotate/sphere requires atom attribute shape");
|
||||||
|
if (!atom->mass && (!atom->radius_flag || !atom->rmass_flag))
|
||||||
|
error->all("Compute erotate/sphere requires atom attributes radius, rmass");
|
||||||
|
|
||||||
|
if (atom->mass) {
|
||||||
|
double *mass = atom->mass;
|
||||||
|
double **shape = atom->shape;
|
||||||
|
|
||||||
|
for (int i = 1; i <= atom->ntypes; i++) {
|
||||||
|
if (shape[i][0] != shape[i][1] || shape[i][0] != shape[i][2])
|
||||||
|
error->all("Compute rotate requires spherical particle shapes");
|
||||||
|
inertia[i] = 0.25*shape[i][0]*shape[i][0] * mass[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
double ComputeERotateSphere::compute_scalar()
|
||||||
|
{
|
||||||
|
invoked |= INVOKED_SCALAR;
|
||||||
|
|
||||||
|
double **omega = atom->omega;
|
||||||
|
double *radius = atom->radius;
|
||||||
|
double *rmass = atom->rmass;
|
||||||
|
double *mass = atom->mass;
|
||||||
|
int *mask = atom->mask;
|
||||||
|
int *type = atom->type;
|
||||||
|
int nlocal = atom->nlocal;
|
||||||
|
|
||||||
|
double erotate = 0.0;
|
||||||
|
|
||||||
|
if (mass) {
|
||||||
|
for (int 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]) * inertia[type[i]];
|
||||||
|
} else {
|
||||||
|
for (int 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]) * radius[i]*radius[i]*rmass[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
MPI_Allreduce(&erotate,&scalar,1,MPI_DOUBLE,MPI_SUM,world);
|
||||||
|
scalar *= pfactor;
|
||||||
|
return scalar;
|
||||||
|
}
|
||||||
@ -11,21 +11,22 @@
|
|||||||
See the README file in the top-level LAMMPS directory.
|
See the README file in the top-level LAMMPS directory.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
#ifndef COMPUTE_ROTATE_DIPOLE_H
|
#ifndef COMPUTE_EROTATE_SPHERE_H
|
||||||
#define COMPUTE_ROTATE_DIPOLE_H
|
#define COMPUTE_EROTATE_SPHERE_H
|
||||||
|
|
||||||
#include "compute.h"
|
#include "compute.h"
|
||||||
|
|
||||||
namespace LAMMPS_NS {
|
namespace LAMMPS_NS {
|
||||||
|
|
||||||
class ComputeRotateDipole : public Compute {
|
class ComputeERotateSphere : public Compute {
|
||||||
public:
|
public:
|
||||||
ComputeRotateDipole(class LAMMPS *, int, char **);
|
ComputeERotateSphere(class LAMMPS *, int, char **);
|
||||||
~ComputeRotateDipole();
|
~ComputeERotateSphere();
|
||||||
void init();
|
void init();
|
||||||
double compute_scalar();
|
double compute_scalar();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
double pfactor;
|
||||||
double *inertia;
|
double *inertia;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1,90 +0,0 @@
|
|||||||
/* ----------------------------------------------------------------------
|
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
|
||||||
http://lammps.sandia.gov, Sandia National Laboratories
|
|
||||||
Steve Plimpton, sjplimp@sandia.gov
|
|
||||||
|
|
||||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
|
||||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
|
||||||
certain rights in this software. This software is distributed under
|
|
||||||
the GNU General Public License.
|
|
||||||
|
|
||||||
See the README file in the top-level LAMMPS directory.
|
|
||||||
------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#include "mpi.h"
|
|
||||||
#include "compute_rotate_dipole.h"
|
|
||||||
#include "atom.h"
|
|
||||||
#include "domain.h"
|
|
||||||
#include "group.h"
|
|
||||||
#include "error.h"
|
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
|
||||||
|
|
||||||
#define INVOKED_SCALAR 1
|
|
||||||
#define INERTIA3D 0.4 // moments of inertia for sphere and disk
|
|
||||||
#define INERTIA2D 0.5
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
ComputeRotateDipole::ComputeRotateDipole(LAMMPS *lmp, int narg, char **arg) :
|
|
||||||
Compute(lmp, narg, arg)
|
|
||||||
{
|
|
||||||
if (narg != 3) error->all("Illegal compute rotate/dipole command");
|
|
||||||
|
|
||||||
if (atom->dipole == NULL || !atom->omega_flag)
|
|
||||||
error->all("Compute rotate/dipole requires atom attributes dipole, omega");
|
|
||||||
|
|
||||||
scalar_flag = 1;
|
|
||||||
extscalar = 1;
|
|
||||||
|
|
||||||
inertia = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
ComputeRotateDipole::~ComputeRotateDipole()
|
|
||||||
{
|
|
||||||
delete [] inertia;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
void ComputeRotateDipole::init()
|
|
||||||
{
|
|
||||||
delete [] inertia;
|
|
||||||
inertia = new double[atom->ntypes+1];
|
|
||||||
|
|
||||||
double *mass = atom->mass;
|
|
||||||
double **shape = atom->shape;
|
|
||||||
|
|
||||||
if (domain->dimension == 3)
|
|
||||||
for (int i = 1; i <= atom->ntypes; i++)
|
|
||||||
inertia[i] = INERTIA3D * mass[i] * 0.25*shape[i][0]*shape[i][0];
|
|
||||||
else
|
|
||||||
for (int i = 1; i <= atom->ntypes; i++)
|
|
||||||
inertia[i] = INERTIA2D * mass[i] * 0.25*shape[i][0]*shape[i][0];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
double ComputeRotateDipole::compute_scalar()
|
|
||||||
{
|
|
||||||
invoked |= INVOKED_SCALAR;
|
|
||||||
|
|
||||||
double *dipole = atom->dipole;
|
|
||||||
double **omega = atom->omega;
|
|
||||||
int *type = atom->type;
|
|
||||||
int *mask = atom->mask;
|
|
||||||
int nlocal = atom->nlocal;
|
|
||||||
|
|
||||||
double erot = 0.0;
|
|
||||||
for (int i = 0; i < nlocal; i++)
|
|
||||||
if (mask[i] & groupbit && dipole[type[i]] > 0.0)
|
|
||||||
erot += inertia[type[i]] *
|
|
||||||
(omega[i][0]*omega[i][0] + omega[i][1]*omega[i][1] +
|
|
||||||
omega[i][2]*omega[i][2]);
|
|
||||||
|
|
||||||
MPI_Allreduce(&erot,&scalar,1,MPI_DOUBLE,MPI_SUM,world);
|
|
||||||
scalar *= 0.5;
|
|
||||||
return scalar;
|
|
||||||
}
|
|
||||||
@ -1,73 +0,0 @@
|
|||||||
/* ----------------------------------------------------------------------
|
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
|
||||||
http://lammps.sandia.gov, Sandia National Laboratories
|
|
||||||
Steve Plimpton, sjplimp@sandia.gov
|
|
||||||
|
|
||||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
|
||||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
|
||||||
certain rights in this software. This software is distributed under
|
|
||||||
the GNU General Public License.
|
|
||||||
|
|
||||||
See the README file in the top-level LAMMPS directory.
|
|
||||||
------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#include "mpi.h"
|
|
||||||
#include "compute_rotate_gran.h"
|
|
||||||
#include "atom.h"
|
|
||||||
#include "force.h"
|
|
||||||
#include "domain.h"
|
|
||||||
#include "group.h"
|
|
||||||
#include "error.h"
|
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
|
||||||
|
|
||||||
#define INVOKED_SCALAR 1
|
|
||||||
#define INERTIA3D 0.4 // moments of inertia for sphere and disk
|
|
||||||
#define INERTIA2D 0.5
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
ComputeRotateGran::ComputeRotateGran(LAMMPS *lmp, int narg, char **arg) :
|
|
||||||
Compute(lmp, narg, arg)
|
|
||||||
{
|
|
||||||
if (narg != 3) error->all("Illegal compute rotate/gran command");
|
|
||||||
|
|
||||||
if (!atom->radius_flag || !atom->rmass_flag || !atom->omega_flag)
|
|
||||||
error->all("Compute rotate/gran requires atom attributes "
|
|
||||||
"radius, rmass, omega");
|
|
||||||
|
|
||||||
scalar_flag = 1;
|
|
||||||
extscalar = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
void ComputeRotateGran::init()
|
|
||||||
{
|
|
||||||
if (domain->dimension == 3) pfactor = 0.5 * force->mvv2e * INERTIA3D;
|
|
||||||
else pfactor = 0.5 * force->mvv2e * INERTIA2D;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
double ComputeRotateGran::compute_scalar()
|
|
||||||
{
|
|
||||||
invoked |= INVOKED_SCALAR;
|
|
||||||
|
|
||||||
double **omega = atom->omega;
|
|
||||||
double *radius = atom->radius;
|
|
||||||
double *rmass = atom->rmass;
|
|
||||||
int *mask = atom->mask;
|
|
||||||
int nlocal = atom->nlocal;
|
|
||||||
|
|
||||||
double erot = 0.0;
|
|
||||||
|
|
||||||
for (int i = 0; i < nlocal; i++)
|
|
||||||
if (mask[i] & groupbit)
|
|
||||||
erot += (omega[i][0]*omega[i][0] + omega[i][1]*omega[i][1] +
|
|
||||||
omega[i][2]*omega[i][2]) * radius[i]*radius[i]*rmass[i];
|
|
||||||
|
|
||||||
MPI_Allreduce(&erot,&scalar,1,MPI_DOUBLE,MPI_SUM,world);
|
|
||||||
scalar *= pfactor;
|
|
||||||
return scalar;
|
|
||||||
}
|
|
||||||
161
src/compute_temp_sphere.cpp
Normal file
161
src/compute_temp_sphere.cpp
Normal file
@ -0,0 +1,161 @@
|
|||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
|
http://lammps.sandia.gov, Sandia National Laboratories
|
||||||
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
|
|
||||||
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||||
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||||
|
certain rights in this software. This software is distributed under
|
||||||
|
the GNU General Public License.
|
||||||
|
|
||||||
|
See the README file in the top-level LAMMPS directory.
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include "mpi.h"
|
||||||
|
#include "compute_temp_sphere.h"
|
||||||
|
#include "atom.h"
|
||||||
|
#include "force.h"
|
||||||
|
#include "domain.h"
|
||||||
|
#include "modify.h"
|
||||||
|
#include "fix.h"
|
||||||
|
#include "group.h"
|
||||||
|
#include "error.h"
|
||||||
|
|
||||||
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
|
#define INVOKED_SCALAR 1
|
||||||
|
#define INVOKED_VECTOR 2
|
||||||
|
|
||||||
|
#define INERTIA 0.4 // moment of inertia for sphere
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
ComputeTempSphere::ComputeTempSphere(LAMMPS *lmp, int narg, char **arg) :
|
||||||
|
Compute(lmp, narg, arg)
|
||||||
|
{
|
||||||
|
if (narg != 3) error->all("Illegal compute temp command");
|
||||||
|
|
||||||
|
scalar_flag = vector_flag = 1;
|
||||||
|
size_vector = 6;
|
||||||
|
extscalar = 0;
|
||||||
|
extvector = 1;
|
||||||
|
tempflag = 1;
|
||||||
|
|
||||||
|
vector = new double[6];
|
||||||
|
inertia = new double[atom->ntypes+1];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
ComputeTempSphere::~ComputeTempSphere()
|
||||||
|
{
|
||||||
|
delete [] vector;
|
||||||
|
delete [] inertia;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void ComputeTempSphere::init()
|
||||||
|
{
|
||||||
|
fix_dof = 0;
|
||||||
|
for (int i = 0; i < modify->nfix; i++)
|
||||||
|
fix_dof += modify->fix[i]->dof(igroup);
|
||||||
|
recount();
|
||||||
|
|
||||||
|
if (atom->mass) {
|
||||||
|
double *mass = atom->mass;
|
||||||
|
double **shape = atom->shape;
|
||||||
|
|
||||||
|
for (int i = 1; i <= atom->ntypes; i++) {
|
||||||
|
if (shape[i][0] != shape[i][1] || shape[i][0] != shape[i][2])
|
||||||
|
error->all("Compute temp/sphere requires spherical particle shapes");
|
||||||
|
inertia[i] = INERTIA * 0.25*shape[i][0]*shape[i][0] * mass[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void ComputeTempSphere::recount()
|
||||||
|
{
|
||||||
|
double natoms = group->count(igroup);
|
||||||
|
if (domain->dimension == 3) dof = 6.0 * natoms;
|
||||||
|
else dof = 3.0 * natoms;
|
||||||
|
dof -= extra_dof + fix_dof;
|
||||||
|
if (dof > 0) tfactor = force->mvv2e / (dof * force->boltz);
|
||||||
|
else tfactor = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
double ComputeTempSphere::compute_scalar()
|
||||||
|
{
|
||||||
|
invoked |= INVOKED_SCALAR;
|
||||||
|
|
||||||
|
double **v = atom->v;
|
||||||
|
double **omega = atom->omega;
|
||||||
|
double *mass = atom->mass;
|
||||||
|
double *rmass = atom->rmass;
|
||||||
|
double *radius = atom->radius;
|
||||||
|
int *type = atom->type;
|
||||||
|
int *mask = atom->mask;
|
||||||
|
int nlocal = atom->nlocal;
|
||||||
|
|
||||||
|
double t = 0.0;
|
||||||
|
|
||||||
|
if (mass) {
|
||||||
|
for (int i = 0; i < nlocal; i++)
|
||||||
|
if (mask[i] & groupbit) {
|
||||||
|
t += (v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]) *
|
||||||
|
mass[type[i]];
|
||||||
|
t += (omega[i][0]*omega[i][0] + omega[i][1]*omega[i][1] +
|
||||||
|
omega[i][2]*omega[i][2]) * inertia[type[i]];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < nlocal; i++)
|
||||||
|
if (mask[i] & groupbit) {
|
||||||
|
t += (v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]) * rmass[i];
|
||||||
|
t += (omega[i][0]*omega[i][0] + omega[i][1]*omega[i][1] +
|
||||||
|
omega[i][2]*omega[i][2]) * INERTIA*radius[i]*radius[i]*rmass[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MPI_Allreduce(&t,&scalar,1,MPI_DOUBLE,MPI_SUM,world);
|
||||||
|
if (dynamic) recount();
|
||||||
|
scalar *= tfactor;
|
||||||
|
return scalar;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void ComputeTempSphere::compute_vector()
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
invoked |= INVOKED_VECTOR;
|
||||||
|
|
||||||
|
double **v = atom->v;
|
||||||
|
double *mass = atom->mass;
|
||||||
|
double *rmass = atom->rmass;
|
||||||
|
int *type = atom->type;
|
||||||
|
int *mask = atom->mask;
|
||||||
|
int nlocal = atom->nlocal;
|
||||||
|
|
||||||
|
double massone,t[6];
|
||||||
|
for (i = 0; i < 6; i++) t[i] = 0.0;
|
||||||
|
|
||||||
|
for (i = 0; i < nlocal; i++)
|
||||||
|
if (mask[i] & groupbit) {
|
||||||
|
if (mass) massone = mass[type[i]];
|
||||||
|
else massone = rmass[i];
|
||||||
|
t[0] += massone * v[i][0]*v[i][0];
|
||||||
|
t[1] += massone * v[i][1]*v[i][1];
|
||||||
|
t[2] += massone * v[i][2]*v[i][2];
|
||||||
|
t[3] += massone * v[i][0]*v[i][1];
|
||||||
|
t[4] += massone * v[i][0]*v[i][2];
|
||||||
|
t[5] += massone * v[i][1]*v[i][2];
|
||||||
|
}
|
||||||
|
|
||||||
|
MPI_Allreduce(t,vector,6,MPI_DOUBLE,MPI_SUM,world);
|
||||||
|
for (i = 0; i < 6; i++) vector[i] *= force->mvv2e;
|
||||||
|
}
|
||||||
@ -11,21 +11,27 @@
|
|||||||
See the README file in the top-level LAMMPS directory.
|
See the README file in the top-level LAMMPS directory.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
#ifndef COMPUTE_ROTATE_GRAN_H
|
#ifndef COMPUTE_TEMP_SPHERE_H
|
||||||
#define COMPUTE_ROTATE_GRAN_H
|
#define COMPUTE_TEMP_SPHERE_H
|
||||||
|
|
||||||
#include "compute.h"
|
#include "compute.h"
|
||||||
|
|
||||||
namespace LAMMPS_NS {
|
namespace LAMMPS_NS {
|
||||||
|
|
||||||
class ComputeRotateGran : public Compute {
|
class ComputeTempSphere : public Compute {
|
||||||
public:
|
public:
|
||||||
ComputeRotateGran(class LAMMPS *, int, char **);
|
ComputeTempSphere(class LAMMPS *, int, char **);
|
||||||
|
~ComputeTempSphere();
|
||||||
void init();
|
void init();
|
||||||
double compute_scalar();
|
double compute_scalar();
|
||||||
|
void compute_vector();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double pfactor;
|
int fix_dof;
|
||||||
|
double tfactor;
|
||||||
|
double *inertia;
|
||||||
|
|
||||||
|
void recount();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -312,8 +312,8 @@ void FixNPH::setup(int vflag)
|
|||||||
p_target[1] = p_start[1];
|
p_target[1] = p_start[1];
|
||||||
p_target[2] = p_start[2];
|
p_target[2] = p_start[2];
|
||||||
|
|
||||||
double tmp = temperature->compute_scalar();
|
|
||||||
if (press_couple == 0) {
|
if (press_couple == 0) {
|
||||||
|
double tmp = temperature->compute_scalar();
|
||||||
tmp = pressure->compute_scalar();
|
tmp = pressure->compute_scalar();
|
||||||
} else {
|
} else {
|
||||||
temperature->compute_vector();
|
temperature->compute_vector();
|
||||||
@ -425,8 +425,8 @@ void FixNPH::final_integrate()
|
|||||||
|
|
||||||
// compute new pressure
|
// compute new pressure
|
||||||
|
|
||||||
double tmp = temperature->compute_scalar();
|
|
||||||
if (press_couple == 0) {
|
if (press_couple == 0) {
|
||||||
|
double tmp = temperature->compute_scalar();
|
||||||
tmp = pressure->compute_scalar();
|
tmp = pressure->compute_scalar();
|
||||||
} else {
|
} else {
|
||||||
temperature->compute_vector();
|
temperature->compute_vector();
|
||||||
|
|||||||
276
src/fix_nve_sphere.cpp
Normal file
276
src/fix_nve_sphere.cpp
Normal file
@ -0,0 +1,276 @@
|
|||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
|
http://lammps.sandia.gov, Sandia National Laboratories
|
||||||
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
|
|
||||||
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||||
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||||
|
certain rights in this software. This software is distributed under
|
||||||
|
the GNU General Public License.
|
||||||
|
|
||||||
|
See the README file in the top-level LAMMPS directory.
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include "math.h"
|
||||||
|
#include "stdio.h"
|
||||||
|
#include "string.h"
|
||||||
|
#include "fix_nve_sphere.h"
|
||||||
|
#include "atom.h"
|
||||||
|
#include "atom_vec.h"
|
||||||
|
#include "update.h"
|
||||||
|
#include "respa.h"
|
||||||
|
#include "force.h"
|
||||||
|
#include "error.h"
|
||||||
|
|
||||||
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
|
#define INERTIA 0.4 // moment of inertia for sphere
|
||||||
|
|
||||||
|
enum{NONE,DIPOLE};
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
FixNVESphere::FixNVESphere(LAMMPS *lmp, int narg, char **arg) :
|
||||||
|
Fix(lmp, narg, arg)
|
||||||
|
{
|
||||||
|
if (narg < 3) error->all("Illegal fix nve/sphere command");
|
||||||
|
|
||||||
|
// process extra keywords
|
||||||
|
|
||||||
|
extra = NONE;
|
||||||
|
|
||||||
|
int iarg = 3;
|
||||||
|
while (iarg < narg) {
|
||||||
|
if (strcmp(arg[iarg],"update") == 0) {
|
||||||
|
if (iarg+2 > narg) error->all("Illegal fix nve/sphere command");
|
||||||
|
if (strcmp(arg[iarg+1],"dipole") == 0) extra = DIPOLE;
|
||||||
|
else error->all("Illegal fix nve/sphere command");
|
||||||
|
iarg += 2;
|
||||||
|
} else error->all("Illegal fix nve/sphere command");
|
||||||
|
}
|
||||||
|
|
||||||
|
// error check
|
||||||
|
|
||||||
|
if (!atom->omega_flag || !atom->torque_flag)
|
||||||
|
error->all("Fix nve/sphere requires atom attributes omega, torque");
|
||||||
|
if (extra == DIPOLE && !atom->mu_flag)
|
||||||
|
error->all("Fix nve/sphere requires atom attribute mu");
|
||||||
|
|
||||||
|
dttype = new double[atom->ntypes+1];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
FixNVESphere::~FixNVESphere()
|
||||||
|
{
|
||||||
|
delete [] dttype;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
int FixNVESphere::setmask()
|
||||||
|
{
|
||||||
|
int mask = 0;
|
||||||
|
mask |= INITIAL_INTEGRATE;
|
||||||
|
mask |= FINAL_INTEGRATE;
|
||||||
|
mask |= INITIAL_INTEGRATE_RESPA;
|
||||||
|
mask |= FINAL_INTEGRATE_RESPA;
|
||||||
|
return mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void FixNVESphere::init()
|
||||||
|
{
|
||||||
|
dtv = update->dt;
|
||||||
|
dtf = 0.5 * update->dt * force->ftm2v;
|
||||||
|
dtfrotate = dtf / INERTIA;
|
||||||
|
|
||||||
|
if (strcmp(update->integrate_style,"respa") == 0)
|
||||||
|
step_respa = ((Respa *) update->integrate)->step;
|
||||||
|
|
||||||
|
if (atom->mass && !atom->shape)
|
||||||
|
error->all("Fix nve/sphere requires atom attribute shape");
|
||||||
|
if (!atom->mass && (!atom->radius_flag || !atom->rmass_flag))
|
||||||
|
error->all("Fix nve/sphere requires atom attributes radius, rmass");
|
||||||
|
|
||||||
|
if (atom->mass) {
|
||||||
|
double *mass = atom->mass;
|
||||||
|
double **shape = atom->shape;
|
||||||
|
for (int i = 1; i <= atom->ntypes; i++) {
|
||||||
|
if (shape[i][0] != shape[i][1] || shape[i][0] != shape[i][2])
|
||||||
|
error->all("Fix nve/sphere requires spherical particle shapes");
|
||||||
|
dttype[i] = dtfrotate / (0.25*shape[i][0]*shape[i][0]*mass[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void FixNVESphere::initial_integrate(int vflag)
|
||||||
|
{
|
||||||
|
int itype;
|
||||||
|
double dtfm,dtirotate,msq,scale;
|
||||||
|
double g[3];
|
||||||
|
|
||||||
|
double **x = atom->x;
|
||||||
|
double **v = atom->v;
|
||||||
|
double **f = atom->f;
|
||||||
|
double **omega = atom->omega;
|
||||||
|
double **torque = atom->torque;
|
||||||
|
double *radius = atom->radius;
|
||||||
|
double *rmass = atom->rmass;
|
||||||
|
double *mass = atom->mass;
|
||||||
|
int *mask = atom->mask;
|
||||||
|
int *type = atom->type;
|
||||||
|
int nlocal = atom->nlocal;
|
||||||
|
if (igroup == atom->firstgroup) nlocal = atom->nfirst;
|
||||||
|
|
||||||
|
// update v,x,omega for all particles
|
||||||
|
// d_omega/dt = torque / inertia
|
||||||
|
|
||||||
|
if (mass) {
|
||||||
|
for (int i = 0; i < nlocal; i++) {
|
||||||
|
if (mask[i] & groupbit) {
|
||||||
|
itype = type[i];
|
||||||
|
dtfm = dtf / mass[itype];
|
||||||
|
v[i][0] += dtfm * f[i][0];
|
||||||
|
v[i][1] += dtfm * f[i][1];
|
||||||
|
v[i][2] += dtfm * f[i][2];
|
||||||
|
x[i][0] += dtv * v[i][0];
|
||||||
|
x[i][1] += dtv * v[i][1];
|
||||||
|
x[i][2] += dtv * v[i][2];
|
||||||
|
|
||||||
|
dtirotate = dttype[itype];
|
||||||
|
omega[i][0] += dtirotate * torque[i][0];
|
||||||
|
omega[i][1] += dtirotate * torque[i][1];
|
||||||
|
omega[i][2] += dtirotate * torque[i][2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < nlocal; i++) {
|
||||||
|
if (mask[i] & groupbit) {
|
||||||
|
dtfm = dtf / rmass[i];
|
||||||
|
v[i][0] += dtfm * f[i][0];
|
||||||
|
v[i][1] += dtfm * f[i][1];
|
||||||
|
v[i][2] += dtfm * f[i][2];
|
||||||
|
x[i][0] += dtv * v[i][0];
|
||||||
|
x[i][1] += dtv * v[i][1];
|
||||||
|
x[i][2] += dtv * v[i][2];
|
||||||
|
|
||||||
|
dtirotate = dtfrotate / (radius[i]*radius[i]*rmass[i]);
|
||||||
|
omega[i][0] += dtirotate * torque[i][0];
|
||||||
|
omega[i][1] += dtirotate * torque[i][1];
|
||||||
|
omega[i][2] += dtirotate * torque[i][2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// update mu for dipoles
|
||||||
|
// d_mu/dt = omega cross mu
|
||||||
|
// renormalize mu to dipole length
|
||||||
|
|
||||||
|
if (extra == DIPOLE) {
|
||||||
|
double **mu = atom->mu;
|
||||||
|
double *dipole = atom->dipole;
|
||||||
|
for (int i = 0; i < nlocal; i++) {
|
||||||
|
if (mask[i] & groupbit) {
|
||||||
|
if (dipole[type[i]] > 0.0) {
|
||||||
|
g[0] = mu[i][0] + dtv * (omega[i][1]*mu[i][2]-omega[i][2]*mu[i][1]);
|
||||||
|
g[1] = mu[i][1] + dtv * (omega[i][2]*mu[i][0]-omega[i][0]*mu[i][2]);
|
||||||
|
g[2] = mu[i][2] + dtv * (omega[i][0]*mu[i][1]-omega[i][1]*mu[i][0]);
|
||||||
|
msq = g[0]*g[0] + g[1]*g[1] + g[2]*g[2];
|
||||||
|
scale = dipole[type[i]]/sqrt(msq);
|
||||||
|
mu[i][0] = g[0]*scale;
|
||||||
|
mu[i][1] = g[1]*scale;
|
||||||
|
mu[i][2] = g[2]*scale;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void FixNVESphere::final_integrate()
|
||||||
|
{
|
||||||
|
int itype;
|
||||||
|
double dtfm,dtirotate;
|
||||||
|
|
||||||
|
double **v = atom->v;
|
||||||
|
double **f = atom->f;
|
||||||
|
double **omega = atom->omega;
|
||||||
|
double **torque = atom->torque;
|
||||||
|
double *mass = atom->mass;
|
||||||
|
double *rmass = atom->rmass;
|
||||||
|
double *radius = atom->radius;
|
||||||
|
int *type = atom->type;
|
||||||
|
int *mask = atom->mask;
|
||||||
|
int nlocal = atom->nlocal;
|
||||||
|
if (igroup == atom->firstgroup) nlocal = atom->nfirst;
|
||||||
|
|
||||||
|
if (mass) {
|
||||||
|
for (int i = 0; i < nlocal; i++) {
|
||||||
|
if (mask[i] & groupbit) {
|
||||||
|
itype = type[i];
|
||||||
|
dtfm = dtf / mass[itype];
|
||||||
|
v[i][0] += dtfm * f[i][0];
|
||||||
|
v[i][1] += dtfm * f[i][1];
|
||||||
|
v[i][2] += dtfm * f[i][2];
|
||||||
|
|
||||||
|
dtirotate = dttype[itype];
|
||||||
|
omega[i][0] += dtirotate * torque[i][0];
|
||||||
|
omega[i][1] += dtirotate * torque[i][1];
|
||||||
|
omega[i][2] += dtirotate * torque[i][2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < nlocal; i++) {
|
||||||
|
if (mask[i] & groupbit) {
|
||||||
|
dtfm = dtf / rmass[i];
|
||||||
|
v[i][0] += dtfm * f[i][0];
|
||||||
|
v[i][1] += dtfm * f[i][1];
|
||||||
|
v[i][2] += dtfm * f[i][2];
|
||||||
|
|
||||||
|
dtirotate = dtfrotate / (radius[i]*radius[i]*rmass[i]);
|
||||||
|
omega[i][0] += dtirotate * torque[i][0];
|
||||||
|
omega[i][1] += dtirotate * torque[i][1];
|
||||||
|
omega[i][2] += dtirotate * torque[i][2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void FixNVESphere::initial_integrate_respa(int vflag, int ilevel, int flag)
|
||||||
|
{
|
||||||
|
if (flag) return; // only used by NPT,NPH
|
||||||
|
|
||||||
|
dtv = step_respa[ilevel];
|
||||||
|
dtf = 0.5 * step_respa[ilevel] * force->ftm2v;
|
||||||
|
dtfrotate = dtf / INERTIA;
|
||||||
|
|
||||||
|
if (ilevel == 0) initial_integrate(vflag);
|
||||||
|
else final_integrate();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void FixNVESphere::final_integrate_respa(int ilevel)
|
||||||
|
{
|
||||||
|
dtf = 0.5 * step_respa[ilevel] * force->ftm2v;
|
||||||
|
dtfrotate = dtf / INERTIA;
|
||||||
|
final_integrate();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void FixNVESphere::reset_dt()
|
||||||
|
{
|
||||||
|
dtv = update->dt;
|
||||||
|
dtf = 0.5 * update->dt * force->ftm2v;
|
||||||
|
dtfrotate = dtf / INERTIA;
|
||||||
|
}
|
||||||
42
src/fix_nve_sphere.h
Normal file
42
src/fix_nve_sphere.h
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
|
http://lammps.sandia.gov, Sandia National Laboratories
|
||||||
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
|
|
||||||
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||||
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||||
|
certain rights in this software. This software is distributed under
|
||||||
|
the GNU General Public License.
|
||||||
|
|
||||||
|
See the README file in the top-level LAMMPS directory.
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#ifndef FIX_NVE_SPHERE_H
|
||||||
|
#define FIX_NVE_SPHERE_H
|
||||||
|
|
||||||
|
#include "fix.h"
|
||||||
|
|
||||||
|
namespace LAMMPS_NS {
|
||||||
|
|
||||||
|
class FixNVESphere : public Fix {
|
||||||
|
public:
|
||||||
|
FixNVESphere(class LAMMPS *, int, char **);
|
||||||
|
~FixNVESphere();
|
||||||
|
int setmask();
|
||||||
|
void init();
|
||||||
|
void initial_integrate(int);
|
||||||
|
void final_integrate();
|
||||||
|
void initial_integrate_respa(int, int, int);
|
||||||
|
void final_integrate_respa(int);
|
||||||
|
void reset_dt();
|
||||||
|
|
||||||
|
private:
|
||||||
|
int extra;
|
||||||
|
double dtv,dtf,dtfrotate;
|
||||||
|
double *step_respa;
|
||||||
|
double *dttype;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
10
src/style.h
10
src/style.h
@ -85,8 +85,7 @@ CommandStyle(write_restart,WriteRestart)
|
|||||||
#include "compute_pe_atom.h"
|
#include "compute_pe_atom.h"
|
||||||
#include "compute_pressure.h"
|
#include "compute_pressure.h"
|
||||||
#include "compute_reduce.h"
|
#include "compute_reduce.h"
|
||||||
#include "compute_rotate_dipole.h"
|
#include "compute_erotate_sphere.h"
|
||||||
#include "compute_rotate_gran.h"
|
|
||||||
#include "compute_stress_atom.h"
|
#include "compute_stress_atom.h"
|
||||||
#include "compute_temp.h"
|
#include "compute_temp.h"
|
||||||
#include "compute_temp_com.h"
|
#include "compute_temp_com.h"
|
||||||
@ -94,6 +93,7 @@ CommandStyle(write_restart,WriteRestart)
|
|||||||
#include "compute_temp_partial.h"
|
#include "compute_temp_partial.h"
|
||||||
#include "compute_temp_ramp.h"
|
#include "compute_temp_ramp.h"
|
||||||
#include "compute_temp_region.h"
|
#include "compute_temp_region.h"
|
||||||
|
#include "compute_temp_sphere.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ComputeClass
|
#ifdef ComputeClass
|
||||||
@ -106,8 +106,7 @@ ComputeStyle(pe,ComputePE)
|
|||||||
ComputeStyle(pe/atom,ComputePEAtom)
|
ComputeStyle(pe/atom,ComputePEAtom)
|
||||||
ComputeStyle(pressure,ComputePressure)
|
ComputeStyle(pressure,ComputePressure)
|
||||||
ComputeStyle(reduce,ComputeReduce)
|
ComputeStyle(reduce,ComputeReduce)
|
||||||
ComputeStyle(rotate/dipole,ComputeRotateDipole)
|
ComputeStyle(erotate/sphere,ComputeERotateSphere)
|
||||||
ComputeStyle(rotate/gran,ComputeRotateGran)
|
|
||||||
ComputeStyle(stress/atom,ComputeStressAtom)
|
ComputeStyle(stress/atom,ComputeStressAtom)
|
||||||
ComputeStyle(temp,ComputeTemp)
|
ComputeStyle(temp,ComputeTemp)
|
||||||
ComputeStyle(temp/com,ComputeTempCOM)
|
ComputeStyle(temp/com,ComputeTempCOM)
|
||||||
@ -115,6 +114,7 @@ ComputeStyle(temp/deform,ComputeTempDeform)
|
|||||||
ComputeStyle(temp/partial,ComputeTempPartial)
|
ComputeStyle(temp/partial,ComputeTempPartial)
|
||||||
ComputeStyle(temp/ramp,ComputeTempRamp)
|
ComputeStyle(temp/ramp,ComputeTempRamp)
|
||||||
ComputeStyle(temp/region,ComputeTempRegion)
|
ComputeStyle(temp/region,ComputeTempRegion)
|
||||||
|
ComputeStyle(temp/sphere,ComputeTempSphere)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DihedralInclude
|
#ifdef DihedralInclude
|
||||||
@ -165,6 +165,7 @@ DumpStyle(xyz,DumpXYZ)
|
|||||||
#include "fix_nve.h"
|
#include "fix_nve.h"
|
||||||
#include "fix_nve_limit.h"
|
#include "fix_nve_limit.h"
|
||||||
#include "fix_nve_noforce.h"
|
#include "fix_nve_noforce.h"
|
||||||
|
#include "fix_nve_sphere.h"
|
||||||
#include "fix_nvt.h"
|
#include "fix_nvt.h"
|
||||||
#include "fix_nvt_sllod.h"
|
#include "fix_nvt_sllod.h"
|
||||||
#include "fix_plane_force.h"
|
#include "fix_plane_force.h"
|
||||||
@ -219,6 +220,7 @@ FixStyle(npt,FixNPT)
|
|||||||
FixStyle(nve,FixNVE)
|
FixStyle(nve,FixNVE)
|
||||||
FixStyle(nve/limit,FixNVELimit)
|
FixStyle(nve/limit,FixNVELimit)
|
||||||
FixStyle(nve/noforce,FixNVENoforce)
|
FixStyle(nve/noforce,FixNVENoforce)
|
||||||
|
FixStyle(nve/sphere,FixNVESphere)
|
||||||
FixStyle(nvt,FixNVT)
|
FixStyle(nvt,FixNVT)
|
||||||
FixStyle(nvt/sllod,FixNVTSlodd)
|
FixStyle(nvt/sllod,FixNVTSlodd)
|
||||||
FixStyle(orient/fcc,FixOrientFCC)
|
FixStyle(orient/fcc,FixOrientFCC)
|
||||||
|
|||||||
@ -19,22 +19,6 @@
|
|||||||
AtomStyle(dipole,AtomVecDipole)
|
AtomStyle(dipole,AtomVecDipole)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ComputeInclude
|
|
||||||
#include "compute_temp_dipole.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ComputeClass
|
|
||||||
ComputeStyle(temp/dipole,ComputeTempDipole)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FixInclude
|
|
||||||
#include "fix_nve_dipole.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FixClass
|
|
||||||
FixStyle(nve/dipole,FixNVEDipole)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PairInclude
|
#ifdef PairInclude
|
||||||
#include "pair_dipole_cut.h"
|
#include "pair_dipole_cut.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -21,7 +21,6 @@ AtomStyle(granular,AtomVecGranular)
|
|||||||
|
|
||||||
#ifdef FixInclude
|
#ifdef FixInclude
|
||||||
#include "fix_freeze.h"
|
#include "fix_freeze.h"
|
||||||
#include "fix_nve_gran.h"
|
|
||||||
#include "fix_pour.h"
|
#include "fix_pour.h"
|
||||||
#include "fix_shear_history.h"
|
#include "fix_shear_history.h"
|
||||||
#include "fix_wall_gran.h"
|
#include "fix_wall_gran.h"
|
||||||
@ -29,7 +28,6 @@ AtomStyle(granular,AtomVecGranular)
|
|||||||
|
|
||||||
#ifdef FixClass
|
#ifdef FixClass
|
||||||
FixStyle(freeze,FixFreeze)
|
FixStyle(freeze,FixFreeze)
|
||||||
FixStyle(nve/gran,FixNVEGran)
|
|
||||||
FixStyle(pour,FixPour)
|
FixStyle(pour,FixPour)
|
||||||
FixStyle(SHEAR_HISTORY,FixShearHistory)
|
FixStyle(SHEAR_HISTORY,FixShearHistory)
|
||||||
FixStyle(wall/gran,FixWallGran)
|
FixStyle(wall/gran,FixWallGran)
|
||||||
|
|||||||
105
src/thermo.cpp
105
src/thermo.cpp
@ -44,14 +44,11 @@ using namespace LAMMPS_NS;
|
|||||||
// evdwl, ecoul, epair, ebond, eangle, edihed, eimp, emol, elong, etail
|
// evdwl, ecoul, epair, ebond, eangle, edihed, eimp, emol, elong, etail
|
||||||
// vol, lx, ly, lz, xlo, xhi, ylo, yhi, zlo, zhi, xy, xz, yz
|
// vol, lx, ly, lz, xlo, xhi, ylo, yhi, zlo, zhi, xy, xz, yz
|
||||||
// pxx, pyy, pzz, pxy, pxz, pyz
|
// pxx, pyy, pzz, pxy, pxz, pyz
|
||||||
// drot, grot (rotational KE for dipole and granular particles)
|
|
||||||
|
|
||||||
// customize a new thermo style by adding a DEFINE to this list
|
// customize a new thermo style by adding a DEFINE to this list
|
||||||
|
|
||||||
#define ONE "step temp epair emol etotal press"
|
#define ONE "step temp epair emol etotal press"
|
||||||
#define MULTI "etotal ke temp pe ebond eangle edihed eimp evdwl ecoul elong press"
|
#define MULTI "etotal ke temp pe ebond eangle edihed eimp evdwl ecoul elong press"
|
||||||
#define GRANULAR "step atoms ke grot"
|
|
||||||
#define DIPOLE "step temp epair drot etotal press"
|
|
||||||
|
|
||||||
enum{IGNORE,WARN,ERROR}; // same as write_restart.cpp
|
enum{IGNORE,WARN,ERROR}; // same as write_restart.cpp
|
||||||
enum{ONELINE,MULTILINE};
|
enum{ONELINE,MULTILINE};
|
||||||
@ -97,10 +94,6 @@ Thermo::Thermo(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
|
|||||||
} else if (strcmp(style,"multi") == 0) {
|
} else if (strcmp(style,"multi") == 0) {
|
||||||
strcpy(line,MULTI);
|
strcpy(line,MULTI);
|
||||||
lineflag = MULTILINE;
|
lineflag = MULTILINE;
|
||||||
} else if (strcmp(style,"granular") == 0) {
|
|
||||||
strcpy(line,GRANULAR);
|
|
||||||
} else if (strcmp(style,"dipole") == 0) {
|
|
||||||
strcpy(line,DIPOLE);
|
|
||||||
|
|
||||||
} else if (strcmp(style,"custom") == 0) {
|
} else if (strcmp(style,"custom") == 0) {
|
||||||
if (narg == 1) error->all("Illegal thermo style custom command");
|
if (narg == 1) error->all("Illegal thermo style custom command");
|
||||||
@ -118,18 +111,12 @@ Thermo::Thermo(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
|
|||||||
temperature = NULL;
|
temperature = NULL;
|
||||||
pressure = NULL;
|
pressure = NULL;
|
||||||
pe = NULL;
|
pe = NULL;
|
||||||
rotate_dipole = NULL;
|
|
||||||
rotate_gran = NULL;
|
|
||||||
|
|
||||||
index_temp = index_press_scalar = index_press_vector = index_pe = -1;
|
index_temp = index_press_scalar = index_press_vector = index_pe = -1;
|
||||||
index_drot = index_grot = -1;
|
|
||||||
internal_drot = internal_grot = 0;
|
|
||||||
|
|
||||||
id_temp = (char *) "thermo_temp";
|
id_temp = (char *) "thermo_temp";
|
||||||
id_press = (char *) "thermo_press";
|
id_press = (char *) "thermo_press";
|
||||||
id_pe = (char *) "thermo_pe";
|
id_pe = (char *) "thermo_pe";
|
||||||
id_drot = (char *) "thermo_rotate_dipole";
|
|
||||||
id_grot = (char *) "thermo_rotate_gran";
|
|
||||||
|
|
||||||
// count fields in line
|
// count fields in line
|
||||||
// allocate per-field memory
|
// allocate per-field memory
|
||||||
@ -139,18 +126,6 @@ Thermo::Thermo(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
|
|||||||
allocate();
|
allocate();
|
||||||
parse_fields(line);
|
parse_fields(line);
|
||||||
|
|
||||||
// create the requested compute styles
|
|
||||||
// temperature,pressure,pe always exist b/c Output class created them
|
|
||||||
|
|
||||||
if (index_drot >= 0) {
|
|
||||||
create_compute(id_drot,(char *) "rotate/dipole",NULL);
|
|
||||||
internal_drot = 1;
|
|
||||||
}
|
|
||||||
if (index_grot >= 0) {
|
|
||||||
create_compute(id_grot,(char *) "rotate/gran",NULL);
|
|
||||||
internal_grot = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// format strings
|
// format strings
|
||||||
|
|
||||||
format_multi = (char *) "---------------- Step %8d ----- "
|
format_multi = (char *) "---------------- Step %8d ----- "
|
||||||
@ -170,13 +145,6 @@ Thermo::~Thermo()
|
|||||||
delete [] style;
|
delete [] style;
|
||||||
delete [] line;
|
delete [] line;
|
||||||
|
|
||||||
// delete Compute classes if thermo created them
|
|
||||||
|
|
||||||
if (index_drot >= 0 && internal_drot)
|
|
||||||
modify->delete_compute(id_compute[index_drot]);
|
|
||||||
if (index_grot >= 0 && internal_grot)
|
|
||||||
modify->delete_compute(id_compute[index_grot]);
|
|
||||||
|
|
||||||
deallocate();
|
deallocate();
|
||||||
|
|
||||||
// format strings
|
// format strings
|
||||||
@ -194,7 +162,6 @@ void Thermo::init()
|
|||||||
// set normvalue to default setting unless user has specified it
|
// set normvalue to default setting unless user has specified it
|
||||||
|
|
||||||
if (normuserflag) normvalue = normuser;
|
if (normuserflag) normvalue = normuser;
|
||||||
else if (strcmp(style,"granular") == 0) normvalue = 0;
|
|
||||||
else if (strcmp(update->unit_style,"lj") == 0) normvalue = 1;
|
else if (strcmp(update->unit_style,"lj") == 0) normvalue = 1;
|
||||||
else normvalue = 0;
|
else normvalue = 0;
|
||||||
|
|
||||||
@ -267,8 +234,6 @@ void Thermo::init()
|
|||||||
if (index_press_scalar >= 0) pressure = computes[index_press_scalar];
|
if (index_press_scalar >= 0) pressure = computes[index_press_scalar];
|
||||||
if (index_press_vector >= 0) pressure = computes[index_press_vector];
|
if (index_press_vector >= 0) pressure = computes[index_press_vector];
|
||||||
if (index_pe >= 0) pe = computes[index_pe];
|
if (index_pe >= 0) pe = computes[index_pe];
|
||||||
if (index_drot >= 0) rotate_dipole = computes[index_drot];
|
|
||||||
if (index_grot >= 0) rotate_gran = computes[index_grot];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -455,38 +420,6 @@ void Thermo::modify_params(int narg, char **arg)
|
|||||||
|
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
|
|
||||||
} else if (strcmp(arg[iarg],"drot") == 0) {
|
|
||||||
if (iarg+2 > narg) error->all("Illegal thermo_modify command");
|
|
||||||
if (index_drot < 0) error->all("Thermo style does not use drot");
|
|
||||||
if (internal_drot) {
|
|
||||||
modify->delete_compute(id_compute[index_drot]);
|
|
||||||
internal_drot = 0;
|
|
||||||
}
|
|
||||||
delete [] id_compute[index_drot];
|
|
||||||
int n = strlen(arg[iarg+1]) + 1;
|
|
||||||
id_compute[index_drot] = new char[n];
|
|
||||||
strcpy(id_compute[index_drot],arg[iarg+1]);
|
|
||||||
|
|
||||||
int icompute = modify->find_compute(id_compute[index_drot]);
|
|
||||||
if (icompute < 0) error->all("Could not find thermo_modify drot ID");
|
|
||||||
iarg += 2;
|
|
||||||
|
|
||||||
} else if (strcmp(arg[iarg],"grot") == 0) {
|
|
||||||
if (iarg+2 > narg) error->all("Illegal thermo_modify command");
|
|
||||||
if (index_grot < 0) error->all("Thermo style does not use grot");
|
|
||||||
if (internal_grot) {
|
|
||||||
modify->delete_compute(id_compute[index_grot]);
|
|
||||||
internal_grot = 0;
|
|
||||||
}
|
|
||||||
delete [] id_compute[index_grot];
|
|
||||||
int n = strlen(arg[iarg+1]) + 1;
|
|
||||||
id_compute[index_grot] = new char[n];
|
|
||||||
strcpy(id_compute[index_grot],arg[iarg+1]);
|
|
||||||
|
|
||||||
int icompute = modify->find_compute(id_compute[index_grot]);
|
|
||||||
if (icompute < 0) error->all("Could not find thermo_modify grot ID");
|
|
||||||
iarg += 2;
|
|
||||||
|
|
||||||
} else if (strcmp(arg[iarg],"lost") == 0) {
|
} else if (strcmp(arg[iarg],"lost") == 0) {
|
||||||
if (iarg+2 > narg) error->all("Illegal thermo_modify command");
|
if (iarg+2 > narg) error->all("Illegal thermo_modify command");
|
||||||
if (strcmp(arg[iarg+1],"ignore") == 0) lostflag = IGNORE;
|
if (strcmp(arg[iarg+1],"ignore") == 0) lostflag = IGNORE;
|
||||||
@ -740,13 +673,6 @@ void Thermo::parse_fields(char *str)
|
|||||||
addfield("Pyz",&Thermo::compute_pyz,FLOAT);
|
addfield("Pyz",&Thermo::compute_pyz,FLOAT);
|
||||||
index_press_vector = add_compute(id_press,1);
|
index_press_vector = add_compute(id_press,1);
|
||||||
|
|
||||||
} else if (strcmp(word,"drot") == 0) {
|
|
||||||
addfield("RotKEdip",&Thermo::compute_drot,FLOAT);
|
|
||||||
index_drot = add_compute(id_drot,0);
|
|
||||||
} else if (strcmp(word,"grot") == 0) {
|
|
||||||
addfield("RotKEgrn",&Thermo::compute_grot,FLOAT);
|
|
||||||
index_grot = add_compute(id_grot,0);
|
|
||||||
|
|
||||||
// compute value = c_ID, fix value = f_ID, variable value = v_ID
|
// compute value = c_ID, fix value = f_ID, variable value = v_ID
|
||||||
// if no trailing [], then arg is set to 0, else arg is between []
|
// if no trailing [], then arg is set to 0, else arg is between []
|
||||||
// copy = at most 8 chars of ID to pass to addfield
|
// copy = at most 8 chars of ID to pass to addfield
|
||||||
@ -925,14 +851,6 @@ int Thermo::evaluate_keyword(char *word, double *answer)
|
|||||||
if (!pe)
|
if (!pe)
|
||||||
error->all("Variable uses compute via thermo keyword that thermo does not");
|
error->all("Variable uses compute via thermo keyword that thermo does not");
|
||||||
|
|
||||||
if (strcmp(word,"drot") == 0)
|
|
||||||
if (!rotate_dipole)
|
|
||||||
error->all("Variable uses compute via thermo keyword that thermo does not");
|
|
||||||
|
|
||||||
if (strcmp(word,"grot") == 0)
|
|
||||||
if (!rotate_gran)
|
|
||||||
error->all("Variable uses compute via thermo keyword that thermo does not");
|
|
||||||
|
|
||||||
// set compute_pe invocation flag for keywords that use energy
|
// set compute_pe invocation flag for keywords that use energy
|
||||||
// but don't call compute_pe explicitly
|
// but don't call compute_pe explicitly
|
||||||
|
|
||||||
@ -1004,9 +922,6 @@ int Thermo::evaluate_keyword(char *word, double *answer)
|
|||||||
else if (strcmp(word,"pxy") == 0) compute_pxy();
|
else if (strcmp(word,"pxy") == 0) compute_pxy();
|
||||||
else if (strcmp(word,"pxz") == 0) compute_pxz();
|
else if (strcmp(word,"pxz") == 0) compute_pxz();
|
||||||
else if (strcmp(word,"pyz") == 0) compute_pyz();
|
else if (strcmp(word,"pyz") == 0) compute_pyz();
|
||||||
|
|
||||||
else if (strcmp(word,"drot") == 0) compute_drot();
|
|
||||||
else if (strcmp(word,"grot") == 0) compute_grot();
|
|
||||||
|
|
||||||
else return 1;
|
else return 1;
|
||||||
|
|
||||||
@ -1440,23 +1355,3 @@ void Thermo::compute_pyz()
|
|||||||
pressure->compute_vector();
|
pressure->compute_vector();
|
||||||
dvalue = pressure->vector[5];
|
dvalue = pressure->vector[5];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
void Thermo::compute_drot()
|
|
||||||
{
|
|
||||||
if (thermoflag || rotate_dipole->invoked & INVOKED_SCALAR)
|
|
||||||
dvalue = rotate_dipole->scalar;
|
|
||||||
else dvalue = rotate_dipole->compute_scalar();
|
|
||||||
if (normflag) dvalue /= natoms;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
void Thermo::compute_grot()
|
|
||||||
{
|
|
||||||
if (thermoflag || rotate_gran->invoked & INVOKED_SCALAR)
|
|
||||||
dvalue = rotate_gran->scalar;
|
|
||||||
else dvalue = rotate_gran->compute_scalar();
|
|
||||||
if (normflag) dvalue /= natoms;
|
|
||||||
}
|
|
||||||
|
|||||||
10
src/thermo.h
10
src/thermo.h
@ -66,14 +66,11 @@ class Thermo : protected Pointers {
|
|||||||
|
|
||||||
// data for keyword-specific Compute objects
|
// data for keyword-specific Compute objects
|
||||||
// index = where they are in computes list
|
// index = where they are in computes list
|
||||||
// internal = 1/0 if Thermo created them or not
|
|
||||||
// id = ID of Compute objects
|
// id = ID of Compute objects
|
||||||
// Compute * = ptrs to the Compute objects
|
// Compute * = ptrs to the Compute objects
|
||||||
int index_temp,index_press_scalar,index_press_vector,index_pe;
|
int index_temp,index_press_scalar,index_press_vector,index_pe;
|
||||||
int index_drot,index_grot;
|
char *id_temp,*id_press,*id_pe;
|
||||||
int internal_drot,internal_grot;
|
class Compute *temperature,*pressure,*pe;
|
||||||
char *id_temp,*id_press,*id_pe,*id_drot,*id_grot;
|
|
||||||
class Compute *temperature,*pressure,*pe,*rotate_dipole,*rotate_gran;
|
|
||||||
|
|
||||||
int ncompute; // # of Compute objects called by thermo
|
int ncompute; // # of Compute objects called by thermo
|
||||||
char **id_compute; // their IDs
|
char **id_compute; // their IDs
|
||||||
@ -154,9 +151,6 @@ class Thermo : protected Pointers {
|
|||||||
void compute_pxy();
|
void compute_pxy();
|
||||||
void compute_pyz();
|
void compute_pyz();
|
||||||
void compute_pxz();
|
void compute_pxz();
|
||||||
|
|
||||||
void compute_drot();
|
|
||||||
void compute_grot();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user