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

This commit is contained in:
sjplimp
2009-12-16 16:56:56 +00:00
parent 493bf46dfd
commit 2472cdc89d
5 changed files with 1164 additions and 43 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,91 @@
/* ----------------------------------------------------------------------
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 COMPUTE_PROPERTY_ATOM_H
#define COMPUTE_PROPERTY_ATOM_H
#include "compute.h"
namespace LAMMPS_NS {
class ComputePropertyAtom : public Compute {
public:
ComputePropertyAtom(class LAMMPS *, int, char **);
~ComputePropertyAtom();
void init() {}
void compute_peratom();
double memory_usage();
private:
int nvalues;
int nmax;
double *vector;
double **array;
double *buf;
typedef void (ComputePropertyAtom::*FnPtrPack)(int);
FnPtrPack *pack_choice; // ptrs to pack functions
void pack_id(int);
void pack_molecule(int);
void pack_type(int);
void pack_mass(int);
void pack_x(int);
void pack_y(int);
void pack_z(int);
void pack_xs(int);
void pack_ys(int);
void pack_zs(int);
void pack_xs_triclinic(int);
void pack_ys_triclinic(int);
void pack_zs_triclinic(int);
void pack_xu(int);
void pack_yu(int);
void pack_zu(int);
void pack_xu_triclinic(int);
void pack_yu_triclinic(int);
void pack_zu_triclinic(int);
void pack_ix(int);
void pack_iy(int);
void pack_iz(int);
void pack_vx(int);
void pack_vy(int);
void pack_vz(int);
void pack_fx(int);
void pack_fy(int);
void pack_fz(int);
void pack_q(int);
void pack_mux(int);
void pack_muy(int);
void pack_muz(int);
void pack_radius(int);
void pack_omegax(int);
void pack_omegay(int);
void pack_omegaz(int);
void pack_angmomx(int);
void pack_angmomy(int);
void pack_angmomz(int);
void pack_quatw(int);
void pack_quati(int);
void pack_quatj(int);
void pack_quatk(int);
void pack_tqx(int);
void pack_tqy(int);
void pack_tqz(int);
};
}
#endif

View File

@ -30,7 +30,8 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
// customize by adding keyword to 1st enum // customize by adding keyword
// same as in compute_property.cpp, also customize that command
enum{ID,MOL,TYPE,MASS, enum{ID,MOL,TYPE,MASS,
X,Y,Z,XS,YS,ZS,XSTRI,YSTRI,ZSTRI,XU,YU,ZU,XUTRI,YUTRI,ZUTRI,IX,IY,IZ, X,Y,Z,XS,YS,ZS,XSTRI,YSTRI,ZSTRI,XU,YU,ZU,XUTRI,YUTRI,ZUTRI,IX,IY,IZ,
@ -392,7 +393,7 @@ int DumpCustom::count()
nstride = 1; nstride = 1;
} else if (thresh_array[ithresh] == MOL) { } else if (thresh_array[ithresh] == MOL) {
if (!atom->molecule_flag) if (!atom->molecule_flag)
error->all("Threshhold for an atom quantity that isn't allocated"); error->all("Threshhold for an atom property that isn't allocated");
int *molecule = atom->molecule; int *molecule = atom->molecule;
for (i = 0; i < nlocal; i++) dchoose[i] = molecule[i]; for (i = 0; i < nlocal; i++) dchoose[i] = molecule[i];
ptr = dchoose; ptr = dchoose;
@ -577,92 +578,92 @@ int DumpCustom::count()
nstride = 3; nstride = 3;
} else if (thresh_array[ithresh] == Q) { } else if (thresh_array[ithresh] == Q) {
if (!atom->q_flag) if (!atom->q_flag)
error->all("Threshhold for an atom quantity that isn't allocated"); error->all("Threshhold for an atom property that isn't allocated");
ptr = atom->q; ptr = atom->q;
nstride = 1; nstride = 1;
} else if (thresh_array[ithresh] == MUX) { } else if (thresh_array[ithresh] == MUX) {
if (!atom->mu_flag) if (!atom->mu_flag)
error->all("Threshhold for an atom quantity that isn't allocated"); error->all("Threshhold for an atom property that isn't allocated");
ptr = &atom->mu[0][0]; ptr = &atom->mu[0][0];
nstride = 3; nstride = 3;
} else if (thresh_array[ithresh] == MUY) { } else if (thresh_array[ithresh] == MUY) {
if (!atom->mu_flag) if (!atom->mu_flag)
error->all("Threshhold for an atom quantity that isn't allocated"); error->all("Threshhold for an atom property that isn't allocated");
ptr = &atom->mu[0][1]; ptr = &atom->mu[0][1];
nstride = 3; nstride = 3;
} else if (thresh_array[ithresh] == MUZ) { } else if (thresh_array[ithresh] == MUZ) {
if (!atom->mu_flag) if (!atom->mu_flag)
error->all("Threshhold for an atom quantity that isn't allocated"); error->all("Threshhold for an atom property that isn't allocated");
ptr = &atom->mu[0][2]; ptr = &atom->mu[0][2];
nstride = 3; nstride = 3;
} else if (thresh_array[ithresh] == RADIUS) { } else if (thresh_array[ithresh] == RADIUS) {
if (!atom->radius_flag) if (!atom->radius_flag)
error->all("Threshhold for an atom quantity that isn't allocated"); error->all("Threshhold for an atom property that isn't allocated");
ptr = atom->radius; ptr = atom->radius;
nstride = 1; nstride = 1;
} else if (thresh_array[ithresh] == OMEGAX) { } else if (thresh_array[ithresh] == OMEGAX) {
if (!atom->omega_flag) if (!atom->omega_flag)
error->all("Threshhold for an atom quantity that isn't allocated"); error->all("Threshhold for an atom property that isn't allocated");
ptr = &atom->omega[0][0]; ptr = &atom->omega[0][0];
nstride = 3; nstride = 3;
} else if (thresh_array[ithresh] == OMEGAY) { } else if (thresh_array[ithresh] == OMEGAY) {
if (!atom->omega_flag) if (!atom->omega_flag)
error->all("Threshhold for an atom quantity that isn't allocated"); error->all("Threshhold for an atom property that isn't allocated");
ptr = &atom->omega[0][1]; ptr = &atom->omega[0][1];
nstride = 3; nstride = 3;
} else if (thresh_array[ithresh] == OMEGAZ) { } else if (thresh_array[ithresh] == OMEGAZ) {
if (!atom->omega_flag) if (!atom->omega_flag)
error->all("Threshhold for an atom quantity that isn't allocated"); error->all("Threshhold for an atom property that isn't allocated");
ptr = &atom->omega[0][2]; ptr = &atom->omega[0][2];
nstride = 3; nstride = 3;
} else if (thresh_array[ithresh] == ANGMOMX) { } else if (thresh_array[ithresh] == ANGMOMX) {
if (!atom->angmom_flag) if (!atom->angmom_flag)
error->all("Threshhold for an atom quantity that isn't allocated"); error->all("Threshhold for an atom property that isn't allocated");
ptr = &atom->angmom[0][0]; ptr = &atom->angmom[0][0];
nstride = 3; nstride = 3;
} else if (thresh_array[ithresh] == ANGMOMY) { } else if (thresh_array[ithresh] == ANGMOMY) {
if (!atom->angmom_flag) if (!atom->angmom_flag)
error->all("Threshhold for an atom quantity that isn't allocated"); error->all("Threshhold for an atom property that isn't allocated");
ptr = &atom->angmom[0][1]; ptr = &atom->angmom[0][1];
nstride = 3; nstride = 3;
} else if (thresh_array[ithresh] == ANGMOMZ) { } else if (thresh_array[ithresh] == ANGMOMZ) {
if (!atom->angmom_flag) if (!atom->angmom_flag)
error->all("Threshhold for an atom quantity that isn't allocated"); error->all("Threshhold for an atom property that isn't allocated");
ptr = &atom->angmom[0][2]; ptr = &atom->angmom[0][2];
nstride = 3; nstride = 3;
} else if (thresh_array[ithresh] == QUATW) { } else if (thresh_array[ithresh] == QUATW) {
if (!atom->quat_flag) if (!atom->quat_flag)
error->all("Threshhold for an atom quantity that isn't allocated"); error->all("Threshhold for an atom property that isn't allocated");
ptr = &atom->quat[0][0]; ptr = &atom->quat[0][0];
nstride = 4; nstride = 4;
} else if (thresh_array[ithresh] == QUATI) { } else if (thresh_array[ithresh] == QUATI) {
if (!atom->quat_flag) if (!atom->quat_flag)
error->all("Threshhold for an atom quantity that isn't allocated"); error->all("Threshhold for an atom property that isn't allocated");
ptr = &atom->quat[0][1]; ptr = &atom->quat[0][1];
nstride = 4; nstride = 4;
} else if (thresh_array[ithresh] == QUATJ) { } else if (thresh_array[ithresh] == QUATJ) {
if (!atom->quat_flag) if (!atom->quat_flag)
error->all("Threshhold for an atom quantity that isn't allocated"); error->all("Threshhold for an atom property that isn't allocated");
ptr = &atom->quat[0][2]; ptr = &atom->quat[0][2];
nstride = 4; nstride = 4;
} else if (thresh_array[ithresh] == QUATK) { } else if (thresh_array[ithresh] == QUATK) {
if (!atom->quat_flag) if (!atom->quat_flag)
error->all("Threshhold for an atom quantity that isn't allocated"); error->all("Threshhold for an atom property that isn't allocated");
ptr = &atom->quat[0][3]; ptr = &atom->quat[0][3];
nstride = 4; nstride = 4;
} else if (thresh_array[ithresh] == TQX) { } else if (thresh_array[ithresh] == TQX) {
if (!atom->torque_flag) if (!atom->torque_flag)
error->all("Threshhold for an atom quantity that isn't allocated"); error->all("Threshhold for an atom property that isn't allocated");
ptr = &atom->torque[0][0]; ptr = &atom->torque[0][0];
nstride = 3; nstride = 3;
} else if (thresh_array[ithresh] == TQY) { } else if (thresh_array[ithresh] == TQY) {
if (!atom->torque_flag) if (!atom->torque_flag)
error->all("Threshhold for an atom quantity that isn't allocated"); error->all("Threshhold for an atom property that isn't allocated");
ptr = &atom->torque[0][1]; ptr = &atom->torque[0][1];
nstride = 3; nstride = 3;
} else if (thresh_array[ithresh] == TQZ) { } else if (thresh_array[ithresh] == TQZ) {
if (!atom->torque_flag) if (!atom->torque_flag)
error->all("Threshhold for an atom quantity that isn't allocated"); error->all("Threshhold for an atom property that isn't allocated");
ptr = &atom->torque[0][2]; ptr = &atom->torque[0][2];
nstride = 3; nstride = 3;
@ -795,7 +796,7 @@ void DumpCustom::parse_fields(int narg, char **arg)
vtype[i] = INT; vtype[i] = INT;
} else if (strcmp(arg[iarg],"mol") == 0) { } else if (strcmp(arg[iarg],"mol") == 0) {
if (!atom->molecule_flag) if (!atom->molecule_flag)
error->all("Dumping an atom quantity that isn't allocated"); error->all("Dumping an atom property that isn't allocated");
pack_choice[i] = &DumpCustom::pack_molecule; pack_choice[i] = &DumpCustom::pack_molecule;
vtype[i] = INT; vtype[i] = INT;
} else if (strcmp(arg[iarg],"type") == 0) { } else if (strcmp(arg[iarg],"type") == 0) {
@ -869,94 +870,94 @@ void DumpCustom::parse_fields(int narg, char **arg)
} else if (strcmp(arg[iarg],"q") == 0) { } else if (strcmp(arg[iarg],"q") == 0) {
if (!atom->q_flag) if (!atom->q_flag)
error->all("Dumping an atom quantity that isn't allocated"); error->all("Dumping an atom property that isn't allocated");
pack_choice[i] = &DumpCustom::pack_q; pack_choice[i] = &DumpCustom::pack_q;
vtype[i] = DOUBLE; vtype[i] = DOUBLE;
} else if (strcmp(arg[iarg],"mux") == 0) { } else if (strcmp(arg[iarg],"mux") == 0) {
if (!atom->mu_flag) if (!atom->mu_flag)
error->all("Dumping an atom quantity that isn't allocated"); error->all("Dumping an atom property that isn't allocated");
pack_choice[i] = &DumpCustom::pack_mux; pack_choice[i] = &DumpCustom::pack_mux;
vtype[i] = DOUBLE; vtype[i] = DOUBLE;
} else if (strcmp(arg[iarg],"muy") == 0) { } else if (strcmp(arg[iarg],"muy") == 0) {
if (!atom->mu_flag) if (!atom->mu_flag)
error->all("Dumping an atom quantity that isn't allocated"); error->all("Dumping an atom property that isn't allocated");
pack_choice[i] = &DumpCustom::pack_muy; pack_choice[i] = &DumpCustom::pack_muy;
vtype[i] = DOUBLE; vtype[i] = DOUBLE;
} else if (strcmp(arg[iarg],"muz") == 0) { } else if (strcmp(arg[iarg],"muz") == 0) {
if (!atom->mu_flag) if (!atom->mu_flag)
error->all("Dumping an atom quantity that isn't allocated"); error->all("Dumping an atom property that isn't allocated");
pack_choice[i] = &DumpCustom::pack_muz; pack_choice[i] = &DumpCustom::pack_muz;
vtype[i] = DOUBLE; vtype[i] = DOUBLE;
} else if (strcmp(arg[iarg],"radius") == 0) { } else if (strcmp(arg[iarg],"radius") == 0) {
if (!atom->radius_flag) if (!atom->radius_flag)
error->all("Dumping an atom quantity that isn't allocated"); error->all("Dumping an atom property that isn't allocated");
pack_choice[i] = &DumpCustom::pack_radius; pack_choice[i] = &DumpCustom::pack_radius;
vtype[i] = DOUBLE; vtype[i] = DOUBLE;
} else if (strcmp(arg[iarg],"omegax") == 0) { } else if (strcmp(arg[iarg],"omegax") == 0) {
if (!atom->omega_flag) if (!atom->omega_flag)
error->all("Dumping an atom quantity that isn't allocated"); error->all("Dumping an atom property that isn't allocated");
pack_choice[i] = &DumpCustom::pack_omegax; pack_choice[i] = &DumpCustom::pack_omegax;
vtype[i] = DOUBLE; vtype[i] = DOUBLE;
} else if (strcmp(arg[iarg],"omegay") == 0) { } else if (strcmp(arg[iarg],"omegay") == 0) {
if (!atom->omega_flag) if (!atom->omega_flag)
error->all("Dumping an atom quantity that isn't allocated"); error->all("Dumping an atom property that isn't allocated");
pack_choice[i] = &DumpCustom::pack_omegay; pack_choice[i] = &DumpCustom::pack_omegay;
vtype[i] = DOUBLE; vtype[i] = DOUBLE;
} else if (strcmp(arg[iarg],"omegaz") == 0) { } else if (strcmp(arg[iarg],"omegaz") == 0) {
if (!atom->omega_flag) if (!atom->omega_flag)
error->all("Dumping an atom quantity that isn't allocated"); error->all("Dumping an atom property that isn't allocated");
pack_choice[i] = &DumpCustom::pack_omegaz; pack_choice[i] = &DumpCustom::pack_omegaz;
vtype[i] = DOUBLE; vtype[i] = DOUBLE;
} else if (strcmp(arg[iarg],"angmomx") == 0) { } else if (strcmp(arg[iarg],"angmomx") == 0) {
if (!atom->angmom_flag) if (!atom->angmom_flag)
error->all("Dumping an atom quantity that isn't allocated"); error->all("Dumping an atom property that isn't allocated");
pack_choice[i] = &DumpCustom::pack_angmomx; pack_choice[i] = &DumpCustom::pack_angmomx;
vtype[i] = DOUBLE; vtype[i] = DOUBLE;
} else if (strcmp(arg[iarg],"angmomy") == 0) { } else if (strcmp(arg[iarg],"angmomy") == 0) {
if (!atom->angmom_flag) if (!atom->angmom_flag)
error->all("Dumping an atom quantity that isn't allocated"); error->all("Dumping an atom property that isn't allocated");
pack_choice[i] = &DumpCustom::pack_angmomy; pack_choice[i] = &DumpCustom::pack_angmomy;
vtype[i] = DOUBLE; vtype[i] = DOUBLE;
} else if (strcmp(arg[iarg],"angmomz") == 0) { } else if (strcmp(arg[iarg],"angmomz") == 0) {
if (!atom->angmom_flag) if (!atom->angmom_flag)
error->all("Dumping an atom quantity that isn't allocated"); error->all("Dumping an atom property that isn't allocated");
pack_choice[i] = &DumpCustom::pack_angmomz; pack_choice[i] = &DumpCustom::pack_angmomz;
vtype[i] = DOUBLE; vtype[i] = DOUBLE;
} else if (strcmp(arg[iarg],"quatw") == 0) { } else if (strcmp(arg[iarg],"quatw") == 0) {
if (!atom->quat_flag) if (!atom->quat_flag)
error->all("Dumping an atom quantity that isn't allocated"); error->all("Dumping an atom property that isn't allocated");
pack_choice[i] = &DumpCustom::pack_quatw; pack_choice[i] = &DumpCustom::pack_quatw;
vtype[i] = DOUBLE; vtype[i] = DOUBLE;
} else if (strcmp(arg[iarg],"quati") == 0) { } else if (strcmp(arg[iarg],"quati") == 0) {
if (!atom->quat_flag) if (!atom->quat_flag)
error->all("Dumping an atom quantity that isn't allocated"); error->all("Dumping an atom property that isn't allocated");
pack_choice[i] = &DumpCustom::pack_quati; pack_choice[i] = &DumpCustom::pack_quati;
vtype[i] = DOUBLE; vtype[i] = DOUBLE;
} else if (strcmp(arg[iarg],"quatj") == 0) { } else if (strcmp(arg[iarg],"quatj") == 0) {
if (!atom->quat_flag) if (!atom->quat_flag)
error->all("Dumping an atom quantity that isn't allocated"); error->all("Dumping an atom property that isn't allocated");
pack_choice[i] = &DumpCustom::pack_quatj; pack_choice[i] = &DumpCustom::pack_quatj;
vtype[i] = DOUBLE; vtype[i] = DOUBLE;
} else if (strcmp(arg[iarg],"quatk") == 0) { } else if (strcmp(arg[iarg],"quatk") == 0) {
if (!atom->quat_flag) if (!atom->quat_flag)
error->all("Dumping an atom quantity that isn't allocated"); error->all("Dumping an atom property that isn't allocated");
pack_choice[i] = &DumpCustom::pack_quatk; pack_choice[i] = &DumpCustom::pack_quatk;
vtype[i] = DOUBLE; vtype[i] = DOUBLE;
} else if (strcmp(arg[iarg],"tqx") == 0) { } else if (strcmp(arg[iarg],"tqx") == 0) {
if (!atom->torque_flag) if (!atom->torque_flag)
error->all("Dumping an atom quantity that isn't allocated"); error->all("Dumping an atom property that isn't allocated");
pack_choice[i] = &DumpCustom::pack_tqx; pack_choice[i] = &DumpCustom::pack_tqx;
vtype[i] = DOUBLE; vtype[i] = DOUBLE;
} else if (strcmp(arg[iarg],"tqy") == 0) { } else if (strcmp(arg[iarg],"tqy") == 0) {
if (!atom->torque_flag) if (!atom->torque_flag)
error->all("Dumping an atom quantity that isn't allocated"); error->all("Dumping an atom property that isn't allocated");
pack_choice[i] = &DumpCustom::pack_tqy; pack_choice[i] = &DumpCustom::pack_tqy;
vtype[i] = DOUBLE; vtype[i] = DOUBLE;
} else if (strcmp(arg[iarg],"tqz") == 0) { } else if (strcmp(arg[iarg],"tqz") == 0) {
if (!atom->torque_flag) if (!atom->torque_flag)
error->all("Dumping an atom quantity that isn't allocated"); error->all("Dumping an atom property that isn't allocated");
pack_choice[i] = &DumpCustom::pack_tqz; pack_choice[i] = &DumpCustom::pack_tqz;
vtype[i] = DOUBLE; vtype[i] = DOUBLE;
@ -1458,7 +1459,7 @@ void DumpCustom::pack_variable(int n)
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
one method for every keyword dump custom can output one method for every keyword dump custom can output
the atom quantity is packed into buf starting at n with stride size_one the atom property is packed into buf starting at n with stride size_one
customize a new keyword by adding a method customize a new keyword by adding a method
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */

