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

This commit is contained in:
sjplimp 2013-04-03 16:52:48 +00:00
parent da77d5e62a
commit 2206f011e9
20 changed files with 412 additions and 4 deletions

View File

@ -809,6 +809,66 @@ int AtomVecDipole::data_atom_hybrid(int nlocal, char **values)
return 4;
}
/* ----------------------------------------------------------------------
pack atom info for data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecDipole::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] = mu[i][0];
buf[i][7] = mu[i][1];
buf[i][8] = mu[i][2];
buf[i][9] = (image[i] & IMGMASK) - IMGMAX;
buf[i][10] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
buf[i][11] = (image[i] >> IMG2BITS) - IMGMAX;
}
}
/* ----------------------------------------------------------------------
pack hybrid atom info for data file
------------------------------------------------------------------------- */
int AtomVecDipole::pack_data_hybrid(int i, double *buf)
{
buf[0] = q[i];
buf[1] = mu[i][0];
buf[2] = mu[i][1];
buf[3] = mu[i][2];
return 4;
}
/* ----------------------------------------------------------------------
write atom info to data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecDipole::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 %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],buf[i][8],
(int) buf[i][9],(int) buf[i][10],(int) buf[i][11]);
}
/* ----------------------------------------------------------------------
write hybrid atom info to data file
------------------------------------------------------------------------- */
int AtomVecDipole::write_data_hybrid(FILE *fp, double *buf)
{
fprintf(fp," %g %g %g %g",buf[0],buf[1],buf[2],buf[3]);
return 4;
}
/* ----------------------------------------------------------------------
return # of bytes of allocated memory
------------------------------------------------------------------------- */

View File

@ -52,6 +52,10 @@ class AtomVecDipole : 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,7 +30,10 @@ using namespace MathConst;
/* ---------------------------------------------------------------------- */
AngleHarmonic::AngleHarmonic(LAMMPS *lmp) : Angle(lmp) {}
AngleHarmonic::AngleHarmonic(LAMMPS *lmp) : Angle(lmp)
{
writedata = 1;
}
/* ---------------------------------------------------------------------- */
@ -221,6 +224,16 @@ void AngleHarmonic::read_restart(FILE *fp)
for (int i = 1; i <= atom->nangletypes; i++) setflag[i] = 1;
}
/* ----------------------------------------------------------------------
proc 0 writes to data file
------------------------------------------------------------------------- */
void AngleHarmonic::write_data(FILE *fp)
{
for (int i = 1; i <= atom->nangletypes; i++)
fprintf(fp,"%d %g %g\n",i,k[i],theta0[i]/MY_PI*180.0);
}
/* ---------------------------------------------------------------------- */
double AngleHarmonic::single(int type, int i1, int i2, int i3)

View File

@ -34,6 +34,7 @@ class AngleHarmonic : public Angle {
double equilibrium_angle(int);
void write_restart(FILE *);
void read_restart(FILE *);
void write_data(FILE *);
double single(int, int, int, int);
protected:

View File

@ -812,6 +812,59 @@ int AtomVecAngle::data_atom_hybrid(int nlocal, char **values)
return 1;
}
/* ----------------------------------------------------------------------
pack atom info for data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecAngle::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];
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 AtomVecAngle::pack_data_hybrid(int i, double *buf)
{
buf[0] = molecule[i];
return 1;
}
/* ----------------------------------------------------------------------
write atom info to data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecAngle::write_data(FILE *fp, int n, double **buf)
{
for (int i = 0; i < n; i++)
fprintf(fp,"%d %d %d %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],
(int) buf[i][6],(int) buf[i][7],(int) buf[i][8]);
}
/* ----------------------------------------------------------------------
write hybrid atom info to data file
------------------------------------------------------------------------- */
int AtomVecAngle::write_data_hybrid(FILE *fp, double *buf)
{
fprintf(fp," %d",(int) buf[0]);
return 1;
}
/* ----------------------------------------------------------------------
return # of bytes of allocated memory
------------------------------------------------------------------------- */

