forked from lijiext/lammps
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@3598 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
parent
87ba3c6eff
commit
4900c3d0c0
|
@ -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;
|
||||
int j,tag;
|
||||
|
||||
int m = 0;
|
||||
for (int i = 0; i < n; i++) {
|
||||
tag = static_cast<int> (buf[m]) - 1;
|
||||
tag = static_cast<int> (mybuf[m]) - 1;
|
||||
j = 3*tag;
|
||||
coords[j++] = buf[m+1];
|
||||
coords[j++] = buf[m+2];
|
||||
coords[j] = buf[m+3];
|
||||
coords[j++] = mybuf[m+1];
|
||||
coords[j++] = mybuf[m+2];
|
||||
coords[j] = mybuf[m+3];
|
||||
m += size_one;
|
||||
}
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ void ComputeCOMMolecule::compute_array()
|
|||
double ComputeCOMMolecule::memory_usage()
|
||||
{
|
||||
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);
|
||||
return bytes;
|
||||
}
|
||||
|
|
|
@ -180,7 +180,7 @@ void ComputeGyrationMolecule::compute_vector()
|
|||
double ComputeGyrationMolecule::memory_usage()
|
||||
{
|
||||
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);
|
||||
return bytes;
|
||||
}
|
||||
|
|
|
@ -118,6 +118,7 @@ void ComputeMSD::compute_vector()
|
|||
|
||||
double cm[3];
|
||||
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
|
||||
// original unwrapped position is stored by fix
|
||||
|
@ -148,15 +149,9 @@ void ComputeMSD::compute_vector()
|
|||
xbox = (image[i] & 1023) - 512;
|
||||
ybox = (image[i] >> 10 & 1023) - 512;
|
||||
zbox = (image[i] >> 20) - 512;
|
||||
if (comflag) {
|
||||
dx = x[i][0] + xbox*xprd - cm[0] - xoriginal[i][0];
|
||||
dy = x[i][1] + ybox*yprd - cm[1] - xoriginal[i][1];
|
||||
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];
|
||||
}
|
||||
dx = x[i][0] + xbox*xprd - cm[0] - xoriginal[i][0];
|
||||
dy = x[i][1] + ybox*yprd - cm[1] - xoriginal[i][1];
|
||||
dz = x[i][2] + zbox*zprd - cm[2] - xoriginal[i][2];
|
||||
msd[0] += dx*dx;
|
||||
msd[1] += dy*dy;
|
||||
msd[2] += dz*dz;
|
||||
|
@ -169,16 +164,10 @@ void ComputeMSD::compute_vector()
|
|||
xbox = (image[i] & 1023) - 512;
|
||||
ybox = (image[i] >> 10 & 1023) - 512;
|
||||
zbox = (image[i] >> 20) - 512;
|
||||
if (comflag) {
|
||||
dx = x[i][0] + h[0]*xbox + h[5]*ybox + h[4]*zbox -
|
||||
cm[0] - xoriginal[i][0];
|
||||
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];
|
||||
} 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];
|
||||
}
|
||||
dx = x[i][0] + h[0]*xbox + h[5]*ybox + h[4]*zbox -
|
||||
cm[0] - xoriginal[i][0];
|
||||
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];
|
||||
msd[0] += dx*dx;
|
||||
msd[1] += dy*dy;
|
||||
msd[2] += dz*dz;
|
||||
|
|
|
@ -183,7 +183,7 @@ void ComputeMSDMolecule::compute_array()
|
|||
double ComputeMSDMolecule::memory_usage()
|
||||
{
|
||||
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 += nmolecules*4 * sizeof(double);
|
||||
return bytes;
|
||||
|
|
|
@ -249,7 +249,7 @@ void ComputePropertyAtom::compute_peratom()
|
|||
buf = vector;
|
||||
(this->*pack_choice[0])(0);
|
||||
} else {
|
||||
if (array) buf = array[0];
|
||||
if (array) buf = &array[0][0];
|
||||
for (int n = 0; n < nvalues; n++)
|
||||
(this->*pack_choice[n])(n);
|
||||
}
|
||||
|
|
|
@ -216,7 +216,7 @@ void ComputePropertyLocal::compute_local()
|
|||
buf = vector;
|
||||
(this->*pack_choice[0])(0);
|
||||
} else {
|
||||
if (array) buf = array[0];
|
||||
if (array) buf = &array[0][0];
|
||||
for (int n = 0; n < nvalues; n++)
|
||||
(this->*pack_choice[n])(n);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
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;
|
||||
for (int i = 0; i < n; i++) {
|
||||
fprintf(fp,format,
|
||||
static_cast<int> (buf[m]), static_cast<int> (buf[m+1]),
|
||||
buf[m+2],buf[m+3],buf[m+4], static_cast<int> (buf[m+5]),
|
||||
static_cast<int> (buf[m+6]), static_cast<int> (buf[m+7]));
|
||||
static_cast<int> (mybuf[m]), static_cast<int> (mybuf[m+1]),
|
||||
mybuf[m+2],mybuf[m+3],mybuf[m+4], static_cast<int> (mybuf[m+5]),
|
||||
static_cast<int> (mybuf[m+6]), static_cast<int> (mybuf[m+7]));
|
||||
m += size_one;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void DumpAtom::write_noimage(int n, double *buf)
|
||||
void DumpAtom::write_noimage(int n, double *mybuf)
|
||||
{
|
||||
int m = 0;
|
||||
for (int i = 0; i < n; i++) {
|
||||
fprintf(fp,format,
|
||||
static_cast<int> (buf[m]), static_cast<int> (buf[m+1]),
|
||||
buf[m+2],buf[m+3],buf[m+4]);
|
||||
static_cast<int> (mybuf[m]), static_cast<int> (mybuf[m+1]),
|
||||
mybuf[m+2],mybuf[m+3],mybuf[m+4]);
|
||||
m += size_one;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -229,7 +229,7 @@ void DumpCFG::write_header(int n)
|
|||
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 tag_i,index;
|
||||
|
@ -241,7 +241,7 @@ void DumpCFG::write_data(int n, double *buf)
|
|||
if (sort_flag == 0) {
|
||||
for (i = 0, m = 0; i < n; i++) {
|
||||
for (j = 0; j < size_one; j++)
|
||||
rbuf[nlines][j] = buf[m++];
|
||||
rbuf[nlines][j] = mybuf[m++];
|
||||
nlines++;
|
||||
}
|
||||
|
||||
|
@ -282,7 +282,7 @@ void DumpCFG::write_data(int n, double *buf)
|
|||
// to this index
|
||||
|
||||
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++) {
|
||||
if (tag_i == tags[j]) {
|
||||
index = j;
|
||||
|
@ -290,7 +290,7 @@ void DumpCFG::write_data(int n, double *buf)
|
|||
}
|
||||
}
|
||||
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
|
||||
|
|
|
@ -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;
|
||||
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 m = 0;
|
||||
for (i = 0; i < n; i++) {
|
||||
for (j = 0; j < size_one; j++) {
|
||||
if (vtype[j] == INT) fprintf(fp,vformat[j],static_cast<int> (buf[m]));
|
||||
else fprintf(fp,vformat[j],buf[m]);
|
||||
if (vtype[j] == INT) fprintf(fp,vformat[j],static_cast<int> (mybuf[m]));
|
||||
else fprintf(fp,vformat[j],mybuf[m]);
|
||||
m++;
|
||||
}
|
||||
fprintf(fp,"\n");
|
||||
|
|
|
@ -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
|
||||
|
||||
int tag;
|
||||
int m = 0;
|
||||
for (int i = 0; i < n; i++) {
|
||||
tag = static_cast<int> (buf[m]) - 1;
|
||||
xf[tag] = buf[m+1];
|
||||
yf[tag] = buf[m+2];
|
||||
zf[tag] = buf[m+3];
|
||||
tag = static_cast<int> (mybuf[m]) - 1;
|
||||
xf[tag] = mybuf[m+1];
|
||||
yf[tag] = mybuf[m+2];
|
||||
zf[tag] = mybuf[m+3];
|
||||
m += size_one;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 m = 0;
|
||||
for (i = 0; i < n; i++) {
|
||||
for (j = 0; j < size_one; j++) {
|
||||
if (vtype[j] == INT) fprintf(fp,vformat[j],static_cast<int> (buf[m]));
|
||||
else fprintf(fp,vformat[j],buf[m]);
|
||||
if (vtype[j] == INT) fprintf(fp,vformat[j],static_cast<int> (mybuf[m]));
|
||||
else fprintf(fp,vformat[j],mybuf[m]);
|
||||
m++;
|
||||
}
|
||||
fprintf(fp,"\n");
|
||||
|
|
|
@ -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
|
||||
// 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;
|
||||
for (int i = 0; i < n; i++) {
|
||||
tag = static_cast<int> (buf[m]) - 1;
|
||||
types[tag] = static_cast<int> (buf[m+1]);
|
||||
tag = static_cast<int> (mybuf[m]) - 1;
|
||||
types[tag] = static_cast<int> (mybuf[m+1]);
|
||||
j = 3*tag;
|
||||
coords[j++] = buf[m+2];
|
||||
coords[j++] = buf[m+3];
|
||||
coords[j] = buf[m+4];
|
||||
coords[j++] = mybuf[m+2];
|
||||
coords[j++] = mybuf[m+3];
|
||||
coords[j] = mybuf[m+4];
|
||||
m += size_one;
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,7 @@ void DumpXYZ::write_data(int n, double *buf)
|
|||
int m = 0;
|
||||
for (int i = 0; i < n; i++) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,6 +103,7 @@ CommandStyle(write_restart,WriteRestart)
|
|||
#include "compute_erotate_sphere.h"
|
||||
#include "compute_property_atom.h"
|
||||
#include "compute_property_local.h"
|
||||
#include "compute_property_molecule.h"
|
||||
#include "compute_stress_atom.h"
|
||||
#include "compute_temp.h"
|
||||
#include "compute_temp_com.h"
|
||||
|
@ -142,6 +143,7 @@ ComputeStyle(reduce/region,ComputeReduceRegion)
|
|||
ComputeStyle(erotate/sphere,ComputeERotateSphere)
|
||||
ComputeStyle(property/atom,ComputePropertyAtom)
|
||||
ComputeStyle(property/local,ComputePropertyLocal)
|
||||
ComputeStyle(property/molecule,ComputePropertyMolecule)
|
||||
ComputeStyle(stress/atom,ComputeStressAtom)
|
||||
ComputeStyle(temp,ComputeTemp)
|
||||
ComputeStyle(temp/com,ComputeTempCOM)
|
||||
|
|
Loading…
Reference in New Issue