git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11935 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp 2014-05-07 14:30:27 +00:00
parent 71699d5d89
commit 53db68362e
16 changed files with 40 additions and 47 deletions

View File

@ -25,7 +25,6 @@
#include "force.h"
#include "domain.h"
#include "modify.h"
#include "fix.h"
#include "group.h"
#include "memory.h"
#include "error.h"
@ -128,9 +127,7 @@ void ComputeTempAsphere::init()
void ComputeTempAsphere::setup()
{
fix_dof = 0;
for (int i = 0; i < modify->nfix; i++)
fix_dof += modify->fix[i]->dof(igroup);
fix_dof = -1;
dof_compute();
}
@ -138,6 +135,8 @@ void ComputeTempAsphere::setup()
void ComputeTempAsphere::dof_compute()
{
if (fix_dof) adjust_dof_fix();
// 6 dof for 3d, 3 dof for 2d
// which dof are included also depends on mode
// assume full rotation of extended particles

View File

@ -23,8 +23,6 @@
#include "update.h"
#include "force.h"
#include "domain.h"
#include "modify.h"
#include "fix.h"
#include "group.h"
#include "error.h"
@ -58,9 +56,7 @@ ComputeTempEff::~ComputeTempEff()
void ComputeTempEff::setup()
{
fix_dof = 0;
for (int i = 0; i < modify->nfix; i++)
fix_dof += modify->fix[i]->dof(igroup);
fix_dof = -1;
dof_compute();
}
@ -68,6 +64,7 @@ void ComputeTempEff::setup()
void ComputeTempEff::dof_compute()
{
if (fix_dof) adjust_dof_fix();
double natoms = group->count(igroup);
dof = domain->dimension * natoms;
dof -= extra_dof + fix_dof;

View File

@ -23,8 +23,6 @@
#include "update.h"
#include "force.h"
#include "group.h"
#include "modify.h"
#include "fix.h"
#include "domain.h"
#include "lattice.h"
#include "error.h"
@ -70,9 +68,7 @@ void ComputeTempRotate::init()
void ComputeTempRotate::setup()
{
fix_dof = 0;
for (int i = 0; i < modify->nfix; i++)
fix_dof += modify->fix[i]->dof(igroup);
fix_dof = -1;
dof_compute();
}
@ -80,6 +76,7 @@ void ComputeTempRotate::setup()
void ComputeTempRotate::dof_compute()
{
if (fix_dof) adjust_dof_fix();
double natoms = group->count(igroup);
int nper = domain->dimension;
dof = nper * natoms;

View File

@ -330,7 +330,7 @@ void Atom::create_avec(const char *style, int narg, char **arg, char *suffix)
// create instance of AtomVec
// use grow() to initialize atom-based arrays to length 1
// so that x[0][0] can always be referenced even if proc has no atoms
// but reset nmax = 0
// but reset nmax = 0 in both Atom and AtomVec
// so 2d arrays like bond_type will later be allocated correctly
// since currently, 2nd dimension bond_per_atom = 0

View File

@ -21,6 +21,8 @@
#include "domain.h"
#include "comm.h"
#include "group.h"
#include "modify.h"
#include "fix.h"
#include "atom_masks.h"
#include "memory.h"
#include "error.h"
@ -131,6 +133,17 @@ void Compute::modify_params(int narg, char **arg)
}
}
/* ----------------------------------------------------------------------
calculate adjustment in DOF due to fixes
------------------------------------------------------------------------- */
void Compute::adjust_dof_fix()
{
fix_dof = 0;
for (int i = 0; i < modify->nfix; i++)
fix_dof += modify->fix[i]->dof(igroup);
}
/* ----------------------------------------------------------------------
reset extra_dof to its default value
------------------------------------------------------------------------- */

View File

@ -86,6 +86,7 @@ class Compute : protected Pointers {
Compute(class LAMMPS *, int, char **);
virtual ~Compute();
void modify_params(int, char **);
void adjust_dof_fix();
void reset_extra_dof();
virtual void init() = 0;
@ -122,6 +123,7 @@ class Compute : protected Pointers {
protected:
int extra_dof; // extra DOF for temperature computes
int fix_dof; // DOF due to fixes
int dynamic; // recount atoms for temperature computes
int thermoflag; // 1 if include fix PE for PE computes

View File

@ -52,9 +52,7 @@ ComputeTemp::~ComputeTemp()
void ComputeTemp::setup()
{
fix_dof = 0;
for (int i = 0; i < modify->nfix; i++)
fix_dof += modify->fix[i]->dof(igroup);
fix_dof = -1;
dof_compute();
}
@ -62,6 +60,7 @@ void ComputeTemp::setup()
void ComputeTemp::dof_compute()
{
if (fix_dof) adjust_dof_fix();
double natoms = group->count(igroup);
dof = domain->dimension * natoms;
dof -= extra_dof + fix_dof;

View File

@ -34,7 +34,6 @@ class ComputeTemp : public Compute {
void compute_vector();
protected:
int fix_dof;
double tfactor;
virtual void dof_compute();

View File

@ -19,8 +19,6 @@
#include "update.h"
#include "force.h"
#include "group.h"
#include "modify.h"
#include "fix.h"
#include "domain.h"
#include "lattice.h"
#include "error.h"
@ -62,9 +60,7 @@ void ComputeTempCOM::init()
void ComputeTempCOM::setup()
{
fix_dof = 0;
for (int i = 0; i < modify->nfix; i++)
fix_dof += modify->fix[i]->dof(igroup);
fix_dof = -1;
dof_compute();
}
@ -72,6 +68,7 @@ void ComputeTempCOM::setup()
void ComputeTempCOM::dof_compute()
{
if (fix_dof) adjust_dof_fix();
double natoms = group->count(igroup);
int nper = domain->dimension;
dof = nper * natoms;

View File

@ -86,9 +86,7 @@ void ComputeTempDeform::init()
void ComputeTempDeform::setup()
{
fix_dof = 0;
for (int i = 0; i < modify->nfix; i++)
fix_dof += modify->fix[i]->dof(igroup);
fix_dof = -1;
dof_compute();
}
@ -96,6 +94,7 @@ void ComputeTempDeform::setup()
void ComputeTempDeform::dof_compute()
{
if (fix_dof) adjust_dof_fix();
double natoms = group->count(igroup);
dof = domain->dimension * natoms;
dof -= extra_dof + fix_dof;

View File

@ -18,8 +18,6 @@
#include "update.h"
#include "force.h"
#include "domain.h"
#include "modify.h"
#include "fix.h"
#include "group.h"
#include "memory.h"
#include "error.h"
@ -63,9 +61,7 @@ ComputeTempPartial::~ComputeTempPartial()
void ComputeTempPartial::setup()
{
fix_dof = 0;
for (int i = 0; i < modify->nfix; i++)
fix_dof += modify->fix[i]->dof(igroup);
fix_dof = -1;
dof_compute();
}
@ -76,6 +72,7 @@ void ComputeTempPartial::setup()
void ComputeTempPartial::dof_compute()
{
if (fix_dof) adjust_dof_fix();
double natoms = group->count(igroup);
int nper = xflag+yflag+zflag;
dof = nper * natoms;

View File

@ -161,9 +161,7 @@ ComputeTempProfile::~ComputeTempProfile()
void ComputeTempProfile::init()
{
fix_dof = 0;
for (int i = 0; i < modify->nfix; i++)
fix_dof += modify->fix[i]->dof(igroup);
fix_dof = -1;
dof_compute();
// ptrs to domain data
@ -189,9 +187,7 @@ void ComputeTempProfile::init()
void ComputeTempProfile::setup()
{
fix_dof = 0;
for (int i = 0; i < modify->nfix; i++)
fix_dof += modify->fix[i]->dof(igroup);
fix_dof = -1;
dof_compute();
}
@ -199,6 +195,7 @@ void ComputeTempProfile::setup()
void ComputeTempProfile::dof_compute()
{
if (fix_dof) adjust_dof_fix();
double natoms = group->count(igroup);
int nper = domain->dimension;
dof = nper * natoms;

View File

@ -117,9 +117,7 @@ ComputeTempRamp::~ComputeTempRamp()
void ComputeTempRamp::setup()
{
fix_dof = 0;
for (int i = 0; i < modify->nfix; i++)
fix_dof += modify->fix[i]->dof(igroup);
fix_dof = -1;
dof_compute();
}
@ -127,6 +125,7 @@ void ComputeTempRamp::setup()
void ComputeTempRamp::dof_compute()
{
if (fix_dof) adjust_dof_fix();
double natoms = group->count(igroup);
int nper = domain->dimension;
dof = nper * natoms;

View File

@ -17,7 +17,6 @@
#include "atom.h"
#include "update.h"
#include "force.h"
#include "modify.h"
#include "domain.h"
#include "region.h"
#include "memory.h"

View File

@ -20,7 +20,6 @@
#include "force.h"
#include "domain.h"
#include "modify.h"
#include "fix.h"
#include "group.h"
#include "error.h"
@ -109,9 +108,7 @@ void ComputeTempSphere::init()
void ComputeTempSphere::setup()
{
fix_dof = 0;
for (int i = 0; i < modify->nfix; i++)
fix_dof += modify->fix[i]->dof(igroup);
fix_dof = -1;
dof_compute();
}
@ -121,6 +118,8 @@ void ComputeTempSphere::dof_compute()
{
int count,count_all;
if (fix_dof) adjust_dof_fix();
// 6 or 3 dof for extended/point particles for 3d
// 3 or 2 dof for extended/point particles for 2d
// which dof are included also depends on mode

View File

@ -271,7 +271,7 @@ void Modify::init()
void Modify::setup(int vflag)
{
// compute setup needs to come before fix setup
// b/c NH fixes need use DOF of temperature computes
// b/c NH fixes need DOF of temperature computes
for (int i = 0; i < ncompute; i++) compute[i]->setup();