Hello,
I believe I found a bug I’d like to report, running LAMMPS with the latest stable release from July 30, 2016. When I run the following, I get no errors:
#settings
units real
atom_style bond
timestep 1.0
#atom and FF definitions
read_data “system.data”
pair_style lj/cut 14.0
pair_coeff 1 1 0.195 3.75
bond_style harmonic
bond_coeff 1 240 1.54
#compute
compute cc2 all chunk/atom molecule
compute moleculeAngMom all angmom/chunk cc2
fix 1 all ave/time 1 1 1 c_moleculeAngMom[1] file tmp.out mode vector
#run
velocity all create 300 49254
fix 2 all nve
run 100
If I replace the first fix with:
variable AngMomVar vector c_moleculeAngMom[1]
fix 1 all ave/time 1 1 1 v_AngMomVar file tmp.out mode vector
I then obtain the error:
ERROR: Variable formula compute array is zero length (…/variable.cpp:1407)
So even though all I’m doing is putting the compute moleculeAngMom into a variable before I try to output it, I get this error. If I use “compute vcm/chunk” instead of “compute angmom/chunk,” I get no error.
I believe this is because compute_angmom_chunk.cpp does not run “compute_array()” before the empty-array error-checking in variable.cpp. This is because compute_angmom_chunk.cpp does not contain a “setup” function like compute_vcm.chunk.cpp. When I add in the following to compute_angmom_chunk.cpp:
void ComputeAngmomChunk::setup()
{
compute_array();
}
And I put this function’s declaration into compute_angmom.chunk.h, then everything runs smoothly. There are probably more elegant ways to fix the problem than the one I used, but I’m not too familiar with the source code.
Similar things apply to other compute_*_chunk.cpp files, where * includes omega, inertia, gyration, torque, dipole, and perhaps others I missed.
system.data (2.86 KB)