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

This commit is contained in:
sjplimp 2013-04-03 16:52:29 +00:00
parent e4580f5896
commit da77d5e62a
37 changed files with 1394 additions and 6 deletions

View File

@ -978,6 +978,119 @@ int AtomVecWavepacket::data_vel_hybrid(int m, char **values)
return 1;
}
/* ----------------------------------------------------------------------
pack atom info for data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecWavepacket::pack_data(double **buf)
{
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
buf[i][0] = tag[i];
buf[i][1] = type[i];
buf[i][2] = q[i];
buf[i][3] = spin[i];
buf[i][4] = eradius[i];
buf[i][5] = etag[i];
buf[i][6] = cs[2*i];
buf[i][7] = cs[2*i+1];
buf[i][8] = x[i][0];
buf[i][9] = x[i][1];
buf[i][10] = x[i][2];
buf[i][11] = (image[i] & IMGMASK) - IMGMAX;
buf[i][12] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
buf[i][13] = (image[i] >> IMG2BITS) - IMGMAX;
}
}
/* ----------------------------------------------------------------------
pack hybrid atom info for data file
------------------------------------------------------------------------- */
int AtomVecWavepacket::pack_data_hybrid(int i, double *buf)
{
buf[0] = q[i];
buf[1] = spin[i];
buf[2] = eradius[i];
buf[3] = etag[i];
buf[4] = cs[2*i];
buf[5] = cs[2*i+1];
return 6;
}
/* ----------------------------------------------------------------------
write atom info to data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecWavepacket::write_data(FILE *fp, int n, double **buf)
{
for (int i = 0; i < n; i++)
fprintf(fp,"%d %d %g %g %g %g %g %g %g %g %g %d %d %d\n",
(int) buf[i][0],(int) buf[i][1],
buf[i][2],(int) buf[i][3],buf[i][4],
(int) buf[i][5],buf[i][6],buf[i][7],
buf[i][8],buf[i][9],buf[i][10],
(int) buf[i][11],(int) buf[i][12],(int) buf[i][13]);
}
/* ----------------------------------------------------------------------
write hybrid atom info to data file
------------------------------------------------------------------------- */
int AtomVecWavepacket::write_data_hybrid(FILE *fp, double *buf)
{
fprintf(fp," %g %d %g %d %g %g",
buf[0],(int) buf[1],buf[2],(int) buf[3],buf[4],buf[5]);
return 6;
}
/* ----------------------------------------------------------------------
pack velocity info for data file
------------------------------------------------------------------------- */
void AtomVecWavepacket::pack_vel(double **buf)
{
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
buf[i][0] = tag[i];
buf[i][1] = v[i][0];
buf[i][2] = v[i][1];
buf[i][3] = v[i][2];
buf[i][4] = ervel[i];
}
}
/* ----------------------------------------------------------------------
pack hybrid velocity info for data file
------------------------------------------------------------------------- */
int AtomVecWavepacket::pack_vel_hybrid(int i, double *buf)
{
buf[0] = ervel[i];
return 1;
}
/* ----------------------------------------------------------------------
write velocity info to data file
------------------------------------------------------------------------- */
void AtomVecWavepacket::write_vel(FILE *fp, int n, double **buf)
{
for (int i = 0; i < n; i++)
fprintf(fp,"%d %g %g %g %g\n",
(int) buf[i][0],buf[i][1],buf[i][2],buf[i][3],buf[i][4]);
}
/* ----------------------------------------------------------------------
write hybrid velocity info to data file
------------------------------------------------------------------------- */
int AtomVecWavepacket::write_vel_hybrid(FILE *fp, double *buf)
{
fprintf(fp," %g",buf[0]);
return 1;
}
/* ----------------------------------------------------------------------
return # of bytes of allocated memory
------------------------------------------------------------------------- */

View File

@ -62,6 +62,14 @@ public:
int data_atom_hybrid(int, char **);
void data_vel(int, char **);
int data_vel_hybrid(int, char **);
void pack_data(double **);
int pack_data_hybrid(int, double *);
void write_data(FILE *, int, double **);
int write_data_hybrid(FILE *, double *);
void pack_vel(double **);
int pack_vel_hybrid(int, double *);
void write_vel(FILE *, int, double **);
int write_vel_hybrid(FILE *, double *);
bigint memory_usage();
private:

View File

@ -829,6 +829,111 @@ int AtomVecElectron::data_vel_hybrid(int m, char **values)
return 1;
}
/* ----------------------------------------------------------------------
pack atom info for data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecElectron::pack_data(double **buf)
{
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
buf[i][0] = tag[i];
buf[i][1] = type[i];
buf[i][2] = q[i];
buf[i][3] = spin[i];
buf[i][4] = eradius[i];
buf[i][5] = x[i][0];
buf[i][6] = x[i][1];
buf[i][7] = x[i][2];
buf[i][8] = (image[i] & IMGMASK) - IMGMAX;
buf[i][9] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
buf[i][10] = (image[i] >> IMG2BITS) - IMGMAX;
}
}
/* ----------------------------------------------------------------------
pack hybrid atom info for data file
------------------------------------------------------------------------- */
int AtomVecElectron::pack_data_hybrid(int i, double *buf)
{
buf[0] = q[i];
buf[1] = spin[i];
buf[2] = eradius[i];
return 3;
}
/* ----------------------------------------------------------------------
write atom info to data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecElectron::write_data(FILE *fp, int n, double **buf)
{
for (int i = 0; i < n; i++)
fprintf(fp,"%d %d %g %d %g %g %g %g %d %d %d\n",
(int) buf[i][0],(int) buf[i][1],buf[i][2],
(int) buf[i][3],buf[i][4],
buf[i][5],buf[i][6],buf[i][7],
(int) buf[i][8],(int) buf[i][9],(int) buf[i][10]);
}
/* ----------------------------------------------------------------------
write hybrid atom info to data file
------------------------------------------------------------------------- */
int AtomVecElectron::write_data_hybrid(FILE *fp, double *buf)
{
fprintf(fp," %g %d %g",buf[0],(int) buf[1],buf[2]);
return 3;
}
/* ----------------------------------------------------------------------
pack velocity info for data file
------------------------------------------------------------------------- */
void AtomVecElectron::pack_vel(double **buf)
{
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
buf[i][0] = tag[i];
buf[i][1] = v[i][0];
buf[i][2] = v[i][1];
buf[i][3] = v[i][2];
buf[i][4] = ervel[i];
}
}
/* ----------------------------------------------------------------------
pack velocity info for data file
------------------------------------------------------------------------- */
int AtomVecElectron::pack_vel_hybrid(int i, double *buf)
{
buf[0] = ervel[i];
return 1;
}
/* ----------------------------------------------------------------------
write hybrid velocity info to data file
------------------------------------------------------------------------- */
void AtomVecElectron::write_vel(FILE *fp, int n, double **buf)
{
for (int i = 0; i < n; i++)
fprintf(fp,"%d %g %g %g %g\n",
(int) buf[i][0],buf[i][1],buf[i][2],buf[i][3],buf[i][4]);
}
/* ----------------------------------------------------------------------
write hybrid velocity info to data file
------------------------------------------------------------------------- */
int AtomVecElectron::write_vel_hybrid(FILE *fp, double *buf)
{
fprintf(fp," %g",buf[0]);
return 1;
}
/* ----------------------------------------------------------------------
return # of bytes of allocated memory
------------------------------------------------------------------------- */
@ -849,7 +954,8 @@ bigint AtomVecElectron::memory_usage()
if (atom->memcheck("spin")) bytes += memory->usage(spin,nmax);
if (atom->memcheck("eradius")) bytes += memory->usage(eradius,nmax);
if (atom->memcheck("ervel")) bytes += memory->usage(ervel,nmax);
if (atom->memcheck("erforce")) bytes += memory->usage(erforce,nmax*comm->nthreads);
if (atom->memcheck("erforce"))
bytes += memory->usage(erforce,nmax*comm->nthreads);
return bytes;
}