View File

@ -51,6 +51,10 @@ class AtomVecAngle : 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

@ -756,6 +756,59 @@ int AtomVecBond::data_atom_hybrid(int nlocal, char **values)
return 1;
}
/* ----------------------------------------------------------------------
pack atom info for data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecBond::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];
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 AtomVecBond::pack_data_hybrid(int i, double *buf)
{
buf[0] = molecule[i];
return 1;
}
/* ----------------------------------------------------------------------
write atom info to data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecBond::write_data(FILE *fp, int n, double **buf)
{
for (int i = 0; i < n; i++)
fprintf(fp,"%d %d %d %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],
(int) buf[i][6],(int) buf[i][7],(int) buf[i][8]);
}
/* ----------------------------------------------------------------------
write hybrid atom info to data file
------------------------------------------------------------------------- */
int AtomVecBond::write_data_hybrid(FILE *fp, double *buf)
{
fprintf(fp," %d",(int) buf[0]);
return 1;
}
/* ----------------------------------------------------------------------
return # of bytes of allocated memory
------------------------------------------------------------------------- */

View File

@ -50,6 +50,10 @@ class AtomVecBond : 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

@ -968,6 +968,61 @@ int AtomVecFull::data_atom_hybrid(int nlocal, char **values)
return 2;
}
/* ----------------------------------------------------------------------
pack atom info for data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecFull::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];
buf[i][3] = q[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 AtomVecFull::pack_data_hybrid(int i, double *buf)
{
buf[0] = molecule[i];
buf[1] = q[i];
return 2;
}
/* ----------------------------------------------------------------------
write atom info to data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecFull::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 AtomVecFull::write_data_hybrid(FILE *fp, double *buf)
{
fprintf(fp," %d %g",(int) buf[0],buf[1]);
return 2;
}
/* ----------------------------------------------------------------------
return # of bytes of allocated memory
------------------------------------------------------------------------- */

View File

@ -51,6 +51,10 @@ class AtomVecFull : 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

@ -948,6 +948,59 @@ int AtomVecMolecular::data_atom_hybrid(int nlocal, char **values)
return 1;
}
/* ----------------------------------------------------------------------
pack atom info for data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecMolecular::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];
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 AtomVecMolecular::pack_data_hybrid(int i, double *buf)
{
buf[0] = molecule[i];
return 1;
}
/* ----------------------------------------------------------------------
write atom info to data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecMolecular::write_data(FILE *fp, int n, double **buf)
{
for (int i = 0; i < n; i++)
fprintf(fp,"%d %d %d %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],
(int) buf[i][6],(int) buf[i][7],(int) buf[i][8]);
}
/* ----------------------------------------------------------------------
write hybrid atom info to data file
------------------------------------------------------------------------- */
int AtomVecMolecular::write_data_hybrid(FILE *fp, double *buf)
{
fprintf(fp," %d",(int) buf[0]);
return 1;
}
/* ----------------------------------------------------------------------
return # of bytes of allocated memory
------------------------------------------------------------------------- */

View File

@ -50,6 +50,10 @@ class AtomVecMolecular : 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