View File

@ -93,6 +93,7 @@ CommandStyle(write_restart,WriteRestart)
#include "compute_reduce.h" #include "compute_reduce.h"
#include "compute_reduce_region.h" #include "compute_reduce_region.h"
#include "compute_erotate_sphere.h" #include "compute_erotate_sphere.h"
#include "compute_property_atom.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"
@ -122,6 +123,7 @@ ComputeStyle(pressure,ComputePressure)
ComputeStyle(reduce,ComputeReduce) ComputeStyle(reduce,ComputeReduce)
ComputeStyle(reduce/region,ComputeReduceRegion) ComputeStyle(reduce/region,ComputeReduceRegion)
ComputeStyle(erotate/sphere,ComputeERotateSphere) ComputeStyle(erotate/sphere,ComputeERotateSphere)
ComputeStyle(property/atom,ComputePropertyAtom)
ComputeStyle(stress/atom,ComputeStressAtom) ComputeStyle(stress/atom,ComputeStressAtom)
ComputeStyle(temp,ComputeTemp) ComputeStyle(temp,ComputeTemp)
ComputeStyle(temp/com,ComputeTempCOM) ComputeStyle(temp/com,ComputeTempCOM)

View File

@ -1024,7 +1024,7 @@ double Variable::evaluate(char *str, Tree **tree)
i = ptr-str+1; i = ptr-str+1;
} }
// v_name = non atom-style variable = global value // v_name = scalar from non atom-style global scalar
if (nbracket == 0 && style[ivar] != ATOM) { if (nbracket == 0 && style[ivar] != ATOM) {
@ -1039,7 +1039,7 @@ double Variable::evaluate(char *str, Tree **tree)
treestack[ntreestack++] = newtree; treestack[ntreestack++] = newtree;
} else argstack[nargstack++] = atof(var); } else argstack[nargstack++] = atof(var);
// v_name = atom-style variable // v_name = vector from atom-style per-atom vector
} else if (nbracket == 0 && style[ivar] == ATOM) { } else if (nbracket == 0 && style[ivar] == ATOM) {
@ -1049,7 +1049,7 @@ double Variable::evaluate(char *str, Tree **tree)
double tmp = evaluate(data[ivar][0],&newtree); double tmp = evaluate(data[ivar][0],&newtree);
treestack[ntreestack++] = newtree; treestack[ntreestack++] = newtree;
// v_name[N] = global value from atom-style variable // v_name[N] = scalar from atom-style per-atom vector
// compute the per-atom variable in result // compute the per-atom variable in result
// use peratom2global to extract single value from result // use peratom2global to extract single value from result