From dfc6073e7ac5f0981ceb458cdfab926070d2c2a3 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Fri, 13 Feb 2015 18:30:07 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@13102 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/compute_com_chunk.cpp | 3 ++- src/compute_gyration_chunk.cpp | 4 +++- src/compute_inertia_chunk.cpp | 3 ++- src/compute_msd_chunk.cpp | 9 +++++---- src/compute_msd_chunk.h | 2 +- src/compute_property_chunk.cpp | 9 +++++---- src/compute_temp_chunk.cpp | 5 +++-- src/compute_torque_chunk.cpp | 3 ++- src/compute_vcm_chunk.cpp | 3 ++- 9 files changed, 25 insertions(+), 16 deletions(-) diff --git a/src/compute_com_chunk.cpp b/src/compute_com_chunk.cpp index b34310bc9c..92194557df 100644 --- a/src/compute_com_chunk.cpp +++ b/src/compute_com_chunk.cpp @@ -112,6 +112,7 @@ void ComputeCOMChunk::compute_array() int *ichunk = cchunk->ichunk; if (nchunk > maxchunk) allocate(); + size_array_rows = nchunk; // zero local per-chunk values @@ -222,7 +223,7 @@ void ComputeCOMChunk::allocate() memory->destroy(masstotal); memory->destroy(com); memory->destroy(comall); - size_array_rows = maxchunk = nchunk; + maxchunk = nchunk; memory->create(massproc,maxchunk,"com/chunk:massproc"); memory->create(masstotal,maxchunk,"com/chunk:masstotal"); memory->create(com,maxchunk,3,"com/chunk:com"); diff --git a/src/compute_gyration_chunk.cpp b/src/compute_gyration_chunk.cpp index 91bcdf97c7..a0148cd6db 100644 --- a/src/compute_gyration_chunk.cpp +++ b/src/compute_gyration_chunk.cpp @@ -216,6 +216,8 @@ void ComputeGyrationChunk::com_chunk() int *ichunk = cchunk->ichunk; if (nchunk > maxchunk) allocate(); + if (tensor) size_array_rows = nchunk; + else size_vector = nchunk; // zero local per-chunk values @@ -327,7 +329,7 @@ void ComputeGyrationChunk::allocate() memory->destroy(rgall); memory->destroy(rgt); memory->destroy(rgtall); - size_array_rows = maxchunk = nchunk; + maxchunk = nchunk; memory->create(massproc,maxchunk,"gyration/chunk:massproc"); memory->create(masstotal,maxchunk,"gyration/chunk:masstotal"); memory->create(com,maxchunk,3,"gyration/chunk:com"); diff --git a/src/compute_inertia_chunk.cpp b/src/compute_inertia_chunk.cpp index f04b291471..93229f4133 100644 --- a/src/compute_inertia_chunk.cpp +++ b/src/compute_inertia_chunk.cpp @@ -99,6 +99,7 @@ void ComputeInertiaChunk::compute_array() int *ichunk = cchunk->ichunk; if (nchunk > maxchunk) allocate(); + size_array_rows = nchunk; // zero local per-chunk values @@ -233,7 +234,7 @@ void ComputeInertiaChunk::allocate() memory->destroy(comall); memory->destroy(inertia); memory->destroy(inertiaall); - size_array_rows = maxchunk = nchunk; + maxchunk = nchunk; memory->create(massproc,maxchunk,"inertia/chunk:massproc"); memory->create(masstotal,maxchunk,"inertia/chunk:masstotal"); memory->create(com,maxchunk,3,"inertia/chunk:com"); diff --git a/src/compute_msd_chunk.cpp b/src/compute_msd_chunk.cpp index 180b420b33..5f060b1ffa 100644 --- a/src/compute_msd_chunk.cpp +++ b/src/compute_msd_chunk.cpp @@ -115,8 +115,10 @@ void ComputeMSDChunk::compute_array() // first time call, allocate per-chunk arrays // thereafter, require nchunk remain the same - if (firstflag) allocate(n); - else if (n != nchunk) + if (firstflag) { + nchunk = n; + allocate(); + } else if (n != nchunk) error->all(FLERR,"Compute msd/chunk nchunk is not static"); // zero local per-chunk values @@ -236,9 +238,8 @@ void ComputeMSDChunk::unlock(Fix *fixptr) one-time allocate of per-chunk arrays ------------------------------------------------------------------------- */ -void ComputeMSDChunk::allocate(int n) +void ComputeMSDChunk::allocate() { - size_array_rows = nchunk = n; memory->create(massproc,nchunk,"msd/chunk:massproc"); memory->create(masstotal,nchunk,"msd/chunk:masstotal"); memory->create(com,nchunk,3,"msd/chunk:com"); diff --git a/src/compute_msd_chunk.h b/src/compute_msd_chunk.h index 8562aa976e..269fb153ba 100644 --- a/src/compute_msd_chunk.h +++ b/src/compute_msd_chunk.h @@ -51,7 +51,7 @@ class ComputeMSDChunk : public Compute { int firstflag; - void allocate(int); + void allocate(); }; } diff --git a/src/compute_property_chunk.cpp b/src/compute_property_chunk.cpp index 28dffb9263..0fc67118f1 100644 --- a/src/compute_property_chunk.cpp +++ b/src/compute_property_chunk.cpp @@ -134,6 +134,8 @@ void ComputePropertyChunk::compute_vector() nchunk = cchunk->setup_chunks(); if (nchunk > maxchunk) allocate(); + if (nvalues == 1) size_vector = nchunk; + else size_array_rows = nchunk; if (countflag) { cchunk->compute_ichunk(); @@ -158,6 +160,8 @@ void ComputePropertyChunk::compute_array() nchunk = cchunk->setup_chunks(); if (nchunk > maxchunk) allocate(); + if (nvalues == 1) size_vector = nchunk; + else size_array_rows = nchunk; if (countflag) { cchunk->compute_ichunk(); @@ -237,12 +241,9 @@ void ComputePropertyChunk::allocate() memory->destroy(array); memory->destroy(count_one); memory->destroy(count_all); - - if (nvalues == 1) size_vector = maxchunk = nchunk; - else size_array_rows = maxchunk = nchunk; + maxchunk = nchunk; if (nvalues == 1) memory->create(vector,maxchunk,"property/chunk:vector"); else memory->create(array,maxchunk,nvalues,"property/chunk:array"); - if (countflag) { memory->create(count_one,maxchunk,"property/chunk:count_one"); memory->create(count_all,maxchunk,"property/chunk:count_all"); diff --git a/src/compute_temp_chunk.cpp b/src/compute_temp_chunk.cpp index 66b16ad2e4..7767582ea2 100644 --- a/src/compute_temp_chunk.cpp +++ b/src/compute_temp_chunk.cpp @@ -32,7 +32,7 @@ ComputeTempChunk::ComputeTempChunk(LAMMPS *lmp, int narg, char **arg) : if (narg < 4) error->all(FLERR,"Illegal compute temp/chunk command"); vector_flag = 1; - size_vector = 1; + size_vector = 0; size_vector_variable = 1; extvector = 0; @@ -163,6 +163,7 @@ void ComputeTempChunk::compute_vector() int *ichunk = cchunk->ichunk; if (nchunk > maxchunk) allocate(); + size_vector = nchunk; // calculate COM velocity for each chunk @@ -372,7 +373,7 @@ void ComputeTempChunk::allocate() memory->destroy(keall); memory->destroy(count); memory->destroy(countall); - size_vector = maxchunk = nchunk; + maxchunk = nchunk; memory->create(ke,maxchunk,"temp/chunk:ke"); memory->create(keall,maxchunk,"temp/chunk:keall"); memory->create(count,maxchunk,"temp/chunk:count"); diff --git a/src/compute_torque_chunk.cpp b/src/compute_torque_chunk.cpp index 8b29cc690a..0568e23649 100644 --- a/src/compute_torque_chunk.cpp +++ b/src/compute_torque_chunk.cpp @@ -99,6 +99,7 @@ void ComputeTorqueChunk::compute_array() int *ichunk = cchunk->ichunk; if (nchunk > maxchunk) allocate(); + size_array_rows = nchunk; // zero local per-chunk values @@ -229,7 +230,7 @@ void ComputeTorqueChunk::allocate() memory->destroy(comall); memory->destroy(torque); memory->destroy(torqueall); - size_array_rows = maxchunk = nchunk; + maxchunk = nchunk; memory->create(massproc,maxchunk,"torque/chunk:massproc"); memory->create(masstotal,maxchunk,"torque/chunk:masstotal"); memory->create(com,maxchunk,3,"torque/chunk:com"); diff --git a/src/compute_vcm_chunk.cpp b/src/compute_vcm_chunk.cpp index 68e08c7ab3..d7d7b83426 100644 --- a/src/compute_vcm_chunk.cpp +++ b/src/compute_vcm_chunk.cpp @@ -111,6 +111,7 @@ void ComputeVCMChunk::compute_array() int *ichunk = cchunk->ichunk; if (nchunk > maxchunk) allocate(); + size_array_rows = nchunk; // zero local per-chunk values @@ -217,7 +218,7 @@ void ComputeVCMChunk::allocate() memory->destroy(masstotal); memory->destroy(vcm); memory->destroy(vcmall); - size_array_rows = maxchunk = nchunk; + maxchunk = nchunk; memory->create(massproc,maxchunk,"vcm/chunk:massproc"); memory->create(masstotal,maxchunk,"vcm/chunk:masstotal"); memory->create(vcm,maxchunk,3,"vcm/chunk:vcm");