From 180f47525d8a3e24256e304405f201bde0910064 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Thu, 30 Apr 2009 20:59:46 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@2795 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/compute_temp_partial.cpp | 4 ++-- src/compute_temp_profile.cpp | 32 ++++++++++---------------------- 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/src/compute_temp_partial.cpp b/src/compute_temp_partial.cpp index faae430bee..adecda74b0 100644 --- a/src/compute_temp_partial.cpp +++ b/src/compute_temp_partial.cpp @@ -43,6 +43,8 @@ ComputeTempPartial::ComputeTempPartial(LAMMPS *lmp, int narg, char **arg) : xflag = atoi(arg[3]); yflag = atoi(arg[4]); zflag = atoi(arg[5]); + if (zflag && domain->dimension == 2) + error->all("Compute temp/partial cannot use vz for 2d systemx"); maxbias = 0; vbiasall = NULL; @@ -73,7 +75,6 @@ void ComputeTempPartial::dof_compute() { double natoms = group->count(igroup); int nper = xflag+yflag+zflag; - if (domain->dimension == 2) nper = xflag+yflag; dof = nper * natoms; dof -= extra_dof + fix_dof; if (dof > 0) tfactor = force->mvv2e / (dof * force->boltz); @@ -85,7 +86,6 @@ void ComputeTempPartial::dof_compute() int ComputeTempPartial::dof_remove(int i) { int nper = xflag+yflag+zflag; - if (domain->dimension == 2) nper = xflag+yflag; return (domain->dimension - nper); } diff --git a/src/compute_temp_profile.cpp b/src/compute_temp_profile.cpp index d3eaf61305..b3b4c04f3b 100644 --- a/src/compute_temp_profile.cpp +++ b/src/compute_temp_profile.cpp @@ -47,51 +47,44 @@ ComputeTempProfile::ComputeTempProfile(LAMMPS *lmp, int narg, char **arg) : xflag = atoi(arg[3]); yflag = atoi(arg[4]); zflag = atoi(arg[5]); + if (zflag && domain->dimension == 2) + error->all("Compute temp/profile cannot use vz for 2d systemx"); + + ncount = 0; + ivx = ivy = ivz = 0; + if (xflag) ivx = ncount++; + if (yflag) ivy = ncount++; + if (zflag) ivz = ncount++; nbinx = nbiny = nbinz = 1; if (strcmp(arg[6],"x") == 0) { if (narg != 8) error->all("Illegal compute temp/profile command"); nbinx = atoi(arg[7]); - ivx = 0; - ncount = 1; } else if (strcmp(arg[6],"y") == 0) { if (narg != 8) error->all("Illegal compute temp/profile command"); nbiny = atoi(arg[7]); - ivy = 0; - ncount = 1; } else if (strcmp(arg[6],"z") == 0) { if (narg != 8) error->all("Illegal compute temp/profile command"); if (domain->dimension == 2) error->all("Compute temp/profile command cannot bin z for 2d systems"); nbinz = atoi(arg[7]); - ivz = 0; - ncount = 1; } else if (strcmp(arg[6],"xy") == 0) { if (narg != 9) error->all("Illegal compute temp/profile command"); nbinx = atoi(arg[7]); nbiny = atoi(arg[8]); - ivx = 0; - ivy = 1; - ncount = 2; } else if (strcmp(arg[6],"yz") == 0) { if (narg != 9) error->all("Illegal compute temp/profile command"); if (domain->dimension == 2) error->all("Compute temp/profile command cannot bin z for 2d systems"); nbiny = atoi(arg[7]); nbinz = atoi(arg[8]); - ivy = 0; - ivz = 1; - ncount = 2; } else if (strcmp(arg[6],"xz") == 0) { if (narg != 9) error->all("Illegal compute temp/profile command"); if (domain->dimension == 2) error->all("Compute temp/profile command cannot bin z for 2d systems"); nbinx = atoi(arg[7]); nbinz = atoi(arg[8]); - ivx = 0; - ivz = 1; - ncount = 2; } else if (strcmp(arg[6],"xyz") == 0) { if (narg != 10) error->all("Illegal compute temp/profile command"); if (domain->dimension == 2) @@ -99,10 +92,6 @@ ComputeTempProfile::ComputeTempProfile(LAMMPS *lmp, int narg, char **arg) : nbinx = atoi(arg[7]); nbiny = atoi(arg[8]); nbinz = atoi(arg[9]); - ivx = 0; - ivy = 1; - ivz = 2; - ncount = 3; } else error->all("Illegal compute temp/profile command"); nbins = nbinx*nbiny*nbinz; @@ -372,9 +361,8 @@ void ComputeTempProfile::bin_average() // clear bins, including particle count - int nc1 = ncount + 1; for (i = 0; i < nbins; i++) - for (j = 0; j < nc1; j++) + for (j = 0; j <= ncount; j++) vbin[i][j] = 0.0; // sum each particle's velocity to appropriate bin @@ -489,6 +477,6 @@ double ComputeTempProfile::memory_usage() { double bytes = maxbias * sizeof(double); bytes += maxatom * sizeof(int); - bytes += nbins*ncount * sizeof(double); + bytes += nbins*(ncount+1) * sizeof(double); return bytes; }