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

This commit is contained in:
sjplimp
2009-12-21 21:21:22 +00:00
parent 87ba3c6eff
commit 4900c3d0c0
14 changed files with 57 additions and 66 deletions

View File

@ -229,18 +229,18 @@ int DumpXTC::pack()
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void DumpXTC::write_data(int n, double *buf) void DumpXTC::write_data(int n, double *mybuf)
{ {
float *xyz; float *xyz;
int j,tag; int j,tag;
int m = 0; int m = 0;
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
tag = static_cast<int> (buf[m]) - 1; tag = static_cast<int> (mybuf[m]) - 1;
j = 3*tag; j = 3*tag;
coords[j++] = buf[m+1]; coords[j++] = mybuf[m+1];
coords[j++] = buf[m+2]; coords[j++] = mybuf[m+2];
coords[j] = buf[m+3]; coords[j] = mybuf[m+3];
m += size_one; m += size_one;
} }

View File

@ -150,7 +150,7 @@ void ComputeCOMMolecule::compute_array()
double ComputeCOMMolecule::memory_usage() double ComputeCOMMolecule::memory_usage()
{ {
double bytes = 2*nmolecules * sizeof(double); double bytes = 2*nmolecules * sizeof(double);
if (molmap) bytes += nmolecules * sizeof(int); if (molmap) bytes += (idhi-idlo+1) * sizeof(int);
bytes += 2*nmolecules*3 * sizeof(double); bytes += 2*nmolecules*3 * sizeof(double);
return bytes; return bytes;
} }

View File

@ -180,7 +180,7 @@ void ComputeGyrationMolecule::compute_vector()
double ComputeGyrationMolecule::memory_usage() double ComputeGyrationMolecule::memory_usage()
{ {
double bytes = 4*nmolecules * sizeof(double); double bytes = 4*nmolecules * sizeof(double);
if (molmap) bytes += nmolecules * sizeof(int); if (molmap) bytes += (idhi-idlo+1) * sizeof(int);
bytes += 2*nmolecules*3 * sizeof(double); bytes += 2*nmolecules*3 * sizeof(double);
return bytes; return bytes;
} }

View File

@ -118,6 +118,7 @@ void ComputeMSD::compute_vector()
double cm[3]; double cm[3];
if (comflag) group->xcm(igroup,masstotal,cm); if (comflag) group->xcm(igroup,masstotal,cm);
else cm[0] = cm[1] = cm[2] = 0.0;
// dx,dy,dz = displacement of atom from original position // dx,dy,dz = displacement of atom from original position
// original unwrapped position is stored by fix // original unwrapped position is stored by fix
@ -148,15 +149,9 @@ void ComputeMSD::compute_vector()
xbox = (image[i] & 1023) - 512; xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512; ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512; zbox = (image[i] >> 20) - 512;
if (comflag) {
dx = x[i][0] + xbox*xprd - cm[0] - xoriginal[i][0]; dx = x[i][0] + xbox*xprd - cm[0] - xoriginal[i][0];
dy = x[i][1] + ybox*yprd - cm[1] - xoriginal[i][1]; dy = x[i][1] + ybox*yprd - cm[1] - xoriginal[i][1];
dz = x[i][2] + zbox*zprd - cm[2] - xoriginal[i][2]; dz = x[i][2] + zbox*zprd - cm[2] - xoriginal[i][2];
} else {
dx = x[i][0] + xbox*xprd - xoriginal[i][0];
dy = x[i][1] + ybox*yprd - xoriginal[i][1];
dz = x[i][2] + zbox*zprd - xoriginal[i][2];
}
msd[0] += dx*dx; msd[0] += dx*dx;
msd[1] += dy*dy; msd[1] += dy*dy;
msd[2] += dz*dz; msd[2] += dz*dz;
@ -169,16 +164,10 @@ void ComputeMSD::compute_vector()
xbox = (image[i] & 1023) - 512; xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512; ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512; zbox = (image[i] >> 20) - 512;
if (comflag) {
dx = x[i][0] + h[0]*xbox + h[5]*ybox + h[4]*zbox - dx = x[i][0] + h[0]*xbox + h[5]*ybox + h[4]*zbox -
cm[0] - xoriginal[i][0]; cm[0] - xoriginal[i][0];
dy = x[i][1] + h[1]*ybox + h[3]*zbox - cm[1] - xoriginal[i][1]; dy = x[i][1] + h[1]*ybox + h[3]*zbox - cm[1] - xoriginal[i][1];
dz = x[i][2] + h[2]*zbox - cm[2] - xoriginal[i][2]; dz = x[i][2] + h[2]*zbox - cm[2] - xoriginal[i][2];
} else {
dx = x[i][0] + h[0]*xbox + h[5]*ybox + h[4]*zbox - xoriginal[i][0];
dy = x[i][1] + h[1]*ybox + h[3]*zbox - xoriginal[i][1];
dz = x[i][2] + h[2]*zbox - xoriginal[i][2];
}
msd[0] += dx*dx; msd[0] += dx*dx;
msd[1] += dy*dy; msd[1] += dy*dy;
msd[2] += dz*dz; msd[2] += dz*dz;

