Merge remote-tracking branch 'lammps-ro/master' into lammps-icms

Resolved Conflicts:
	doc/Manual.html
	doc/Manual.txt
	src/MISC/fix_efield.cpp
	src/fix_addforce.cpp
	src/fix_move.cpp
	src/fix_setforce.cpp
This commit is contained in:
Axel Kohlmeyer
2014-05-08 08:49:17 -04:00
61 changed files with 224 additions and 287 deletions

View File

@ -1,7 +1,7 @@
<HTML>
<HEAD>
<TITLE>LAMMPS-ICMS Users Manual</TITLE>
<META NAME="docnumber" CONTENT="8 May 2014 version">
<META NAME="docnumber" CONTENT="9 May 2014 version">
<META NAME="author" CONTENT="http://lammps.sandia.gov - Sandia National Laboratories">
<META NAME="copyright" CONTENT="Copyright (2003) Sandia Corporation. This software and manual is distributed under the GNU General Public License.">
</HEAD>
@ -22,7 +22,7 @@
<CENTER><H3>LAMMPS-ICMS Documentation
</H3></CENTER>
<CENTER><H4>8 May 2014 version
<CENTER><H4>9 May 2014 version
</H4></CENTER>
<H4>Version info:
</H4>

View File

@ -1,6 +1,6 @@
<HEAD>
<TITLE>LAMMPS-ICMS Users Manual</TITLE>
<META NAME="docnumber" CONTENT="8 May 2014 version">
<META NAME="docnumber" CONTENT="9 May 2014 version">
<META NAME="author" CONTENT="http://lammps.sandia.gov - Sandia National Laboratories">
<META NAME="copyright" CONTENT="Copyright (2003) Sandia Corporation. This software and manual is distributed under the GNU General Public License.">
</HEAD>
@ -18,7 +18,7 @@
<H1></H1>
LAMMPS-ICMS Documentation :c,h3
8 May 2014 version :c,h4
9 May 2014 version :c,h4
Version info: :h4

View File

@ -49,17 +49,28 @@ unfix 2
reset_timestep 0
# Define distinct components of symmetric traceless stress tensor
variable pxy equal pxy
variable pxx equal pxx-press
fix SS all ave/correlate $s $p $d &
v_pxy type auto file profile.gk.2d ave running
v_pxy v_pxx type auto file profile.gk.2d ave running
# Diagonal components of SS are larger by factor 2-2/d,
# which is 4/3 for d=3, but 1 for d=2.
# See Daivis and Evans, J.Chem.Phys, 100, 541-547 (1994)
variable scale equal 1.0/$t*vol*$s*dt
variable v11 equal trap(f_SS[3])*${scale}
variable diagfac equal 2-2/2
variable vxy equal trap(f_SS[3])*${scale}
variable vxx equal trap(f_SS[4])*${scale}/${diagfac}
thermo_style custom step temp press pxy v_v11
thermo_style custom step temp press pxy v_vxy v_vxx
run 500000
variable eta equal v_v11
variable etaxy equal v_vxy
variable etaxx equal v_vxx
variable eta equal 0.5*(${etaxy}+${etaxx})
print "running average viscosity: ${eta}"

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

@ -39,7 +39,7 @@ class ComputeTempAsphere : public Compute {
void restore_bias_thr(int, double *, double *);
private:
int fix_dof,mode;
int mode;
double tfactor;
char *id_bias;
class Compute *tbias; // ptr to additional bias compute

View File

@ -24,8 +24,6 @@
using namespace LAMMPS_NS;
#define DELTA 10000
/* ---------------------------------------------------------------------- */
AtomVecDipole::AtomVecDipole(LAMMPS *lmp) : AtomVec(lmp)
@ -48,13 +46,13 @@ AtomVecDipole::AtomVecDipole(LAMMPS *lmp) : AtomVec(lmp)
/* ----------------------------------------------------------------------
grow atom arrays
n = 0 grows arrays by DELTA
n = 0 grows arrays by a chunk
n > 0 allocates arrays to size n
------------------------------------------------------------------------- */
void AtomVecDipole::grow(int n)
{
if (n == 0) nmax += DELTA;
if (n == 0) grow_nmax();
else nmax = n;
atom->nmax = nmax;
if (nmax < 0 || nmax > MAXSMALLINT)

View File

@ -114,8 +114,8 @@ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) :
force_flag = 0;
fsum[0] = fsum[1] = fsum[2] = fsum[3] = 0.0;
maxatom = -1;
efield = NULL;
maxatom = atom->nmax;
memory->create(efield,maxatom,4,"efield:efield");
}
/* ---------------------------------------------------------------------- */
@ -332,24 +332,16 @@ void FixEfield::post_force(int vflag)
modify->clearstep_compute();
if (xstyle == EQUAL) ex = qe2f * input->variable->compute_equal(xvar);
else if (xstyle == ATOM) {
if (efield) input->variable->compute_atom(xvar,igroup,&efield[0][0],3,0);
else input->variable->compute_atom(xvar,igroup,NULL,3,0);
}
else if (xstyle == ATOM)
input->variable->compute_atom(xvar,igroup,&efield[0][0],3,0);
if (ystyle == EQUAL) ey = qe2f * input->variable->compute_equal(yvar);
else if (ystyle == ATOM) {
if (efield) input->variable->compute_atom(yvar,igroup,&efield[0][1],3,0);
else input->variable->compute_atom(yvar,igroup,NULL,3,0);
}
else if (ystyle == ATOM)
input->variable->compute_atom(yvar,igroup,&efield[0][1],3,0);
if (zstyle == EQUAL) ez = qe2f * input->variable->compute_equal(zvar);
else if (zstyle == ATOM) {
if (efield) input->variable->compute_atom(zvar,igroup,&efield[0][2],3,0);
else input->variable->compute_atom(zvar,igroup,NULL,3,0);
}
if (estyle == ATOM) {
if (efield) input->variable->compute_atom(evar,igroup,&efield[0][3],4,0);
else input->variable->compute_atom(evar,igroup,NULL,4,0);
}
else if (zstyle == ATOM)
input->variable->compute_atom(zvar,igroup,&efield[0][2],3,0);
if (estyle == ATOM)
input->variable->compute_atom(evar,igroup,&efield[0][3],4,0);
modify->addstep_compute(update->ntimestep + 1);