View File

@ -57,6 +57,14 @@ class AtomVecElectron : public AtomVec {
int data_atom_hybrid(int, char **);
void data_vel(int, char **);
int data_vel_hybrid(int, char **);
void pack_data(double **);
int pack_data_hybrid(int, double *);
void write_data(FILE *, int, double **);
int write_data_hybrid(FILE *, double *);
void pack_vel(double **);
int pack_vel_hybrid(int, double *);
void write_vel(FILE *, int, double **);
int write_vel_hybrid(FILE *, double *);
bigint memory_usage();
private:

View File

@ -832,6 +832,64 @@ int AtomVecMeso::data_atom_hybrid(int nlocal, char **values) {
return 3;
}
/* ----------------------------------------------------------------------
pack atom info for data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecMeso::pack_data(double **buf)
{
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
buf[i][0] = tag[i];
buf[i][1] = type[i];
buf[i][2] = rho[i];
buf[i][3] = e[i];
buf[i][4] = cv[i];
buf[i][5] = x[i][0];
buf[i][6] = x[i][1];
buf[i][7] = x[i][2];
buf[i][8] = (image[i] & IMGMASK) - IMGMAX;
buf[i][9] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
buf[i][10] = (image[i] >> IMG2BITS) - IMGMAX;
}
}
/* ----------------------------------------------------------------------
pack hybrid atom info for data file
------------------------------------------------------------------------- */
int AtomVecMeso::pack_data_hybrid(int i, double *buf)
{
buf[0] = rho[i];
buf[1] = e[i];
buf[2] = cv[i];
return 3;
}
/* ----------------------------------------------------------------------
write atom info to data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecMeso::write_data(FILE *fp, int n, double **buf)
{
for (int i = 0; i < n; i++)
fprintf(fp,"%d %d %g %g %g %g %g %g %d %d %d\n",
(int) buf[i][0],(int) buf[i][1],
buf[i][2],buf[i][3],buf[i][4],
buf[i][5],buf[i][6],buf[i][7],
(int) buf[i][8],(int) buf[i][9],(int) buf[i][10]);
}
/* ----------------------------------------------------------------------
write hybrid atom info to data file
------------------------------------------------------------------------- */
int AtomVecMeso::write_data_hybrid(FILE *fp, double *buf)
{
fprintf(fp," %g %g %g",buf[0],buf[1],buf[2]);
return 3;
}
/* ----------------------------------------------------------------------
return # of bytes of allocated memory
------------------------------------------------------------------------- */

View File

@ -37,16 +37,12 @@ class AtomVecMeso : public AtomVec {
void unpack_comm_vel(int, int, double *);
int pack_reverse(int, int, double *);
void unpack_reverse(int, int *, double *);
int pack_comm_hybrid(int, int *, double *);
int unpack_comm_hybrid(int, int, double *);
int pack_border_hybrid(int, int *, double *);
int unpack_border_hybrid(int, int, double *);
int pack_reverse_hybrid(int, int, double *);
int unpack_reverse_hybrid(int, int *, double *);
int pack_border(int, int *, double *, int, int *);
int pack_border_vel(int, int *, double *, int, int *);
void unpack_border(int, int, double *);
@ -59,6 +55,10 @@ class AtomVecMeso : public AtomVec {
void create_atom(int, double *);
void data_atom(double *, tagint, char **);
int data_atom_hybrid(int, char **);
void pack_data(double **);
int pack_data_hybrid(int, double *);
void write_data(FILE *, int, double **);
int write_data_hybrid(FILE *, double *);
bigint memory_usage();
private:

View File

@ -30,6 +30,7 @@ using namespace MathConst;
Angle::Angle(LAMMPS *lmp) : Pointers(lmp)
{
energy = 0.0;
writedata = 0;
allocated = 0;
suffix_flag = Suffix::NONE;

View File

@ -25,6 +25,7 @@ class Angle : protected Pointers {
public:
int allocated;
int *setflag;
int writedata; // 1 if writes coeffs to data file
double energy; // accumulated energies
double virial[6]; // accumlated virial
double *eatom,**vatom; // accumulated per-atom energy/virial
@ -41,6 +42,7 @@ class Angle : protected Pointers {
virtual double equilibrium_angle(int) = 0;
virtual void write_restart(FILE *) = 0;
virtual void read_restart(FILE *) = 0;
virtual void write_data(FILE *) {}
virtual double single(int, int, int, int) = 0;
virtual double memory_usage();

View File

@ -14,6 +14,7 @@
#include "stdlib.h"
#include "atom_vec.h"
#include "atom.h"
#include "force.h"
#include "domain.h"
#include "error.h"
@ -64,3 +65,241 @@ void AtomVec::data_vel(int m, char **values)
v[m][1] = atof(values[1]);
v[m][2] = atof(values[2]);
}
/* ----------------------------------------------------------------------
pack velocity info for data file
------------------------------------------------------------------------- */
void AtomVec::pack_vel(double **buf)
{
double **v = atom->v;
int *tag = atom->tag;
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
buf[i][0] = tag[i];
buf[i][1] = v[i][0];
buf[i][2] = v[i][1];
buf[i][3] = v[i][2];
}
}
/* ----------------------------------------------------------------------
write velocity info to data file
------------------------------------------------------------------------- */
void AtomVec::write_vel(FILE *fp, int n, double **buf)
{
for (int i = 0; i < n; i++)
fprintf(fp,"%d %g %g %g\n",
(int) buf[i][0],buf[i][1],buf[i][2],buf[i][3]);
}
/* ----------------------------------------------------------------------
pack bond info for data file
------------------------------------------------------------------------- */
void AtomVec::pack_bond(int **buf)
{
int *tag = atom->tag;
int *num_bond = atom->num_bond;
int **bond_type = atom->bond_type;
int **bond_atom = atom->bond_atom;
int nlocal = atom->nlocal;
int newton_bond = force->newton_bond;
int i,j;
int m = 0;
if (newton_bond) {
for (i = 0; i < nlocal; i++)
for (j = 0; j < num_bond[i]; j++) {
buf[m][0] = bond_type[i][j];
buf[m][1] = tag[i];
buf[m][2] = bond_atom[i][j];
m++;
}
} else {
for (i = 0; i < nlocal; i++)
for (j = 0; j < num_bond[i]; j++)
if (tag[i] < bond_atom[i][j]) {
buf[m][0] = bond_type[i][j];
buf[m][1] = tag[i];
buf[m][2] = bond_atom[i][j];
m++;
}
}
}
/* ----------------------------------------------------------------------
write bond info to data file
------------------------------------------------------------------------- */
void AtomVec::write_bond(FILE *fp, int n, int **buf, int index)
{
for (int i = 0; i < n; i++) {
fprintf(fp,"%d %d %d %d\n",index,buf[i][0],buf[i][1],buf[i][2]);
index++;
}
}
/* ----------------------------------------------------------------------
pack angle info for data file
------------------------------------------------------------------------- */
void AtomVec::pack_angle(int **buf)
{
int *tag = atom->tag;
int *num_angle = atom->num_angle;
int **angle_type = atom->angle_type;
int **angle_atom1 = atom->angle_atom1;
int **angle_atom2 = atom->angle_atom2;
int **angle_atom3 = atom->angle_atom3;
int nlocal = atom->nlocal;
int newton_bond = force->newton_bond;
int i,j;
int m = 0;
if (newton_bond) {
for (i = 0; i < nlocal; i++)
for (j = 0; j < num_angle[i]; j++) {
buf[m][0] = angle_type[i][j];
buf[m][1] = angle_atom1[i][j];
buf[m][2] = angle_atom2[i][j];
buf[m][3] = angle_atom3[i][j];
m++;
}
} else {
for (i = 0; i < nlocal; i++)
for (j = 0; j < num_angle[i]; j++)
if (tag[i] == angle_atom2[i][j]) {
buf[m][0] = angle_type[i][j];
buf[m][1] = angle_atom1[i][j];
buf[m][2] = angle_atom2[i][j];
buf[m][3] = angle_atom3[i][j];
m++;
}
}
}
/* ----------------------------------------------------------------------
write angle info to data file
------------------------------------------------------------------------- */
void AtomVec::write_angle(FILE *fp, int n, int **buf, int index)
{
for (int i = 0; i < n; i++) {
fprintf(fp,"%d %d %d %d %d\n",index,
buf[i][0],buf[i][1],buf[i][2],buf[i][3]);
index++;
}
}
/* ----------------------------------------------------------------------
pack dihedral info for data file
------------------------------------------------------------------------- */
void AtomVec::pack_dihedral(int **buf)
{
int *tag = atom->tag;
int *num_dihedral = atom->num_dihedral;
int **dihedral_type = atom->dihedral_type;
int **dihedral_atom1 = atom->dihedral_atom1;
int **dihedral_atom2 = atom->dihedral_atom2;
int **dihedral_atom3 = atom->dihedral_atom3;
int **dihedral_atom4 = atom->dihedral_atom4;
int nlocal = atom->nlocal;
int newton_bond = force->newton_bond;
int i,j;
int m = 0;
if (newton_bond) {
for (i = 0; i < nlocal; i++)
for (j = 0; j < num_dihedral[i]; j++) {
buf[m][0] = dihedral_type[i][j];
buf[m][1] = dihedral_atom1[i][j];
buf[m][2] = dihedral_atom2[i][j];
buf[m][3] = dihedral_atom3[i][j];
buf[m][4] = dihedral_atom4[i][j];
m++;
}
} else {
for (i = 0; i < nlocal; i++)
for (j = 0; j < num_dihedral[i]; j++)
if (tag[i] == dihedral_atom2[i][j]) {
buf[m][0] = dihedral_type[i][j];
buf[m][1] = dihedral_atom1[i][j];
buf[m][2] = dihedral_atom2[i][j];
buf[m][3] = dihedral_atom3[i][j];
buf[m][4] = dihedral_atom4[i][j];
m++;
}
}
}
/* ----------------------------------------------------------------------
write dihedral info to data file
------------------------------------------------------------------------- */
void AtomVec::write_dihedral(FILE *fp, int n, int **buf, int index)
{
for (int i = 0; i < n; i++) {
fprintf(fp,"%d %d %d %d %d %d\n",index,
buf[i][0],buf[i][1],buf[i][2],buf[i][3],buf[i][4]);
index++;
}
}
/* ----------------------------------------------------------------------
pack improper info for data file
------------------------------------------------------------------------- */
void AtomVec::pack_improper(int **buf)
{
int *tag = atom->tag;
int *num_improper = atom->num_improper;
int **improper_type = atom->improper_type;
int **improper_atom1 = atom->improper_atom1;
int **improper_atom2 = atom->improper_atom2;
int **improper_atom3 = atom->improper_atom3;
int **improper_atom4 = atom->improper_atom4;
int nlocal = atom->nlocal;
int newton_bond = force->newton_bond;
int i,j;
int m = 0;
if (newton_bond) {
for (i = 0; i < nlocal; i++)
for (j = 0; j < num_improper[i]; j++) {
buf[m][0] = improper_type[i][j];
buf[m][1] = improper_atom1[i][j];
buf[m][2] = improper_atom2[i][j];
buf[m][3] = improper_atom3[i][j];
buf[m][4] = improper_atom4[i][j];
m++;
}
} else {
for (i = 0; i < nlocal; i++)
for (j = 0; j < num_improper[i]; j++)
if (tag[i] == improper_atom2[i][j]) {
buf[m][0] = improper_type[i][j];
buf[m][1] = improper_atom1[i][j];
buf[m][2] = improper_atom2[i][j];
buf[m][3] = improper_atom3[i][j];
buf[m][4] = improper_atom4[i][j];
m++;
}
}
}
/* ----------------------------------------------------------------------
write improper info to data file
------------------------------------------------------------------------- */
void AtomVec::write_improper(FILE *fp, int n, int **buf, int index)
{
for (int i = 0; i < n; i++) {
fprintf(fp,"%d %d %d %d %d %d\n",index,
buf[i][0],buf[i][1],buf[i][2],buf[i][3],buf[i][4]);
index++;
}
}

View File

@ -82,12 +82,31 @@ class AtomVec : protected Pointers {
virtual void read_restart_settings(FILE *) {}
virtual void create_atom(int, double *) = 0;
virtual void data_atom(double *, tagint, char **) = 0;
virtual void data_atom_bonus(int, char **) {}
virtual int data_atom_hybrid(int, char **) {return 0;}
virtual void data_vel(int, char **);
virtual int data_vel_hybrid(int, char **) {return 0;}
virtual void pack_data(double **) = 0;
virtual int pack_data_hybrid(int, double *) {return 0;}
virtual void write_data(FILE *, int, double **) = 0;
virtual int write_data_hybrid(FILE *, double *) {return 0;}
virtual void pack_vel(double **);
virtual int pack_vel_hybrid(int, double *) {return 0;}
virtual void write_vel(FILE *, int, double **);
virtual int write_vel_hybrid(FILE *, double *) {return 0;}
void pack_bond(int **);
void write_bond(FILE *, int, int **, int);
void pack_angle(int **);
void write_angle(FILE *, int, int **, int);
void pack_dihedral(int **);
void write_dihedral(FILE *, int, int **, int);
void pack_improper(int **);
void write_improper(FILE *, int, int **, int);
virtual bigint memory_usage() = 0;
protected:

View File

@ -615,6 +615,37 @@ void AtomVecAtomic::data_atom(double *coord, tagint imagetmp, char **values)
atom->nlocal++;
}
/* ----------------------------------------------------------------------
pack atom info for data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecAtomic::pack_data(double **buf)
{
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
buf[i][0] = tag[i];
buf[i][1] = type[i];
buf[i][2] = x[i][0];
buf[i][3] = x[i][1];
buf[i][4] = x[i][2];
buf[i][5] = (image[i] & IMGMASK) - IMGMAX;
buf[i][6] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
buf[i][7] = (image[i] >> IMG2BITS) - IMGMAX;
}
}
/* ----------------------------------------------------------------------
write atom info to data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecAtomic::write_data(FILE *fp, int n, double **buf)
{
for (int i = 0; i < n; i++)
fprintf(fp,"%d %d %g %g %g %d %d %d\n",
(int) buf[i][0],(int) buf[i][1],buf[i][2],buf[i][3],buf[i][4],
(int) buf[i][5],(int) buf[i][6],(int) buf[i][7]);
}
/* ----------------------------------------------------------------------
return # of bytes of allocated memory
------------------------------------------------------------------------- */

View File

@ -48,6 +48,8 @@ class AtomVecAtomic : public AtomVec {
int unpack_restart(double *);
void create_atom(int, double *);
void data_atom(double *, tagint, char **);
void pack_data(double **);
void write_data(FILE *, int, double **);
bigint memory_usage();
protected:

View File

@ -1378,6 +1378,118 @@ int AtomVecBody::data_vel_hybrid(int m, char **values)
return 3;
}
/* ----------------------------------------------------------------------
pack atom info for data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecBody::pack_data(double **buf)
{
double c2mc1[2],c3mc1[3],norm[3];
double area;
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
buf[i][0] = tag[i];
buf[i][1] = type[i];
if (body[i] < 0) buf[i][2] = 0;
else buf[i][2] = 1;
buf[i][3] = rmass[i];
buf[i][4] = x[i][0];
buf[i][5] = x[i][1];
buf[i][6] = x[i][2];
buf[i][7] = (image[i] & IMGMASK) - IMGMAX;
buf[i][8] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
buf[i][9] = (image[i] >> IMG2BITS) - IMGMAX;
}
}
/* ----------------------------------------------------------------------
pack hybrid atom info for data file
------------------------------------------------------------------------- */
int AtomVecBody::pack_data_hybrid(int i, double *buf)
{
if (body[i] < 0) buf[0] = 0;
else buf[0] = 1;
buf[1] = rmass[i];
return 2;
}
/* ----------------------------------------------------------------------
write atom info to data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecBody::write_data(FILE *fp, int n, double **buf)
{
for (int i = 0; i < n; i++)
fprintf(fp,"%d %d %d %g %g %g %g %d %d %d\n",
(int) buf[i][0],(int) buf[i][1],(int) buf[i][2],
buf[i][3],buf[i][4],buf[i][5],buf[i][6],
(int) buf[i][7],(int) buf[i][8],(int) buf[i][9]);
}
/* ----------------------------------------------------------------------
write hybrid atom info to data file
------------------------------------------------------------------------- */
int AtomVecBody::write_data_hybrid(FILE *fp, double *buf)
{
fprintf(fp," %d %g",(int) buf[0],buf[1]);
return 2;
}
/* ----------------------------------------------------------------------
pack velocity info for data file
------------------------------------------------------------------------- */
void AtomVecBody::pack_vel(double **buf)
{
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
buf[i][0] = tag[i];
buf[i][1] = v[i][0];
buf[i][2] = v[i][1];
buf[i][3] = v[i][2];
buf[i][4] = angmom[i][0];
buf[i][5] = angmom[i][1];
buf[i][6] = angmom[i][2];
}
}
/* ----------------------------------------------------------------------
pack hybrid velocity info for data file
------------------------------------------------------------------------- */
int AtomVecBody::pack_vel_hybrid(int i, double *buf)
{
buf[0] = angmom[i][0];
buf[1] = angmom[i][1];
buf[2] = angmom[i][2];
return 3;
}
/* ----------------------------------------------------------------------
write velocity info to data file
------------------------------------------------------------------------- */
void AtomVecBody::write_vel(FILE *fp, int n, double **buf)
{
for (int i = 0; i < n; i++)
fprintf(fp,"%d %g %g %g %g %g %g\n",
(int) buf[i][0],buf[i][1],buf[i][2],buf[i][3],
buf[i][4],buf[i][5],buf[i][6]);
}
/* ----------------------------------------------------------------------
write hybrid velocity info to data file
------------------------------------------------------------------------- */
int AtomVecBody::write_vel_hybrid(FILE *fp, double *buf)
{
fprintf(fp," %g %g %g",buf[0],buf[1],buf[2]);
return 3;
}
/* ----------------------------------------------------------------------
return # of bytes of allocated memory
------------------------------------------------------------------------- */

View File

@ -74,6 +74,14 @@ class AtomVecBody : public AtomVec {
int data_atom_hybrid(int, char **);
void data_vel(int, char **);
int data_vel_hybrid(int, char **);
void pack_data(double **);
int pack_data_hybrid(int, double *);
void write_data(FILE *, int, double **);
int write_data_hybrid(FILE *, double *);
void pack_vel(double **);
int pack_vel_hybrid(int, double *);
void write_vel(FILE *, int, double **);
int write_vel_hybrid(FILE *, double *);
bigint memory_usage();
// manipulate Bonus data structure for extra atom info

View File

@ -680,6 +680,59 @@ int AtomVecCharge::data_atom_hybrid(int nlocal, char **values)
return 1;
}
/* ----------------------------------------------------------------------
pack atom info for data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecCharge::pack_data(double **buf)
{
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
buf[i][0] = tag[i];
buf[i][1] = type[i];
buf[i][2] = q[i];
buf[i][3] = x[i][0];
buf[i][4] = x[i][1];
buf[i][5] = x[i][2];
buf[i][6] = (image[i] & IMGMASK) - IMGMAX;
buf[i][7] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
buf[i][8] = (image[i] >> IMG2BITS) - IMGMAX;
}
}
/* ----------------------------------------------------------------------
pack hybrid atom info for data file
------------------------------------------------------------------------- */
int AtomVecCharge::pack_data_hybrid(int i, double *buf)
{
buf[0] = q[i];
return 1;
}
/* ----------------------------------------------------------------------
write atom info to data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecCharge::write_data(FILE *fp, int n, double **buf)
{
for (int i = 0; i < n; i++)
fprintf(fp,"%d %d %g %g %g %g %d %d %d\n",
(int) buf[i][0],(int) buf[i][1],buf[i][2],
buf[i][3],buf[i][4],buf[i][5],
(int) buf[i][6],(int) buf[i][7],(int) buf[i][8]);
}
/* ----------------------------------------------------------------------
write hybrid atom info to data file
------------------------------------------------------------------------- */
int AtomVecCharge::write_data_hybrid(FILE *fp, double *buf)
{
fprintf(fp," %d",buf[0]);
return 1;
}
/* ----------------------------------------------------------------------
return # of bytes of allocated memory
------------------------------------------------------------------------- */

View File

@ -51,6 +51,10 @@ class AtomVecCharge : public AtomVec {
void create_atom(int, double *);
void data_atom(double *, tagint, char **);
int data_atom_hybrid(int, char **);
void pack_data(double **);
int pack_data_hybrid(int, double *);
void write_data(FILE *, int, double **);
int write_data_hybrid(FILE *, double *);
bigint memory_usage();
protected:

View File

@ -1234,6 +1234,125 @@ int AtomVecEllipsoid::data_vel_hybrid(int m, char **values)
return 3;
}
/* ----------------------------------------------------------------------
pack atom info for data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecEllipsoid::pack_data(double **buf)
{
double *shape;
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
buf[i][0] = tag[i];
buf[i][1] = type[i];
if (ellipsoid[i] < 0) buf[i][2] = 0;
else buf[i][2] = 1;
if (ellipsoid[i] < 0) buf[i][3] = rmass[i];
else {
shape = bonus[ellipsoid[i]].shape;
buf[i][3] = rmass[i] / (4.0*MY_PI/3.0 * shape[0]*shape[1]*shape[2]);
}
buf[i][4] = x[i][0];
buf[i][5] = x[i][1];
buf[i][6] = x[i][2];
buf[i][7] = (image[i] & IMGMASK) - IMGMAX;
buf[i][8] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
buf[i][9] = (image[i] >> IMG2BITS) - IMGMAX;
}
}
/* ----------------------------------------------------------------------
pack hybrid atom info for data file
------------------------------------------------------------------------- */
int AtomVecEllipsoid::pack_data_hybrid(int i, double *buf)
{
if (ellipsoid[i] < 0) buf[0] = 0;
else buf[0] = 1;
if (ellipsoid[i] < 0) buf[1] = rmass[i];
else {
double *shape = bonus[ellipsoid[i]].shape;
buf[1] = rmass[i] / (4.0*MY_PI/3.0 * shape[0]*shape[1]*shape[2]);
}
return 2;
}
/* ----------------------------------------------------------------------
write atom info to data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecEllipsoid::write_data(FILE *fp, int n, double **buf)
{
for (int i = 0; i < n; i++)
fprintf(fp,"%d %d %d %g %g %g %g %d %d %d\n",
(int) buf[i][0],(int) buf[i][1],(int) buf[i][2],
buf[i][3],buf[i][4],buf[i][5],buf[i][6],
(int) buf[i][7],(int) buf[i][8],(int) buf[i][9]);
}
/* ----------------------------------------------------------------------
write hybrid atom info to data file
------------------------------------------------------------------------- */
int AtomVecEllipsoid::write_data_hybrid(FILE *fp, double *buf)
{
fprintf(fp," %d %g",(int) buf[0],buf[1]);
return 2;
}
/* ----------------------------------------------------------------------
pack velocity info for data file
------------------------------------------------------------------------- */
void AtomVecEllipsoid::pack_vel(double **buf)
{
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
buf[i][0] = tag[i];
buf[i][1] = v[i][0];
buf[i][2] = v[i][1];
buf[i][3] = v[i][2];
buf[i][4] = angmom[i][0];
buf[i][5] = angmom[i][1];
buf[i][6] = angmom[i][2];
}
}
/* ----------------------------------------------------------------------
pack hybrid velocity info for data file
------------------------------------------------------------------------- */
int AtomVecEllipsoid::pack_vel_hybrid(int i, double *buf)
{
buf[0] = angmom[i][0];
buf[1] = angmom[i][1];
buf[2] = angmom[i][2];
return 3;
}
/* ----------------------------------------------------------------------
write velocity info to data file
------------------------------------------------------------------------- */
void AtomVecEllipsoid::write_vel(FILE *fp, int n, double **buf)
{
for (int i = 0; i < n; i++)
fprintf(fp,"%d %g %g %g %g %g %g\n",
(int) buf[i][0],buf[i][1],buf[i][2],buf[i][3],
buf[i][4],buf[i][5],buf[i][6]);
}
/* ----------------------------------------------------------------------
write hybrid velocity info to data file
------------------------------------------------------------------------- */
int AtomVecEllipsoid::write_vel_hybrid(FILE *fp, double *buf)
{
fprintf(fp," %g %g %g",buf[0],buf[1],buf[2]);
return 3;
}
/* ----------------------------------------------------------------------
return # of bytes of allocated memory
------------------------------------------------------------------------- */

View File

@ -64,6 +64,14 @@ class AtomVecEllipsoid : public AtomVec {
int data_atom_hybrid(int, char **);
void data_vel(int, char **);
int data_vel_hybrid(int, char **);
void pack_data(double **);
int pack_data_hybrid(int, double *);
void write_data(FILE *, int, double **);
int write_data_hybrid(FILE *, double *);
void pack_vel(double **);
int pack_vel_hybrid(int, double *);
void write_vel(FILE *, int, double **);
int write_vel_hybrid(FILE *, double *);
bigint memory_usage();
// manipulate Bonus data structure for extra atom info

View File

@ -901,6 +901,95 @@ void AtomVecHybrid::data_vel(int m, char **values)
n += styles[k]->data_vel_hybrid(m,&values[n]);
}
/* ----------------------------------------------------------------------
pack atom info for data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecHybrid::pack_data(double **buf)
{
int k,m;
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
buf[i][0] = tag[i];
buf[i][1] = type[i];
buf[i][2] = x[i][0];
buf[i][3] = x[i][1];
buf[i][4] = x[i][2];
m = 5;
for (k = 0; k < nstyles; k++)
m += styles[k]->pack_data_hybrid(i,&buf[i][m]);
buf[i][m] = (image[i] & IMGMASK) - IMGMAX;
buf[i][m+1] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
buf[i][m+2] = (image[i] >> IMG2BITS) - IMGMAX;
}
}
/* ----------------------------------------------------------------------
write atom info to data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecHybrid::write_data(FILE *fp, int n, double **buf)
{
int k,m;
for (int i = 0; i < n; i++) {
fprintf(fp,"%d %d %g %g %g",
(int) buf[i][0],(int) buf[i][1],
buf[i][2],buf[i][3],buf[i][4]);
m = 5;
for (k = 0; k < nstyles; k++)
m += styles[k]->write_data_hybrid(fp,&buf[i][m]);
fprintf(fp," %d %d %d\n",
(int) buf[i][m],(int) buf[i][m+1],(int) buf[i][m+2]);
}
}
/* ----------------------------------------------------------------------
pack velocity info for data file
------------------------------------------------------------------------- */
void AtomVecHybrid::pack_vel(double **buf)
{
int k,m;
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
buf[i][0] = tag[i];
buf[i][1] = v[i][0];
buf[i][2] = v[i][1];
buf[i][3] = v[i][2];
m = 4;
for (k = 0; k < nstyles; k++)
m += styles[k]->pack_vel_hybrid(i,&buf[i][m]);
}
}
/* ----------------------------------------------------------------------
write velocity info to data file
------------------------------------------------------------------------- */
void AtomVecHybrid::write_vel(FILE *fp, int n, double **buf)
{
int k,m;
for (int i = 0; i < n; i++) {
fprintf(fp,"%d %g %g %g",
(int) buf[i][0],buf[i][1],buf[i][2],buf[i][3]);
m = 4;
for (k = 0; k < nstyles; k++)
m += styles[k]->write_vel_hybrid(fp,&buf[i][m]);
fprintf(fp,"\n");
}
}
/* ----------------------------------------------------------------------
allstyles = list of all atom styles in this LAMMPS executable
------------------------------------------------------------------------- */

View File

@ -60,6 +60,10 @@ class AtomVecHybrid : public AtomVec {
void data_atom(double *, tagint, char **);
int data_atom_hybrid(int, char **) {return 0;}
void data_vel(int, char **);
void pack_data(double **);
void write_data(FILE *, int, double **);
void pack_vel(double **);
void write_vel(FILE *, int, double **);
bigint memory_usage();
private:

View File

@ -1105,6 +1105,119 @@ int AtomVecLine::data_vel_hybrid(int m, char **values)
return 3;
}
/* ----------------------------------------------------------------------
pack atom info for data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecLine::pack_data(double **buf)
{
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
buf[i][0] = tag[i];
buf[i][1] = molecule[i];
buf[i][2] = type[i];
if (line[i] < 0) buf[i][3] = 0;
else buf[i][3] = 1;
if (line[i] < 0) buf[i][4] = rmass[i];
else buf[i][4] = rmass[i]/bonus[line[i]].length;
buf[i][5] = x[i][0];
buf[i][6] = x[i][1];
buf[i][7] = x[i][2];
buf[i][8] = (image[i] & IMGMASK) - IMGMAX;
buf[i][9] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
buf[i][10] = (image[i] >> IMG2BITS) - IMGMAX;
}
}
/* ----------------------------------------------------------------------
pack hybrid atom info for data file
------------------------------------------------------------------------- */
int AtomVecLine::pack_data_hybrid(int i, double *buf)
{
buf[0] = molecule[i];
if (line[i] < 0) buf[1] = 0;
else buf[1] = 1;
if (line[i] < 0) buf[2] = rmass[i];
else buf[2] = rmass[i]/bonus[line[i]].length;
return 3;
}
/* ----------------------------------------------------------------------
write atom info to data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecLine::write_data(FILE *fp, int n, double **buf)
{
for (int i = 0; i < n; i++)
fprintf(fp,"%d %d %d %d %g %g %g %g %d %d %d\n",
(int) buf[i][0],(int) buf[i][1],(int) buf[i][2],(int) buf[i][3],
buf[i][4],buf[i][5],buf[i][6],buf[i][7],
(int) buf[i][8],(int) buf[i][9],(int) buf[i][10]);
}
/* ----------------------------------------------------------------------
write hybrid atom info to data file
------------------------------------------------------------------------- */
int AtomVecLine::write_data_hybrid(FILE *fp, double *buf)
{
fprintf(fp," %d %d %g",(int) buf[0],(int) buf[1],buf[2]);
return 3;
}
/* ----------------------------------------------------------------------
pack velocity info for data file
------------------------------------------------------------------------- */
void AtomVecLine::pack_vel(double **buf)
{
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
buf[i][0] = tag[i];
buf[i][1] = v[i][0];
buf[i][2] = v[i][1];
buf[i][3] = v[i][2];
buf[i][4] = omega[i][0];
buf[i][5] = omega[i][1];
buf[i][6] = omega[i][2];
}
}
/* ----------------------------------------------------------------------
pack hybrid velocity info for data file
------------------------------------------------------------------------- */
int AtomVecLine::pack_vel_hybrid(int i, double *buf)
{
buf[0] = omega[i][0];
buf[1] = omega[i][1];
buf[2] = omega[i][2];
return 3;
}
/* ----------------------------------------------------------------------
write velocity info to data file
------------------------------------------------------------------------- */
void AtomVecLine::write_vel(FILE *fp, int n, double **buf)
{
for (int i = 0; i < n; i++)
fprintf(fp,"%d %g %g %g %g %g %g\n",
(int) buf[i][0],buf[i][1],buf[i][2],buf[i][3],
buf[i][4],buf[i][5],buf[i][6]);
}
/* ----------------------------------------------------------------------
write hybrid velocity info to data file
------------------------------------------------------------------------- */
int AtomVecLine::write_vel_hybrid(FILE *fp, double *buf)
{
fprintf(fp," %g %g %g",buf[0],buf[1],buf[2]);
return 3;
}
/* ----------------------------------------------------------------------
return # of bytes of allocated memory
------------------------------------------------------------------------- */

View File

@ -64,6 +64,14 @@ class AtomVecLine : public AtomVec {
int data_atom_hybrid(int, char **);
void data_vel(int, char **);
int data_vel_hybrid(int, char **);
void pack_data(double **);
int pack_data_hybrid(int, double *);
void write_data(FILE *, int, double **);
int write_data_hybrid(FILE *, double *);
void pack_vel(double **);
int pack_vel_hybrid(int, double *);
void write_vel(FILE *, int, double **);
int write_vel_hybrid(FILE *, double *);
bigint memory_usage();
// manipulate Bonus data structure for extra atom info

View File

@ -1033,6 +1033,118 @@ int AtomVecSphere::data_vel_hybrid(int m, char **values)
return 3;
}
/* ----------------------------------------------------------------------
pack atom info for data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecSphere::pack_data(double **buf)
{
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
buf[i][0] = tag[i];
buf[i][1] = type[i];
buf[i][2] = 2.0*radius[i];
if (radius[i] == 0.0) buf[i][3] = rmass[i];
else
buf[i][3] = rmass[i] / (4.0*MY_PI/3.0 * radius[i]*radius[i]*radius[i]);
buf[i][4] = x[i][0];
buf[i][5] = x[i][0];
buf[i][6] = x[i][1];
buf[i][7] = x[i][2];
buf[i][8] = (image[i] & IMGMASK) - IMGMAX;
buf[i][9] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
buf[i][10] = (image[i] >> IMG2BITS) - IMGMAX;
}
}
/* ----------------------------------------------------------------------
pack hybrid atom info for data file
------------------------------------------------------------------------- */
int AtomVecSphere::pack_data_hybrid(int i, double *buf)
{
buf[0] = 2.0*radius[i];
if (radius[i] == 0.0) buf[1] = rmass[i];
else buf[1] = rmass[i] / (4.0*MY_PI/3.0 * radius[i]*radius[i]*radius[i]);
return 2;
}
/* ----------------------------------------------------------------------
write atom info to data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecSphere::write_data(FILE *fp, int n, double **buf)
{
for (int i = 0; i < n; i++)
fprintf(fp,"%d %d %g %g %g %g %g %d %d %d\n",
(int) buf[i][0],(int) buf[i][1],
buf[i][2],buf[i][3],
buf[i][4],buf[i][5],buf[i][6],
(int) buf[i][7],(int) buf[i][8],(int) buf[i][9]);
}
/* ----------------------------------------------------------------------
write hybrid atom info to data file
------------------------------------------------------------------------- */
int AtomVecSphere::write_data_hybrid(FILE *fp, double *buf)
{
fprintf(fp," %g %g",buf[0],buf[1]);
return 2;
}
/* ----------------------------------------------------------------------
pack velocity info for data file
------------------------------------------------------------------------- */
void AtomVecSphere::pack_vel(double **buf)
{
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
buf[i][0] = tag[i];
buf[i][1] = v[i][0];
buf[i][2] = v[i][1];
buf[i][3] = v[i][2];
buf[i][4] = omega[i][0];
buf[i][5] = omega[i][1];
buf[i][6] = omega[i][2];
}
}
/* ----------------------------------------------------------------------
pack hybrid velocity info for data file
------------------------------------------------------------------------- */
int AtomVecSphere::pack_vel_hybrid(int i, double *buf)
{
buf[0] = omega[i][0];
buf[1] = omega[i][1];
buf[2] = omega[i][2];
return 3;
}
/* ----------------------------------------------------------------------
write velocity info to data file
------------------------------------------------------------------------- */
void AtomVecSphere::write_vel(FILE *fp, int n, double **buf)
{
for (int i = 0; i < n; i++)
fprintf(fp,"%d %g %g %g %g %g %g\n",
(int) buf[i][0],buf[i][1],buf[i][2],buf[i][3],
buf[i][4],buf[i][5],buf[i][6]);
}
/* ----------------------------------------------------------------------
write hybrid velocity info to data file
------------------------------------------------------------------------- */
int AtomVecSphere::write_vel_hybrid(FILE *fp, double *buf)
{
fprintf(fp," %g %g %g",buf[0],buf[1],buf[2]);
return 3;
}
/* ----------------------------------------------------------------------
return # of bytes of allocated memory
------------------------------------------------------------------------- */
@ -1052,7 +1164,8 @@ bigint AtomVecSphere::memory_usage()
if (atom->memcheck("radius")) bytes += memory->usage(radius,nmax);
if (atom->memcheck("rmass")) bytes += memory->usage(rmass,nmax);
if (atom->memcheck("omega")) bytes += memory->usage(omega,nmax,3);
if (atom->memcheck("torque")) bytes += memory->usage(torque,nmax*comm->nthreads,3);
if (atom->memcheck("torque"))
bytes += memory->usage(torque,nmax*comm->nthreads,3);
return bytes;
}