View File

@ -183,7 +183,7 @@ void ComputeMSDMolecule::compute_array()
double ComputeMSDMolecule::memory_usage() double ComputeMSDMolecule::memory_usage()
{ {
double bytes = 2*nmolecules * sizeof(double); double bytes = 2*nmolecules * sizeof(double);
if (molmap) bytes += nmolecules * sizeof(int); if (molmap) bytes += (idhi-idlo+1) * sizeof(int);
bytes += 2*nmolecules*3 * sizeof(double); bytes += 2*nmolecules*3 * sizeof(double);
bytes += nmolecules*4 * sizeof(double); bytes += nmolecules*4 * sizeof(double);
return bytes; return bytes;

View File

@ -249,7 +249,7 @@ void ComputePropertyAtom::compute_peratom()
buf = vector; buf = vector;
(this->*pack_choice[0])(0); (this->*pack_choice[0])(0);
} else { } else {
if (array) buf = array[0]; if (array) buf = &array[0][0];
for (int n = 0; n < nvalues; n++) for (int n = 0; n < nvalues; n++)
(this->*pack_choice[n])(n); (this->*pack_choice[n])(n);
} }

View File

@ -216,7 +216,7 @@ void ComputePropertyLocal::compute_local()
buf = vector; buf = vector;
(this->*pack_choice[0])(0); (this->*pack_choice[0])(0);
} else { } else {
if (array) buf = array[0]; if (array) buf = &array[0][0];
for (int n = 0; n < nvalues; n++) for (int n = 0; n < nvalues; n++)
(this->*pack_choice[n])(n); (this->*pack_choice[n])(n);
} }

View File

