8
$\begingroup$

I am writing a simple Lennard-Jones fluid simulation in LAMMPS.

So far, I have outputted the temperature, volume, density, total energy, enthalpy, pressure, and all of it seems to be believable every 500 steps. This leads me to believe that my simulation is doing the right physics.

thermo_style    custom step temp vol density etotal pe ke enthalpy press
thermo_modify   format float %14.6f #format in log file
thermo 500 

However, I wanted to evaluate the autocorrelation function for my simulation. Looking up the LAMMPS documentation I see the following command:

compute velacf all vacf

From my understanding, the deal with a vacf is that I need the entire simulation to be complete before I start computing it, since $$\psi(t_d) = \frac{1}{N_{part}}\sum_{i=1}^{N_{part}} \sum_{j=0}^{f-d} \mathbf{v}_i(t_j)\cdot\mathbf{v}_i(t_j+t_d)$$ where $N_{part}$ is the number of particles, and $t_f$ is the final time, and $t_i+t_j = t_{i+j}$ (equal time steps taken throughout simulation).

How do I make LAMMPS get me an output of VACF at each time, so I can use it for analysis and visualization?

$\endgroup$
6
$\begingroup$

You don't need to wait for the completed simulation to evaluate VACF. VACF is usually calculated by subdividing the entire trajectory into $N$ fragments, where $N=T/\tau$. $T$ is the total(current) length of the simulation and $\tau$ is the autocorrelation length which depends on the molecular features of the system under study. You can also choose an appropriate $\tau$ by comparing the convergence of the VACF via changing $\tau$.

The simplified relation is:

$$\text{VACF}=\frac{1}{N}\cdot\frac{\tau}{T}\sum_{i=1}^{N_{atom}}\sum_{n=1}^{T/\tau}\sum_{t=0}^{t=\tau}\langle \textbf{v}(t_0)\cdot \textbf{v}(t_0+t)\rangle$$

where $\tau$ is the autocorrelation length and $T$ denotes the total length of the trajectory.

That being said, there are a few utilities you can use to extract VACF for your simulation. MDAnaylsis is a swiss-army knife for molecular dynamics and can be easily used for extracting and analysing many features for MD, including VACF.

| cite | improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ @mykd, i am still unsure as to how to get outputs from the vacf command in LAMMPS though... $\endgroup$ – megamence Aug 5 at 16:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.