View File

@ -58,6 +58,14 @@ class AtomVecSphere : public AtomVec {
int data_atom_hybrid(int, char **);
void data_vel(int, char **);
int data_vel_hybrid(int, char **);
void pack_data(double **);
int pack_data_hybrid(int, double *);
void write_data(FILE *, int, double **);
int write_data_hybrid(FILE *, double *);
void pack_vel(double **);
int pack_vel_hybrid(int, double *);
void write_vel(FILE *, int, double **);
int write_vel_hybrid(FILE *, double *);
bigint memory_usage();
private:

View File

@ -1537,6 +1537,135 @@ int AtomVecTri::data_vel_hybrid(int m, char **values)
return 3;
}
/* ----------------------------------------------------------------------
pack atom info for data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecTri::pack_data(double **buf)
{
double c2mc1[2],c3mc1[3],norm[3];
double area;
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
buf[i][0] = tag[i];
buf[i][1] = molecule[i];
buf[i][2] = type[i];
if (tri[i] < 0) buf[i][3] = 0;
else buf[i][3] = 1;
if (tri[i] < 0) buf[i][4] = rmass[i];
else {
MathExtra::sub3(bonus[tri[i]].c2,bonus[tri[i]].c1,c2mc1);
MathExtra::sub3(bonus[tri[i]].c3,bonus[tri[i]].c1,c3mc1);
MathExtra::cross3(c2mc1,c3mc1,norm);
area = 0.5 * MathExtra::len3(norm);
buf[i][4] = rmass[i]/area;
}
buf[i][5] = x[i][0];
buf[i][6] = x[i][1];
buf[i][7] = x[i][2];
buf[i][8] = (image[i] & IMGMASK) - IMGMAX;
buf[i][9] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
buf[i][10] = (image[i] >> IMG2BITS) - IMGMAX;
}
}
/* ----------------------------------------------------------------------
pack hybrid atom info for data file
------------------------------------------------------------------------- */
int AtomVecTri::pack_data_hybrid(int i, double *buf)
{
buf[0] = molecule[i];
if (tri[i] < 0) buf[1] = 0;
else buf[1] = 1;
if (tri[i] < 0) buf[2] = rmass[i];
else {
double c2mc1[2],c3mc1[3],norm[3];
MathExtra::sub3(bonus[tri[i]].c2,bonus[tri[i]].c1,c2mc1);
MathExtra::sub3(bonus[tri[i]].c3,bonus[tri[i]].c1,c3mc1);
MathExtra::cross3(c2mc1,c3mc1,norm);
double area = 0.5 * MathExtra::len3(norm);
buf[2] = rmass[i]/area;
}
return 3;
}
/* ----------------------------------------------------------------------
write atom info to data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecTri::write_data(FILE *fp, int n, double **buf)
{
for (int i = 0; i < n; i++)
fprintf(fp,"%d %d %d %d %g %g %g %g %d %d %d\n",
(int) buf[i][0],(int) buf[i][1],(int) buf[i][2],(int) buf[i][3],
buf[i][4],buf[i][5],buf[i][6],buf[i][7],
(int) buf[i][8],(int) buf[i][9],(int) buf[i][10]);
}
/* ----------------------------------------------------------------------
write hybrid atom info to data file
------------------------------------------------------------------------- */
int AtomVecTri::write_data_hybrid(FILE *fp, double *buf)
{
fprintf(fp," %d %d %g",(int) buf[0],(int) buf[1],buf[2]);
return 3;
}
/* ----------------------------------------------------------------------
pack velocity info for data file
------------------------------------------------------------------------- */
void AtomVecTri::pack_vel(double **buf)
{
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
buf[i][0] = tag[i];
buf[i][1] = v[i][0];
buf[i][2] = v[i][1];
buf[i][3] = v[i][2];
buf[i][4] = angmom[i][0];
buf[i][5] = angmom[i][1];
buf[i][6] = angmom[i][2];
}
}
/* ----------------------------------------------------------------------
pack hybrid velocity info for data file
------------------------------------------------------------------------- */
int AtomVecTri::pack_vel_hybrid(int i, double *buf)
{
buf[0] = angmom[i][0];
buf[1] = angmom[i][1];
buf[2] = angmom[i][2];
return 3;
}
/* ----------------------------------------------------------------------
write velocity info to data file
------------------------------------------------------------------------- */
void AtomVecTri::write_vel(FILE *fp, int n, double **buf)
{
for (int i = 0; i < n; i++)
fprintf(fp,"%d %g %g %g %g %g %g\n",
(int) buf[i][0],buf[i][1],buf[i][2],buf[i][3],
buf[i][4],buf[i][5],buf[i][6]);
}
/* ----------------------------------------------------------------------
write hybrid velocity info to data file
------------------------------------------------------------------------- */
int AtomVecTri::write_vel_hybrid(FILE *fp, double *buf)
{
fprintf(fp," %g %g %g",buf[0],buf[1],buf[2]);
return 3;
}
/* ----------------------------------------------------------------------
return # of bytes of allocated memory
------------------------------------------------------------------------- */

