Segmentation fault when using fix ave/time

Dear all,

In my simulation, there are several molecules whose atoms belong to a group called ‘polymer’. I need to perform time-averaging of certain quantities of interest for each molecule. For this purpose, I have issued the following two compute/chunk commands in my input script:

compute c2 polymer chunk/atom molecule

compute c4 polymer com/chunk c2

If I subsequently issue the fix ave/time command as follows, everything works as expected.

fix f6 all ave/time 10 50000 500000 c_c4[1] mode vector file ave.dat

However, in my actual simulation, I need to time-average certain vector style variables evaluated using the output of the compute ‘c4’. However, the following sequence of commands gives a segmentation fault.

variable vt vector c_c4[1]

fix f6 all ave/time 10 50000 500000 v_vt mode vector file ave.dat

Inspection of the core file using gdb indicated that the error arose upon trying to execute line 850 of fix ave/time.cpp. The relevant code segment from this file is as follows:

// unlock any variable length computes at end of Nfreq epoch
// do not unlock if ave = RUNNING or WINDOW

if (any_variable_length && nrepeat > 1 && ave == ONE) {
for (i = 0; i < nvalues; i++) {
if (!varlen[i]) continue;
Compute *compute = modify->compute[value2index[i]];
compute->unlock(this);
}
}

The analogous operation for a scalar in the following line works fine.

fix f6 all ave/time 10 50000 500000 v_vt[1] file ave.dat

I am using the June 2019 version of LAMMPS. May I know where the problem lies?

Best,
Karthik

DISCLAIMER The sender of this email is an alumnus of National University of Singapore (NUS). Kindly note that NUS is not responsible for the contents of this email, and views and opinions expressed are solely the sender’s.

when i try to adapt your pieces of input to an existing input with molecules, i get the following error:
ERROR: Variable vt: Variable formula compute array is zero length (src/variable.cpp:1462)

this suggests that there is either crucial information missing in your post, or that you are using a version of LAMMPS where this error is not yet properly flagged.

the first recommendation would be to try again with the latest LAMMPS patch version, and if that still results in a segfault, please provide a small but complete input deck.

axel.

axel.

Dear Sir,

Thanks for the reply. Please find attached a minimal input script and data file using which I reproduced the error that you mentioned. I don’t understand why the compute array is zero length. In the attached example, there is one molecule. Therefore, compute com/chunk should produce a global array with nchunk = 1 row and 3 columns.

Best,
Karthik

test.dat (7.45 KB)

test4.in (768 Bytes)

this is a question for steve to look into. i don’t recall dealing with vector style variables and steve is the mastermind behind the variable processing code in LAMMPS.

axel.