@ -29,6 +29,7 @@ using namespace LAMMPS_NS;
BondFENE::BondFENE(LAMMPS *lmp) : Bond(lmp)
{
writedata = 1;
TWO_1_3 = pow(2.0,(1.0/3.0));
}
@ -229,6 +230,16 @@ void BondFENE::read_restart(FILE *fp)
for (int i = 1; i <= atom->nbondtypes; i++) setflag[i] = 1;
}
/* ----------------------------------------------------------------------
proc 0 writes to data file
------------------------------------------------------------------------- */
void BondFENE::write_data(FILE *fp)
{
for (int i = 1; i <= atom->nbondtypes; i++)
fprintf(fp,"%d %g %g %g %g\n",i,k[i],r0[i],epsilon[i],sigma[i]);
}
/* ---------------------------------------------------------------------- */
double BondFENE::single(int type, double rsq, int i, int j,

View File

@ -35,6 +35,7 @@ class BondFENE : public Bond {
double equilibrium_distance(int);
void write_restart(FILE *);
void read_restart(FILE *);
void write_data(FILE *);
double single(int, double, int, int, double &);
protected:

View File

@ -36,7 +36,10 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
DihedralHarmonic::DihedralHarmonic(LAMMPS *lmp) : Dihedral(lmp) {}
DihedralHarmonic::DihedralHarmonic(LAMMPS *lmp) : Dihedral(lmp)
{
writedata = 1;
}
/* ---------------------------------------------------------------------- */
@ -345,3 +348,14 @@ void DihedralHarmonic::read_restart(FILE *fp)
}
}
}
/* ----------------------------------------------------------------------
proc 0 writes to data file
------------------------------------------------------------------------- */
void DihedralHarmonic::write_data(FILE *fp)
{
for (int i = 1; i <= atom->ndihedraltypes; i++)
fprintf(fp,"%d %g %d %d\n",i,k[i],sign[i],multiplicity[i]);
}

View File

@ -33,6 +33,7 @@ class DihedralHarmonic : public Dihedral {
void coeff(int, char **);
void write_restart(FILE *);
void read_restart(FILE *);
void write_data(FILE *);
protected:
double *k,*cos_shift,*sin_shift;

View File

@ -34,7 +34,10 @@ using namespace MathConst;
/* ---------------------------------------------------------------------- */
ImproperHarmonic::ImproperHarmonic(LAMMPS *lmp) : Improper(lmp) {}
ImproperHarmonic::ImproperHarmonic(LAMMPS *lmp) : Improper(lmp)
{
writedata = 1;
}
/* ---------------------------------------------------------------------- */
@ -282,3 +285,13 @@ void ImproperHarmonic::read_restart(FILE *fp)
for (int i = 1; i <= atom->nimpropertypes; i++) setflag[i] = 1;
}
/* ----------------------------------------------------------------------
proc 0 writes to data file
------------------------------------------------------------------------- */
void ImproperHarmonic::write_data(FILE *fp)
{
for (int i = 1; i <= atom->nimpropertypes; i++)
fprintf(fp,"%d %g %g\n",i,k[i],chi[i]/MY_PI*180.0);
}

View File

@ -33,6 +33,7 @@ class ImproperHarmonic : public Improper {
void coeff(int, char **);
void write_restart(FILE *);
void read_restart(FILE *);
void write_data(FILE *);
protected:
double *k,*chi;

View File

@ -789,7 +789,6 @@ void AtomVecPeri::data_atom(double *coord, tagint imagetmp, char **values)
atom->nlocal++;
}
/* ----------------------------------------------------------------------
unpack hybrid quantities from one line in Atoms section of data file
initialize other atom quantities for this sub-style
@ -809,6 +808,62 @@ int AtomVecPeri::data_atom_hybrid(int nlocal, char **values)
return 2;
}
/* ----------------------------------------------------------------------
pack atom info for data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecPeri::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] = vfrac[i];
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 AtomVecPeri::pack_data_hybrid(int i, double *buf)
{
buf[0] = vfrac[i];
buf[1] = rmass[i];
return 2;
}
/* ----------------------------------------------------------------------
write atom info to data file including 3 image flags
------------------------------------------------------------------------- */
void AtomVecPeri::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 AtomVecPeri::write_data_hybrid(FILE *fp, double *buf)
{
fprintf(fp," %g %g",buf[0],buf[1]);
return 2;
}
/* ----------------------------------------------------------------------
return # of bytes of allocated memory
------------------------------------------------------------------------- */

View File

@ -52,6 +52,10 @@ class AtomVecPeri : 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: