computing the VACF using python


I am trying to compute the VACF for my simulation using python. To do this, I want to take a time series average. To that end, I wrote a test script and write a loop where for each iteration I attempt to calculate the VACF over 1000 time steps using the “compute vacf” command. Since I want this to be a 1000 dim vector I apply a “fix vector” command and then I try to retrieve this via an “lmp.extract_fix” command. However when I run this and try to extract the fix I get a segfault and do not understand why. Is there a simple reason for this that I am missing? Thanks!

This is my exact script:

from lammps import lammps
import os

lmp = lammps()


for j in range(0,9):
lmp.command(“compute vacf all vacf”)
lmp.command(“fix vacf all vector 1 c_vacf[4]”)


lmp.command(“run 1000 every 1000 ‘write_data’”)
lmp.command(“uncompute vacf”)
lmp.command(“unfix vacf”)

The segfault error message says:

compute vacf all vacf
fix vacf all vector 1 c_vacf[4]
[login1:58931] *** Process received signal ***
[login1:58931] Signal: Segmentation fault (11)
[login1:58931] Signal code: Address not mapped (1)
[login1:58931] Failing at address: (nil)

First, can you run exactly these commands in an input
script (no Python), by just using a loop construct (loop variable)
in place of the for j in range(): Python command.
And a LAMMPS print command for the print(z) on the approrpriate
fix vacf output.

You may get some LAMMPS error that will be helpful.

It it works in LAMMPS, then try the Python. If it doesn’t
work. please post the file so others can reproduce
the problem.