View File

@ -23,8 +23,6 @@
using namespace LAMMPS_NS;
#define DELTA 10000
/* ---------------------------------------------------------------------- */
AtomVecAngle::AtomVecAngle(LAMMPS *lmp) : AtomVec(lmp)
@ -47,13 +45,13 @@ AtomVecAngle::AtomVecAngle(LAMMPS *lmp) : AtomVec(lmp)
/* ----------------------------------------------------------------------
grow atom arrays
n = 0 grows arrays by DELTA
n = 0 grows arrays by a chunk
n > 0 allocates arrays to size n
------------------------------------------------------------------------- */
void AtomVecAngle::grow(int n)
{
if (n == 0) nmax += DELTA;
if (n == 0) grow_nmax();
else nmax = n;
atom->nmax = nmax;
if (nmax < 0 || nmax > MAXSMALLINT)

View File

@ -23,8 +23,6 @@
using namespace LAMMPS_NS;
#define DELTA 10000
/* ---------------------------------------------------------------------- */
AtomVecBond::AtomVecBond(LAMMPS *lmp) : AtomVec(lmp)
@ -47,13 +45,13 @@ AtomVecBond::AtomVecBond(LAMMPS *lmp) : AtomVec(lmp)
/* ----------------------------------------------------------------------
grow atom arrays
n = 0 grows arrays by DELTA
n = 0 grows arrays by a chunk
n > 0 allocates arrays to size n
------------------------------------------------------------------------- */
void AtomVecBond::grow(int n)
{
if (n == 0) nmax += DELTA;
if (n == 0) grow_nmax();
else nmax = n;
atom->nmax = nmax;
if (nmax < 0 || nmax > MAXSMALLINT)

View File

@ -23,8 +23,6 @@
using namespace LAMMPS_NS;
#define DELTA 10000
/* ---------------------------------------------------------------------- */
AtomVecFull::AtomVecFull(LAMMPS *lmp) : AtomVec(lmp)
@ -47,13 +45,13 @@ AtomVecFull::AtomVecFull(LAMMPS *lmp) : AtomVec(lmp)
/* ----------------------------------------------------------------------
grow atom arrays
n = 0 grows arrays by DELTA
n = 0 grows arrays by a chunk
n > 0 allocates arrays to size n
------------------------------------------------------------------------- */
void AtomVecFull::grow(int n)
{
if (n == 0) nmax += DELTA;
if (n == 0) grow_nmax();
else nmax = n;
atom->nmax = nmax;
if (nmax < 0 || nmax > MAXSMALLINT)

View File

@ -23,8 +23,6 @@
using namespace LAMMPS_NS;
#define DELTA 10000
/* ---------------------------------------------------------------------- */
AtomVecMolecular::AtomVecMolecular(LAMMPS *lmp) : AtomVec(lmp)
@ -47,13 +45,13 @@ AtomVecMolecular::AtomVecMolecular(LAMMPS *lmp) : AtomVec(lmp)
/* ----------------------------------------------------------------------
grow atom arrays
n = 0 grows arrays by DELTA
n = 0 grows arrays by a chunk
n > 0 allocates arrays to size n
------------------------------------------------------------------------- */
void AtomVecMolecular::grow(int n)
{
if (n == 0) nmax += DELTA;
if (n == 0) grow_nmax();
else nmax = n;
atom->nmax = nmax;
if (nmax < 0 || nmax > MAXSMALLINT)

View File

@ -25,8 +25,6 @@
using namespace LAMMPS_NS;
#define DELTA 10000
/* ---------------------------------------------------------------------- */
AtomVecTemplate::AtomVecTemplate(LAMMPS *lmp) : AtomVec(lmp)
@ -90,13 +88,13 @@ void AtomVecTemplate::process_args(int narg, char **arg)
/* ----------------------------------------------------------------------
grow atom arrays
n = 0 grows arrays by DELTA
n = 0 grows arrays by a chunk
n > 0 allocates arrays to size n
------------------------------------------------------------------------- */
void AtomVecTemplate::grow(int n)
{
if (n == 0) nmax += DELTA;
if (n == 0) grow_nmax();
else nmax = n;
atom->nmax = nmax;
if (nmax < 0 || nmax > MAXSMALLINT)

View File

@ -29,8 +29,6 @@
using namespace LAMMPS_NS;
#define DELTA 10000
static const char cite_peri_package[] =
"PERI package for Peridynamics:\n\n"
"@Article{Parks08,\n"
@ -66,13 +64,13 @@ AtomVecPeri::AtomVecPeri(LAMMPS *lmp) : AtomVec(lmp)
/* ----------------------------------------------------------------------
grow atom arrays
n = 0 grows arrays by DELTA
n = 0 grows arrays by a chunk
n > 0 allocates arrays to size n
------------------------------------------------------------------------- */
void AtomVecPeri::grow(int n)
{
if (n == 0) nmax += DELTA;
if (n == 0) grow_nmax();
else nmax = n;
atom->nmax = nmax;
if (nmax < 0 || nmax > MAXSMALLINT)

View File

@ -29,8 +29,6 @@
using namespace LAMMPS_NS;
#define DELTA 10000
/* ---------------------------------------------------------------------- */
AtomVecWavepacket::AtomVecWavepacket(LAMMPS *lmp) : AtomVec(lmp)
@ -58,13 +56,13 @@ AtomVecWavepacket::AtomVecWavepacket(LAMMPS *lmp) : AtomVec(lmp)
/* ----------------------------------------------------------------------
grow atom-electron arrays
n = 0 grows arrays by DELTA
n = 0 grows arrays by a chunk
n > 0 allocates arrays to size n
------------------------------------------------------------------------- */
void AtomVecWavepacket::grow(int n)
{
if (n == 0) nmax += DELTA;
if (n == 0) grow_nmax();
else nmax = n;
atom->nmax = nmax;

View File

@ -52,7 +52,6 @@
using namespace LAMMPS_NS;
#define DELTA 10000
#define BUFFACTOR 1.5
#define BUFEXTRA 1000
#define NCUDAEXCHANGE 12 //nextra x y z vx vy vz tag type mask image molecule

View File

@ -51,7 +51,6 @@
using namespace LAMMPS_NS;
#define DELTA 10000
#define BUFFACTOR 1.5
#define BUFEXTRA 1000
#define NCUDAEXCHANGE 11 //nextra x y z vx vy vz tag type mask image

View File

@ -51,7 +51,6 @@
using namespace LAMMPS_NS;
#define DELTA 10000
#define BUFFACTOR 1.5
#define BUFEXTRA 1000
#define NCUDAEXCHANGE 12 //nextra x y z vx vy vz tag type mask image q

View File

@ -52,7 +52,6 @@
using namespace LAMMPS_NS;
#define DELTA 10000
#define BUFFACTOR 1.5
#define BUFEXTRA 1000
#define NCUDAEXCHANGE 13 //nextra x y z vx vy vz tag type mask image q molecule

View File

@ -30,8 +30,6 @@
using namespace LAMMPS_NS;
#define DELTA 10000
static const char cite_user_eff_package[] =
"USER-EFF package:\n\n"
"@Article{Jaramillo-Botero11,\n"
@ -71,13 +69,13 @@ AtomVecElectron::AtomVecElectron(LAMMPS *lmp) : AtomVec(lmp)
/* ----------------------------------------------------------------------
grow atom-electron arrays
n = 0 grows arrays by DELTA
n = 0 grows arrays by a chunk
n > 0 allocates arrays to size n
------------------------------------------------------------------------- */
void AtomVecElectron::grow(int n)
{
if (n == 0) nmax += DELTA;
if (n == 0) grow_nmax();
else nmax = n;
atom->nmax = nmax;

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

@ -23,8 +23,6 @@
using namespace LAMMPS_NS;
#define DELTA 10000
/* ---------------------------------------------------------------------- */
AtomVecMeso::AtomVecMeso(LAMMPS *lmp) : AtomVec(lmp)
@ -50,15 +48,14 @@ AtomVecMeso::AtomVecMeso(LAMMPS *lmp) : AtomVec(lmp)
/* ----------------------------------------------------------------------
grow atom arrays
n = 0 grows arrays by DELTA
n = 0 grows arrays by a chunk
n > 0 allocates arrays to size n
------------------------------------------------------------------------- */
void AtomVecMeso::grow(int n) {
if (n == 0)
nmax += DELTA;
else
nmax = n;
void AtomVecMeso::grow(int n)
{
if (n == 0) grow_nmax();
else nmax = n;
atom->nmax = nmax;
if (nmax < 0 || nmax > MAXSMALLINT)
error->one(FLERR,"Per-processor system is too big");

View File

@ -330,17 +330,12 @@ 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
// so 2d arrays like bond_type will later be allocated correctly
// since currently, 2nd dimension bond_per_atom = 0
int sflag;
avec = new_avec(style,suffix,sflag);
avec->store_args(narg,arg);
avec->process_args(narg,arg);
avec->grow(1);
nmax = 0;
avec->reset();
if (sflag) {
char estyle[256];
@ -640,6 +635,48 @@ int Atom::count_words(const char *line)
return n;
}
/* ----------------------------------------------------------------------
deallocate molecular topology arrays
done before realloc with (possibly) new 2nd dimension set to
correctly initialized per-atom values, e.g. bond_per_atom
needs to be called whenever 2nd dimensions are changed
and these arrays are already pre-allocated,
e.g. due to grow(1) in create_avec()
------------------------------------------------------------------------- */
void Atom::deallocate_topology()
{
memory->destroy(atom->bond_type);
memory->destroy(atom->bond_atom);
atom->bond_type = NULL;
atom->bond_atom = NULL;
memory->destroy(atom->angle_type);
memory->destroy(atom->angle_atom1);
memory->destroy(atom->angle_atom2);
memory->destroy(atom->angle_atom3);
atom->angle_type = NULL;
atom->angle_atom1 = atom->angle_atom2 = atom->angle_atom3 = NULL;
memory->destroy(atom->dihedral_type);
memory->destroy(atom->dihedral_atom1);
memory->destroy(atom->dihedral_atom2);
memory->destroy(atom->dihedral_atom3);
memory->destroy(atom->dihedral_atom4);
atom->dihedral_type = NULL;
atom->dihedral_atom1 = atom->dihedral_atom2 =
atom->dihedral_atom3 = atom->dihedral_atom4 = NULL;
memory->destroy(atom->improper_type);
memory->destroy(atom->improper_atom1);
memory->destroy(atom->improper_atom2);
memory->destroy(atom->improper_atom3);
memory->destroy(atom->improper_atom4);
atom->improper_type = NULL;
atom->improper_atom1 = atom->improper_atom2 =
atom->improper_atom3 = atom->improper_atom4 = NULL;
}
/* ----------------------------------------------------------------------
unpack n lines from Atom section of data file
call style-specific routine to parse line

View File

@ -176,6 +176,8 @@ class Atom : protected Pointers {
int parse_data(const char *);
int count_words(const char *);
void deallocate_topology();
void data_atoms(int, char *);
void data_vels(int, char *);

View File

@ -21,6 +21,9 @@
using namespace LAMMPS_NS;
#define DELTA 16384
#define DELTA_BONUS 8192
/* ---------------------------------------------------------------------- */
AtomVec::AtomVec(LAMMPS *lmp) : Pointers(lmp)
@ -82,12 +85,24 @@ void AtomVec::init()
}
/* ----------------------------------------------------------------------
reset nmax = 0, called by Atom::create_avec() when new atom style created
grow nmax so it is a multiple of DELTA
------------------------------------------------------------------------- */
void AtomVec::reset()
void AtomVec::grow_nmax()
{
nmax = 0;
nmax = nmax/DELTA * DELTA;
nmax += DELTA;
}
/* ----------------------------------------------------------------------
grow nmax_bonus so it is a multiple of DELTA_BONUS
------------------------------------------------------------------------- */
int AtomVec::grow_nmax_bonus(int nmax_bonus)
{
nmax_bonus = nmax_bonus/DELTA_BONUS * DELTA_BONUS;
nmax_bonus += DELTA_BONUS;
return nmax_bonus;
}
/* ----------------------------------------------------------------------

View File

@ -103,7 +103,6 @@ class AtomVec : protected Pointers {
virtual void write_vel(FILE *, int, double **);
virtual int write_vel_hybrid(FILE *, double *) {return 0;}
void reset();
int pack_bond(tagint **);
void write_bond(FILE *, int, tagint **, int);
int pack_angle(tagint **);
@ -139,6 +138,9 @@ class AtomVec : protected Pointers {
ubuf(int64_t arg) : i(arg) {}
ubuf(int arg) : i(arg) {}
};
void grow_nmax();
int grow_nmax_bonus(int);
};
}

View File

@ -23,8 +23,6 @@
using namespace LAMMPS_NS;
#define DELTA 10000
/* ---------------------------------------------------------------------- */
AtomVecAtomic::AtomVecAtomic(LAMMPS *lmp) : AtomVec(lmp)
@ -44,13 +42,13 @@ AtomVecAtomic::AtomVecAtomic(LAMMPS *lmp) : AtomVec(lmp)
/* ----------------------------------------------------------------------
grow atom arrays
n = 0 grows arrays by DELTA
n = 0 grows arrays by a chunk
n > 0 allocates arrays to size n
------------------------------------------------------------------------- */
void AtomVecAtomic::grow(int n)
{
if (n == 0) nmax += DELTA;
if (n == 0) grow_nmax();
else nmax = n;
atom->nmax = nmax;
if (nmax < 0 || nmax > MAXSMALLINT)

View File

@ -28,9 +28,6 @@
using namespace LAMMPS_NS;
#define DELTA 10000
#define DELTA_BONUS 10000
/* ---------------------------------------------------------------------- */
AtomVecBody::AtomVecBody(LAMMPS *lmp) : AtomVec(lmp)
@ -109,13 +106,13 @@ void AtomVecBody::process_args(int narg, char **arg)
/* ----------------------------------------------------------------------
grow atom arrays
n = 0 grows arrays by DELTA
n = 0 grows arrays by a chunk
n > 0 allocates arrays to size n
------------------------------------------------------------------------- */
void AtomVecBody::grow(int n)
{
if (n == 0) nmax += DELTA;
if (n == 0) grow_nmax();
else nmax = n;
atom->nmax = nmax;
if (nmax < 0 || nmax > MAXSMALLINT)
@ -158,7 +155,7 @@ void AtomVecBody::grow_reset()
void AtomVecBody::grow_bonus()
{
nmax_bonus += DELTA_BONUS;
nmax_bonus = grow_nmax_bonus(nmax_bonus);
if (nmax_bonus < 0 || nmax_bonus > MAXSMALLINT)
error->one(FLERR,"Per-processor system is too big");

View File

@ -23,8 +23,6 @@
using namespace LAMMPS_NS;
#define DELTA 10000
/* ---------------------------------------------------------------------- */
AtomVecCharge::AtomVecCharge(LAMMPS *lmp) : AtomVec(lmp)
@ -46,13 +44,13 @@ AtomVecCharge::AtomVecCharge(LAMMPS *lmp) : AtomVec(lmp)
/* ----------------------------------------------------------------------
grow atom arrays
n = 0 grows arrays by DELTA
n = 0 grows arrays by a chunk
n > 0 allocates arrays to size n
------------------------------------------------------------------------- */
void AtomVecCharge::grow(int n)
{
if (n == 0) nmax += DELTA;
if (n == 0) grow_nmax();
else nmax = n;
atom->nmax = nmax;
if (nmax < 0 || nmax > MAXSMALLINT)

View File

@ -31,9 +31,6 @@
using namespace LAMMPS_NS;
using namespace MathConst;
#define DELTA 10000
#define DELTA_BONUS 10000
/* ---------------------------------------------------------------------- */
AtomVecEllipsoid::AtomVecEllipsoid(LAMMPS *lmp) : AtomVec(lmp)
@ -66,13 +63,13 @@ AtomVecEllipsoid::~AtomVecEllipsoid()
/* ----------------------------------------------------------------------
grow atom arrays
n = 0 grows arrays by DELTA
n = 0 grows arrays by a chunk
n > 0 allocates arrays to size n
------------------------------------------------------------------------- */
void AtomVecEllipsoid::grow(int n)
{
if (n == 0) nmax += DELTA;
if (n == 0) grow_nmax();
else nmax = n;
atom->nmax = nmax;
if (nmax < 0 || nmax > MAXSMALLINT)
@ -115,7 +112,7 @@ void AtomVecEllipsoid::grow_reset()
void AtomVecEllipsoid::grow_bonus()
{
nmax_bonus += DELTA_BONUS;
nmax_bonus = grow_nmax_bonus(nmax_bonus);
if (nmax_bonus < 0 || nmax_bonus > MAXSMALLINT)
error->one(FLERR,"Per-processor system is too big");

View File

@ -23,8 +23,6 @@
using namespace LAMMPS_NS;
#define DELTA 10000
/* ---------------------------------------------------------------------- */
AtomVecHybrid::AtomVecHybrid(LAMMPS *lmp) : AtomVec(lmp) {}
@ -135,13 +133,13 @@ void AtomVecHybrid::init()
/* ----------------------------------------------------------------------
grow atom arrays
n = 0 grows arrays by DELTA
n = 0 grows arrays by a chunk
n > 0 allocates arrays to size n
------------------------------------------------------------------------- */
void AtomVecHybrid::grow(int n)
{
if (n == 0) nmax += DELTA;
if (n == 0) grow_nmax();
else nmax = n;
atom->nmax = nmax;
if (nmax < 0 || nmax > MAXSMALLINT)

View File

@ -26,8 +26,6 @@
using namespace LAMMPS_NS;
#define DELTA 10000
#define DELTA_BONUS 10000
#define EPSILON 0.001
/* ---------------------------------------------------------------------- */
@ -73,13 +71,13 @@ void AtomVecLine::init()
/* ----------------------------------------------------------------------
grow atom arrays
n = 0 grows arrays by DELTA
n = 0 grows arrays by a chunk
n > 0 allocates arrays to size n
------------------------------------------------------------------------- */
void AtomVecLine::grow(int n)
{
if (n == 0) nmax += DELTA;
if (n == 0) grow_nmax();
else nmax = n;
atom->nmax = nmax;
if (nmax < 0 || nmax > MAXSMALLINT)
@ -124,7 +122,7 @@ void AtomVecLine::grow_reset()
void AtomVecLine::grow_bonus()
{
nmax_bonus += DELTA_BONUS;
nmax_bonus = grow_nmax_bonus(nmax_bonus);
if (nmax_bonus < 0 || nmax_bonus > MAXSMALLINT)
error->one(FLERR,"Per-processor system is too big");

View File

@ -29,8 +29,6 @@
using namespace LAMMPS_NS;
using namespace MathConst;
#define DELTA 10000
/* ---------------------------------------------------------------------- */
AtomVecSphere::AtomVecSphere(LAMMPS *lmp) : AtomVec(lmp)
@ -77,13 +75,13 @@ void AtomVecSphere::init()
/* ----------------------------------------------------------------------
grow atom arrays
n = 0 grows arrays by DELTA
n = 0 grows arrays by a chunk
n > 0 allocates arrays to size n
------------------------------------------------------------------------- */
void AtomVecSphere::grow(int n)
{
if (n == 0) nmax += DELTA;
if (n == 0) grow_nmax();
else nmax = n;
atom->nmax = nmax;
if (nmax < 0 || nmax > MAXSMALLINT)

View File

@ -27,8 +27,6 @@
using namespace LAMMPS_NS;
#define DELTA 10000
#define DELTA_BONUS 10000
#define EPSILON 0.001
/* ---------------------------------------------------------------------- */
@ -74,13 +72,13 @@ void AtomVecTri::init()
/* ----------------------------------------------------------------------
grow atom arrays
n = 0 grows arrays by DELTA
n = 0 grows arrays by a chunk
n > 0 allocates arrays to size n
------------------------------------------------------------------------- */
void AtomVecTri::grow(int n)
{
if (n == 0) nmax += DELTA;
if (n == 0) grow_nmax();
else nmax = n;
atom->nmax = nmax;
if (nmax < 0 || nmax > MAXSMALLINT)
@ -125,7 +123,7 @@ void AtomVecTri::grow_reset()
void AtomVecTri::grow_bonus()
{
nmax_bonus += DELTA_BONUS;
nmax_bonus = grow_nmax_bonus(nmax_bonus);
if (nmax_bonus < 0 || nmax_bonus > MAXSMALLINT)
error->one(FLERR,"Per-processor system is too big");

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;
@ -124,6 +125,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

@ -18,8 +18,6 @@
#include "update.h"
#include "force.h"
#include "domain.h"
#include "modify.h"
#include "fix.h"
#include "group.h"
#include "error.h"
@ -52,9 +50,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 +58,7 @@ void ComputeTemp::setup()
void ComputeTemp::dof_compute()
{
if (fix_dof) adjust_dof_fix();
double natoms = group->count(igroup);
dof = domain->dimension * natoms;
dof -= static_cast<double>(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

@ -41,7 +41,6 @@ class ComputeTempCOM : public Compute {
void restore_bias_thr(int, double *, double *);
private:
int fix_dof;
double tfactor,masstotal;
void dof_compute();

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

@ -42,7 +42,6 @@ class ComputeTempDeform : public Compute {
double memory_usage();
protected:
int fix_dof;
double tfactor;
virtual void dof_compute();

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

@ -44,7 +44,6 @@ class ComputeTempPartial : public Compute {
protected:
int xflag,yflag,zflag;
int fix_dof;
double tfactor;
void dof_compute();

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

@ -46,7 +46,6 @@ class ComputeTempProfile : public Compute {
int xflag,yflag,zflag,ncount,outflag;
int nbinx,nbiny,nbinz,nbins;
int ivx,ivy,ivz;
int fix_dof;
double tfactor;
int box_change,triclinic;

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

@ -46,7 +46,7 @@ class ComputeTempRamp : public Compute {
double coord_lo,coord_hi;
int v_dim;
double v_lo,v_hi;
int scaleflag,fix_dof;
int scaleflag;
double tfactor,xscale,yscale,zscale;
void dof_compute();

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

@ -39,7 +39,7 @@ class ComputeTempSphere : public Compute {
void restore_bias_thr(int, double *, double *);
private:
int fix_dof,mode;
int mode;
double tfactor;
char *id_bias;
Compute *tbias; // ptr to additional bias compute

View File

@ -164,11 +164,14 @@ void CreateBox::command(int narg, char **arg)
}
// problem setup using info from header
// no call to atom->grow since create_atoms or fixes will do it
// deallocate/grow insures any extra settings are used for topology arrays
// necessary in case no create_atoms is performed
update->ntimestep = 0;
atom->allocate_type_arrays();
atom->deallocate_topology();
atom->avec->grow(1);
domain->print_box("Created ");
domain->set_initial_box();

View File

@ -370,7 +370,7 @@ void FixAdapt::change_settings()
}
/* ----------------------------------------------------------------------
restore pair,kspace.atom parameters to original values
restore pair,kspace,atom parameters to original values
------------------------------------------------------------------------- */
void FixAdapt::restore_settings()

View File

@ -104,8 +104,8 @@ FixAddForce::FixAddForce(LAMMPS *lmp, int narg, char **arg) :
force_flag = 0;
foriginal[0] = foriginal[1] = foriginal[2] = foriginal[3] = 0.0;
maxatom = -1;
sforce = NULL;
maxatom = atom->nmax;
memory->create(sforce,maxatom,4,"addforce:sforce");
}
/* ---------------------------------------------------------------------- */
@ -274,24 +274,16 @@ void FixAddForce::post_force(int vflag)
modify->clearstep_compute();
if (xstyle == EQUAL) xvalue = input->variable->compute_equal(xvar);
else if (xstyle == ATOM) {
if (sforce) input->variable->compute_atom(xvar,igroup,&sforce[0][0],4,0);
else input->variable->compute_atom(xvar,igroup,NULL,4,0);
}
else if (xstyle == ATOM)
input->variable->compute_atom(xvar,igroup,&sforce[0][0],4,0);
if (ystyle == EQUAL) yvalue = input->variable->compute_equal(yvar);
else if (ystyle == ATOM) {
if (sforce) input->variable->compute_atom(yvar,igroup,&sforce[0][1],4,0);
else input->variable->compute_atom(yvar,igroup,NULL,4,0);
}
else if (ystyle == ATOM)
input->variable->compute_atom(yvar,igroup,&sforce[0][1],4,0);
if (zstyle == EQUAL) zvalue = input->variable->compute_equal(zvar);
else if (zstyle == ATOM) {
if (sforce) input->variable->compute_atom(zvar,igroup,&sforce[0][2],4,0);
else input->variable->compute_atom(zvar,igroup,NULL,4,0);
}
if (estyle == ATOM) {
if (sforce) input->variable->compute_atom(evar,igroup,&sforce[0][3],4,0);
else input->variable->compute_atom(evar,igroup,NULL,4,0);
}
else if (zstyle == ATOM)
input->variable->compute_atom(zvar,igroup,&sforce[0][2],4,0);
if (estyle == ATOM)
input->variable->compute_atom(evar,igroup,&sforce[0][3],4,0);
modify->addstep_compute(update->ntimestep + 1);

View File

@ -242,8 +242,9 @@ FixMove::FixMove(LAMMPS *lmp, int narg, char **arg) :
atom->add_callback(0);
atom->add_callback(1);
maxatom = -1;
displace = velocity = NULL;
maxatom = atom->nmax;
if (displaceflag) memory->create(displace,maxatom,3,"move:displace");
if (velocityflag) memory->create(velocity,maxatom,3,"move:velocity");
// xoriginal = initial unwrapped positions of atoms
@ -581,45 +582,27 @@ void FixMove::initial_integrate(int vflag)
if (xvarstr) {
if (xvarstyle == EQUAL) dx = input->variable->compute_equal(xvar);
else if (displace)
input->variable->compute_atom(xvar,igroup,&displace[0][0],3,0);
else
input->variable->compute_atom(xvar,igroup,NULL,3,0);
else input->variable->compute_atom(xvar,igroup,&displace[0][0],3,0);
}
if (yvarstr) {
if (yvarstyle == EQUAL) dy = input->variable->compute_equal(yvar);
else if (displace)
input->variable->compute_atom(yvar,igroup,&displace[0][1],3,0);
else
input->variable->compute_atom(yvar,igroup,NULL,3,0);
else input->variable->compute_atom(yvar,igroup,&displace[0][1],3,0);
}
if (zvarstr) {
if (zvarstyle == EQUAL) dz = input->variable->compute_equal(zvar);
else if (displace)
input->variable->compute_atom(zvar,igroup,&displace[0][2],3,0);
else
input->variable->compute_atom(zvar,igroup,NULL,3,0);
else input->variable->compute_atom(zvar,igroup,&displace[0][2],3,0);
}
if (vxvarstr) {
if (vxvarstyle == EQUAL) vx = input->variable->compute_equal(vxvar);
else if (velocity)
input->variable->compute_atom(vxvar,igroup,&velocity[0][0],3,0);
else
input->variable->compute_atom(vxvar,igroup,NULL,3,0);
else input->variable->compute_atom(vxvar,igroup,&velocity[0][0],3,0);
}
if (vyvarstr) {
if (vyvarstyle == EQUAL) vy = input->variable->compute_equal(vyvar);
else if (velocity)
input->variable->compute_atom(vyvar,igroup,&velocity[0][1],3,0);
else
input->variable->compute_atom(vyvar,igroup,NULL,3,0);
else input->variable->compute_atom(vyvar,igroup,&velocity[0][1],3,0);
}
if (vzvarstr) {
if (vzvarstyle == EQUAL) vz = input->variable->compute_equal(vzvar);
else if (velocity)
input->variable->compute_atom(vzvar,igroup,&velocity[0][2],3,0);
else
input->variable->compute_atom(vzvar,igroup,NULL,3,0);
else input->variable->compute_atom(vzvar,igroup,&velocity[0][2],3,0);
}
modify->addstep_compute(update->ntimestep + 1);

View File

@ -99,8 +99,8 @@ FixSetForce::FixSetForce(LAMMPS *lmp, int narg, char **arg) :
force_flag = 0;
foriginal[0] = foriginal[1] = foriginal[2] = 0.0;
maxatom = -1;
sforce = NULL;
maxatom = atom->nmax;
memory->create(sforce,maxatom,3,"setforce:sforce");
}
/* ---------------------------------------------------------------------- */
@ -257,20 +257,14 @@ void FixSetForce::post_force(int vflag)
modify->clearstep_compute();
if (xstyle == EQUAL) xvalue = input->variable->compute_equal(xvar);
else if (xstyle == ATOM) {
if (sforce) input->variable->compute_atom(xvar,igroup,&sforce[0][0],3,0);
else input->variable->compute_atom(xvar,igroup,NULL,3,0);
}
else if (xstyle == ATOM)
input->variable->compute_atom(xvar,igroup,&sforce[0][0],3,0);
if (ystyle == EQUAL) yvalue = input->variable->compute_equal(yvar);
else if (ystyle == ATOM) {
if (sforce) input->variable->compute_atom(yvar,igroup,&sforce[0][1],3,0);
else input->variable->compute_atom(yvar,igroup,NULL,3,0);
}
else if (ystyle == ATOM)
input->variable->compute_atom(yvar,igroup,&sforce[0][1],3,0);
if (zstyle == EQUAL) zvalue = input->variable->compute_equal(zvar);
else if (zstyle == ATOM) {
if (sforce) input->variable->compute_atom(zvar,igroup,&sforce[0][2],3,0);
else input->variable->compute_atom(zvar,igroup,NULL,3,0);
}
else if (zstyle == ATOM)
input->variable->compute_atom(zvar,igroup,&sforce[0][2],3,0);
modify->addstep_compute(update->ntimestep + 1);

View File

@ -467,11 +467,9 @@ void FixStoreState::end_of_step()
// evaluate atom-style variable
} else if (which[m] == VARIABLE)
if (values)
input->variable->compute_atom(n,igroup,&values[0][m],nvalues,0);
else
input->variable->compute_atom(n,igroup,NULL,nvalues,0);
} else if (which[m] == VARIABLE) {
input->variable->compute_atom(n,igroup,&values[0][m],nvalues,0);
}
}
}

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();

View File

@ -206,9 +206,9 @@ void ReadData::command(int narg, char **arg)
domain->box_exist = 1;
update->ntimestep = 0;
// insure extra settings are applied before grow(),
// even if no topology in file
// if topology is in file, realloc and another grow() is done below
// apply extra settings before grow(), even if no topology in file
// deallocate() insures new settings are used for topology arrays
// if per-atom topology is in file, another grow() is done below
atom->bond_per_atom = atom->extra_bond_per_atom;
atom->angle_per_atom = atom->extra_angle_per_atom;
@ -220,6 +220,7 @@ void ReadData::command(int narg, char **arg)
else n = static_cast<int> (LB_FACTOR * atom->natoms / comm->nprocs);
atom->allocate_type_arrays();
atom->deallocate_topology();
atom->avec->grow(n);
domain->print_box(" ");
@ -497,49 +498,11 @@ void ReadData::command(int narg, char **arg)
firstpass = 0;
// reallocate bond,angle,diehdral,improper arrays via grow()
// use new bond,angle,dihedral,improper per-atom values from 1st pass
// should leave other atom arrays unchanged, since already nmax in length
// if bonds/etc not in data file, initialize per-atom size
// with extra settings before grow() of these topology arrays
if (bondflag) {
memory->destroy(atom->bond_type);
memory->destroy(atom->bond_atom);
atom->bond_type = NULL;
atom->bond_atom = NULL;
}
if (angleflag) {
memory->destroy(atom->angle_type);
memory->destroy(atom->angle_atom1);
memory->destroy(atom->angle_atom2);
memory->destroy(atom->angle_atom3);
atom->angle_type = NULL;
atom->angle_atom1 = atom->angle_atom2 = atom->angle_atom3 = NULL;
}
if (dihedralflag) {
memory->destroy(atom->dihedral_type);
memory->destroy(atom->dihedral_atom1);
memory->destroy(atom->dihedral_atom2);
memory->destroy(atom->dihedral_atom3);
memory->destroy(atom->dihedral_atom4);
atom->dihedral_type = NULL;
atom->dihedral_atom1 = atom->dihedral_atom2 =
atom->dihedral_atom3 = atom->dihedral_atom4 = NULL;
}
if (improperflag) {
memory->destroy(atom->improper_type);
memory->destroy(atom->improper_atom1);
memory->destroy(atom->improper_atom2);
memory->destroy(atom->improper_atom3);
memory->destroy(atom->improper_atom4);
atom->improper_type = NULL;
atom->improper_atom1 = atom->improper_atom2 =
atom->improper_atom3 = atom->improper_atom4 = NULL;
}
// will use new bond,angle,dihedral,improper per-atom values from 1st pass
// will also observe extra settings even if bond/etc topology not in file
// leaves other atom arrays unchanged, since already nmax in length
atom->deallocate_topology();
atom->avec->grow(atom->nmax);
}

View File

@ -151,6 +151,7 @@ void ReadRestart::command(int narg, char **arg)
else n = static_cast<int> (LB_FACTOR * atom->natoms / nprocs);
atom->allocate_type_arrays();
atom->deallocate_topology();
atom->avec->grow(n);
n = atom->nmax;

View File

@ -1 +1 @@
#define LAMMPS_VERSION "8 May 2014"
#define LAMMPS_VERSION "9 May 2014"