@ -153,9 +153,9 @@ int DumpAtom::pack()
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void DumpAtom::write_data(int n, double *buf) void DumpAtom::write_data(int n, double *mybuf)
{ {
(this->*write_choice)(n,buf); (this->*write_choice)(n,mybuf);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -397,36 +397,36 @@ int DumpAtom::pack_noscale_noimage()
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void DumpAtom::write_binary(int n, double *buf) void DumpAtom::write_binary(int n, double *mybuf)
{ {
n *= size_one; n *= size_one;
fwrite(&n,sizeof(int),1,fp); fwrite(&n,sizeof(int),1,fp);
fwrite(buf,sizeof(double),n,fp); fwrite(mybuf,sizeof(double),n,fp);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void DumpAtom::write_image(int n, double *buf) void DumpAtom::write_image(int n, double *mybuf)
{ {
int m = 0; int m = 0;
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
fprintf(fp,format, fprintf(fp,format,
static_cast<int> (buf[m]), static_cast<int> (buf[m+1]), static_cast<int> (mybuf[m]), static_cast<int> (mybuf[m+1]),
buf[m+2],buf[m+3],buf[m+4], static_cast<int> (buf[m+5]), mybuf[m+2],mybuf[m+3],mybuf[m+4], static_cast<int> (mybuf[m+5]),
static_cast<int> (buf[m+6]), static_cast<int> (buf[m+7])); static_cast<int> (mybuf[m+6]), static_cast<int> (mybuf[m+7]));
m += size_one; m += size_one;
} }
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void DumpAtom::write_noimage(int n, double *buf) void DumpAtom::write_noimage(int n, double *mybuf)
{ {
int m = 0; int m = 0;
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
fprintf(fp,format, fprintf(fp,format,
static_cast<int> (buf[m]), static_cast<int> (buf[m+1]), static_cast<int> (mybuf[m]), static_cast<int> (mybuf[m+1]),
buf[m+2],buf[m+3],buf[m+4]); mybuf[m+2],mybuf[m+3],mybuf[m+4]);
m += size_one; m += size_one;
} }
} }

View File

@ -229,7 +229,7 @@ void DumpCFG::write_header(int n)
write head of block (mass & element name) only if has atoms of the type write head of block (mass & element name) only if has atoms of the type
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void DumpCFG::write_data(int n, double *buf) void DumpCFG::write_data(int n, double *mybuf)
{ {
int i,j,m,itype; int i,j,m,itype;
int tag_i,index; int tag_i,index;
@ -241,7 +241,7 @@ void DumpCFG::write_data(int n, double *buf)
if (sort_flag == 0) { if (sort_flag == 0) {
for (i = 0, m = 0; i < n; i++) { for (i = 0, m = 0; i < n; i++) {
for (j = 0; j < size_one; j++) for (j = 0; j < size_one; j++)
rbuf[nlines][j] = buf[m++]; rbuf[nlines][j] = mybuf[m++];
nlines++; nlines++;
} }
@ -282,7 +282,7 @@ void DumpCFG::write_data(int n, double *buf)
// to this index // to this index
for (i = 0, m = 0; i < n; i++) { for (i = 0, m = 0; i < n; i++) {
tag_i = static_cast<int>(buf[m]); tag_i = static_cast<int>(mybuf[m]);
for (j = 0; j < nchosen; j++) { for (j = 0; j < nchosen; j++) {
if (tag_i == tags[j]) { if (tag_i == tags[j]) {
index = j; index = j;
@ -290,7 +290,7 @@ void DumpCFG::write_data(int n, double *buf)
} }
} }
for (j = 0; j < size_one; j++) for (j = 0; j < size_one; j++)
rbuf[index][j] = buf[m++]; rbuf[index][j] = mybuf[m++];
} }
// write data lines in rbuf to file after transfer is done // write data lines in rbuf to file after transfer is done

View File

@ -751,31 +751,31 @@ int DumpCustom::pack()
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void DumpCustom::write_data(int n, double *buf) void DumpCustom::write_data(int n, double *mybuf)
{ {
(this->*write_choice)(n,buf); (this->*write_choice)(n,mybuf);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void DumpCustom::write_binary(int n, double *buf) void DumpCustom::write_binary(int n, double *mybuf)
{ {
n *= size_one; n *= size_one;
fwrite(&n,sizeof(int),1,fp); fwrite(&n,sizeof(int),1,fp);
fwrite(buf,sizeof(double),n,fp); fwrite(mybuf,sizeof(double),n,fp);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void DumpCustom::write_text(int n, double *buf) void DumpCustom::write_text(int n, double *mybuf)
{ {
int i,j; int i,j;
int m = 0; int m = 0;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
for (j = 0; j < size_one; j++) { for (j = 0; j < size_one; j++) {
if (vtype[j] == INT) fprintf(fp,vformat[j],static_cast<int> (buf[m])); if (vtype[j] == INT) fprintf(fp,vformat[j],static_cast<int> (mybuf[m]));
else fprintf(fp,vformat[j],buf[m]); else fprintf(fp,vformat[j],mybuf[m]);
m++; m++;
} }
fprintf(fp,"\n"); fprintf(fp,"\n");

View File

@ -233,17 +233,17 @@ int DumpDCD::pack()
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void DumpDCD::write_data(int n, double *buf) void DumpDCD::write_data(int n, double *mybuf)
{ {
// spread buf atom coords into global arrays // spread buf atom coords into global arrays
int tag; int tag;
int m = 0; int m = 0;
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
tag = static_cast<int> (buf[m]) - 1; tag = static_cast<int> (mybuf[m]) - 1;
xf[tag] = buf[m+1]; xf[tag] = mybuf[m+1];
yf[tag] = buf[m+2]; yf[tag] = mybuf[m+2];
zf[tag] = buf[m+3]; zf[tag] = mybuf[m+3];
m += size_one; m += size_one;
} }

View File

@ -245,15 +245,15 @@ int DumpLocal::pack()
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void DumpLocal::write_data(int n, double *buf) void DumpLocal::write_data(int n, double *mybuf)
{ {
int i,j; int i,j;
int m = 0; int m = 0;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
for (j = 0; j < size_one; j++) { for (j = 0; j < size_one; j++) {
if (vtype[j] == INT) fprintf(fp,vformat[j],static_cast<int> (buf[m])); if (vtype[j] == INT) fprintf(fp,vformat[j],static_cast<int> (mybuf[m]));
else fprintf(fp,vformat[j],buf[m]); else fprintf(fp,vformat[j],mybuf[m]);
m++; m++;
} }
fprintf(fp,"\n"); fprintf(fp,"\n");

View File

@ -155,7 +155,7 @@ int DumpXYZ::pack()
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void DumpXYZ::write_data(int n, double *buf) void DumpXYZ::write_data(int n, double *mybuf)
{ {
// for group = all, spread buf atom coords into global arrays // for group = all, spread buf atom coords into global arrays
// if last chunk of atoms in this snapshot, write global arrays to file // if last chunk of atoms in this snapshot, write global arrays to file
@ -165,12 +165,12 @@ void DumpXYZ::write_data(int n, double *buf)
int m = 0; int m = 0;
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
tag = static_cast<int> (buf[m]) - 1; tag = static_cast<int> (mybuf[m]) - 1;
types[tag] = static_cast<int> (buf[m+1]); types[tag] = static_cast<int> (mybuf[m+1]);
j = 3*tag; j = 3*tag;
coords[j++] = buf[m+2]; coords[j++] = mybuf[m+2];
coords[j++] = buf[m+3]; coords[j++] = mybuf[m+3];
coords[j] = buf[m+4]; coords[j] = mybuf[m+4];
m += size_one; m += size_one;
} }
@ -186,7 +186,7 @@ void DumpXYZ::write_data(int n, double *buf)
int m = 0; int m = 0;
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
fprintf(fp,format, fprintf(fp,format,
static_cast<int> (buf[m+1]),buf[m+2],buf[m+3],buf[m+4]); static_cast<int> (mybuf[m+1]),mybuf[m+2],mybuf[m+3],mybuf[m+4]);
m += size_one; m += size_one;
} }
} }

View File

@ -103,6 +103,7 @@ CommandStyle(write_restart,WriteRestart)
#include "compute_erotate_sphere.h" #include "compute_erotate_sphere.h"
#include "compute_property_atom.h" #include "compute_property_atom.h"
#include "compute_property_local.h" #include "compute_property_local.h"
#include "compute_property_molecule.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"
@ -142,6 +143,7 @@ ComputeStyle(reduce/region,ComputeReduceRegion)
ComputeStyle(erotate/sphere,ComputeERotateSphere) ComputeStyle(erotate/sphere,ComputeERotateSphere)
ComputeStyle(property/atom,ComputePropertyAtom) ComputeStyle(property/atom,ComputePropertyAtom)
ComputeStyle(property/local,ComputePropertyLocal) ComputeStyle(property/local,ComputePropertyLocal)
ComputeStyle(property/molecule,ComputePropertyMolecule)
ComputeStyle(stress/atom,ComputeStressAtom) ComputeStyle(stress/atom,ComputeStressAtom)
ComputeStyle(temp,ComputeTemp) ComputeStyle(temp,ComputeTemp)
ComputeStyle(temp/com,ComputeTempCOM) ComputeStyle(temp/com,ComputeTempCOM)