mirror of https://github.com/lammps/lammps.git
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@1606 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
parent
8d4819a04d
commit
c939c91289
|
@ -6,7 +6,6 @@ if ($1 == 1) then
|
|||
|
||||
cp atom_vec_granular.cpp ..
|
||||
cp fix_freeze.cpp ..
|
||||
cp fix_nve_gran.cpp ..
|
||||
cp fix_pour.cpp ..
|
||||
cp fix_wall_gran.cpp ..
|
||||
cp pair_gran_hertzian.cpp ..
|
||||
|
@ -15,7 +14,6 @@ if ($1 == 1) then
|
|||
|
||||
cp atom_vec_granular.h ..
|
||||
cp fix_freeze.h ..
|
||||
cp fix_nve_gran.h ..
|
||||
cp fix_pour.h ..
|
||||
cp fix_wall_gran.h ..
|
||||
cp pair_gran_hertzian.h ..
|
||||
|
@ -29,7 +27,6 @@ else if ($1 == 0) then
|
|||
|
||||
rm ../atom_vec_granular.cpp
|
||||
rm ../fix_freeze.cpp
|
||||
rm ../fix_nve_gran.cpp
|
||||
rm ../fix_pour.cpp
|
||||
rm ../fix_wall_gran.cpp
|
||||
rm ../pair_gran_hertzian.cpp
|
||||
|
@ -38,7 +35,6 @@ else if ($1 == 0) then
|
|||
|
||||
rm ../atom_vec_granular.h
|
||||
rm ../fix_freeze.h
|
||||
rm ../fix_nve_gran.h
|
||||
rm ../fix_pour.h
|
||||
rm ../fix_wall_gran.h
|
||||
rm ../pair_gran_hertzian.h
|
||||
|
|
|
@ -1,141 +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 "stdio.h"
|
||||
#include "string.h"
|
||||
#include "fix_nve_gran.h"
|
||||
#include "atom.h"
|
||||
#include "update.h"
|
||||
#include "force.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
// moments of inertia for sphere and disk
|
||||
|
||||
#define INERTIA3D 0.4
|
||||
#define INERTIA2D 0.5
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixNVEGran::FixNVEGran(LAMMPS *lmp, int narg, char **arg) :
|
||||
Fix(lmp, narg, arg)
|
||||
{
|
||||
if (narg != 3) error->all("Illegal fix nve/gran command");
|
||||
|
||||
if (!atom->xorient_flag || !atom->omega_flag || !atom->torque_flag)
|
||||
error->all("Fix nve/gran requires atom attributes "
|
||||
"xorient, omega, torque");
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
int FixNVEGran::setmask()
|
||||
{
|
||||
int mask = 0;
|
||||
mask |= INITIAL_INTEGRATE;
|
||||
mask |= FINAL_INTEGRATE;
|
||||
return mask;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void FixNVEGran::init()
|
||||
{
|
||||
dtv = update->dt;
|
||||
dtf = 0.5 * update->dt * force->ftm2v;
|
||||
if (domain->dimension == 3) dtfrotate = dtf / INERTIA3D;
|
||||
else dtfrotate = dtf / INERTIA2D;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void FixNVEGran::initial_integrate(int vflag)
|
||||
{
|
||||
double dtfm;
|
||||
|
||||
double **x = atom->x;
|
||||
double **v = atom->v;
|
||||
double **f = atom->f;
|
||||
double **xorient = atom->xorient;
|
||||
double **omega = atom->omega;
|
||||
double **torque = atom->torque;
|
||||
double *rmass = atom->rmass;
|
||||
double *radius = atom->radius;
|
||||
int *mask = atom->mask;
|
||||
int nlocal = atom->nlocal;
|
||||
if (igroup == atom->firstgroup) nlocal = atom->nfirst;
|
||||
|
||||
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];
|
||||
|
||||
dtfm = dtfrotate / (radius[i]*radius[i]*rmass[i]);
|
||||
omega[i][0] += dtfm * torque[i][0];
|
||||
omega[i][1] += dtfm * torque[i][1];
|
||||
omega[i][2] += dtfm * torque[i][2];
|
||||
xorient[i][0] += dtv * omega[i][0];
|
||||
xorient[i][1] += dtv * omega[i][1];
|
||||
xorient[i][2] += dtv * omega[i][2];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void FixNVEGran::final_integrate()
|
||||
{
|
||||
double dtfm;
|
||||
|
||||
double **v = atom->v;
|
||||
double **f = atom->f;
|
||||
double **omega = atom->omega;
|
||||
double **torque = atom->torque;
|
||||
double *rmass = atom->rmass;
|
||||
double *radius = atom->radius;
|
||||
int *mask = atom->mask;
|
||||
int nlocal = atom->nlocal;
|
||||
if (igroup == atom->firstgroup) nlocal = atom->nfirst;
|
||||
|
||||
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];
|
||||
|
||||
dtfm = dtfrotate / (radius[i]*radius[i]*rmass[i]);
|
||||
omega[i][0] += dtfm * torque[i][0];
|
||||
omega[i][1] += dtfm * torque[i][1];
|
||||
omega[i][2] += dtfm * torque[i][2];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void FixNVEGran::reset_dt()
|
||||
{
|
||||
dtv = update->dt;
|
||||
dtf = 0.5 * update->dt * force->ftm2v;
|
||||
if (domain->dimension == 3) dtfrotate = dtf / INERTIA3D;
|
||||
else dtfrotate = dtf / INERTIA2D;
|
||||
}
|
||||
|
|
@ -1,36 +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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef FIX_NVE_GRAN_H
|
||||
#define FIX_NVE_GRAN_H
|
||||
|
||||
#include "fix.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class FixNVEGran : public Fix {
|
||||
public:
|
||||
FixNVEGran(class LAMMPS *, int, char **);
|
||||
int setmask();
|
||||
void init();
|
||||
void initial_integrate(int);
|
||||
void final_integrate();
|
||||
void reset_dt();
|
||||
|
||||
private:
|
||||
double dtv,dtf,dtfrotate;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -21,7 +21,6 @@ AtomStyle(granular,AtomVecGranular)
|
|||
|
||||
#ifdef FixInclude
|
||||
#include "fix_freeze.h"
|
||||
#include "fix_nve_gran.h"
|
||||
#include "fix_pour.h"
|
||||
#include "fix_shear_history.h"
|
||||
#include "fix_wall_gran.h"
|
||||
|
@ -29,7 +28,6 @@ AtomStyle(granular,AtomVecGranular)
|
|||
|
||||
#ifdef FixClass
|
||||
FixStyle(freeze,FixFreeze)
|
||||
FixStyle(nve/gran,FixNVEGran)
|
||||
FixStyle(pour,FixPour)
|
||||
FixStyle(SHEAR_HISTORY,FixShearHistory)
|
||||
FixStyle(wall/gran,FixWallGran)
|
||||
|
|
Loading…
Reference in New Issue