View File

@ -66,6 +66,14 @@ class AtomVecTri : public AtomVec {
int data_atom_hybrid(int, char **);
void data_vel(int, char **);
int data_vel_hybrid(int, char **);
void pack_data(double **);
int pack_data_hybrid(int, double *);
void write_data(FILE *, int, double **);
int write_data_hybrid(FILE *, double *);
void pack_vel(double **);
int pack_vel_hybrid(int, double *);
void write_vel(FILE *, int, double **);
int write_vel_hybrid(FILE *, double *);
bigint memory_usage();
// manipulate Bonus data structure for extra atom info

View File

@ -31,6 +31,7 @@ using namespace LAMMPS_NS;
Bond::Bond(LAMMPS *lmp) : Pointers(lmp)
{
energy = 0.0;
writedata = 0;
allocated = 0;
suffix_flag = Suffix::NONE;

View File

@ -25,6 +25,7 @@ class Bond : protected Pointers {
public:
int allocated;
int *setflag;
int writedata; // 1 if writes coeffs to data file
double energy; // accumulated energies
double virial[6]; // accumlated virial
double *eatom,**vatom; // accumulated per-atom energy/virial
@ -41,6 +42,7 @@ class Bond : protected Pointers {
virtual double equilibrium_distance(int) = 0;
virtual void write_restart(FILE *) = 0;
virtual void read_restart(FILE *) = 0;
virtual void write_data(FILE *) {}
virtual double single(int, double, int, int, double &) = 0;
virtual double memory_usage();

View File

@ -32,6 +32,7 @@ using namespace LAMMPS_NS;
Dihedral::Dihedral(LAMMPS *lmp) : Pointers(lmp)
{
energy = 0.0;
writedata = 0;
allocated = 0;

View File

@ -25,6 +25,7 @@ class Dihedral : protected Pointers {
public:
int allocated;
int *setflag;
int writedata; // 1 if writes coeffs to data file
double energy; // accumulated energy
double virial[6]; // accumlated virial
double *eatom,**vatom; // accumulated per-atom energy/virial
@ -40,6 +41,7 @@ class Dihedral : protected Pointers {
virtual void coeff(int, char **) = 0;
virtual void write_restart(FILE *) = 0;
virtual void read_restart(FILE *) = 0;
virtual void write_data(FILE *) {}
virtual double memory_usage();
virtual unsigned int data_mask() {return datamask;}

View File

@ -28,6 +28,7 @@ using namespace LAMMPS_NS;
Improper::Improper(LAMMPS *lmp) : Pointers(lmp)
{
energy = 0.0;
writedata = 0;
allocated = 0;
suffix_flag = Suffix::NONE;

View File

@ -25,6 +25,7 @@ class Improper : protected Pointers {
public:
int allocated;
int *setflag;
int writedata; // 1 if writes coeffs to data file
double energy; // accumulated energies
double virial[6]; // accumlated virial
double *eatom,**vatom; // accumulated per-atom energy/virial
@ -39,6 +40,7 @@ class Improper : protected Pointers {
virtual void coeff(int, char **) = 0;
virtual void write_restart(FILE *) = 0;
virtual void read_restart(FILE *) = 0;
virtual void write_data(FILE *) {}
virtual double memory_usage();
virtual unsigned int data_mask() {return datamask;}

View File

@ -58,6 +58,7 @@ Pair::Pair(LAMMPS *lmp) : Pointers(lmp)
respa_enable = 0;
one_coeff = 0;
no_virial_fdotr_compute = 0;
writedata = 0;
ghostneigh = 0;
nextra = 0;

View File

@ -47,6 +47,7 @@ class Pair : protected Pointers {
int respa_enable; // 1 if inner/middle/outer rRESPA routines
int one_coeff; // 1 if allows only one coeff * * call
int no_virial_fdotr_compute; // 1 if does not invoke virial_fdotr_compute()
int writedata; // 1 if writes coeffs to data file
int ghostneigh; // 1 if pair style needs neighbors of ghosts
double **cutghost; // cutoff for each ghost pair
@ -151,6 +152,7 @@ class Pair : protected Pointers {
virtual void read_restart(FILE *) {}
virtual void write_restart_settings(FILE *) {}
virtual void read_restart_settings(FILE *) {}
virtual void write_data(FILE *) {}
virtual int pack_comm(int, int *, double *, int, int *) {return 0;}
virtual void unpack_comm(int, int, double *) {}

View File

@ -41,6 +41,7 @@ using namespace MathConst;
PairLJCut::PairLJCut(LAMMPS *lmp) : Pair(lmp)
{
respa_enable = 1;
writedata = 1;
}
/* ---------------------------------------------------------------------- */
@ -679,6 +680,16 @@ void PairLJCut::read_restart_settings(FILE *fp)
MPI_Bcast(&tail_flag,1,MPI_INT,0,world);
}
/* ----------------------------------------------------------------------
proc 0 writes to data file
------------------------------------------------------------------------- */
void PairLJCut::write_data(FILE *fp)
{
for (int i = 1; i <= atom->ntypes; i++)
fprintf(fp,"%d %g %g\n",i,epsilon[i][i],sigma[i][i]);
}
/* ---------------------------------------------------------------------- */
double PairLJCut::single(int i, int j, int itype, int jtype, double rsq,

View File

@ -38,6 +38,7 @@ class PairLJCut : public Pair {
void read_restart(FILE *);
void write_restart_settings(FILE *);
void read_restart_settings(FILE *);
void write_data(FILE *);
double single(int, int, int, int, double, double, double, double &);
void *extract(const char *, int &);

View File

@ -20,6 +20,7 @@ namespace LAMMPS_NS {
class Thermo : protected Pointers {
friend class WriteRestart; // accesses lostflag
friend class WriteData; // accesses lostflag
friend class MinCG; // accesses compute_pe
public: