Note
Go to the end to download the full example code.
Correlated Averages ReaderΒΆ
Read correlation functions from fix ave/correlate
and fix ave/correlate/long
commands.

/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/pylimer_tools/io/read_lammps_output_file.py:346: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead
correlated_data = correlated_data.apply(pd.to_numeric, errors="ignore")
import os
from pylimer_tools.io.read_lammps_output_file import read_correlation_file
correlation_file = os.path.join(
os.getcwd(),
"../..",
"tests/pylimer_tools/fixtures/example_correlation_file.out.corr.txt",
)
# Read correlation data
correlation_data = read_correlation_file(correlation_file)
# Access correlation data by timestep
last_timestep = correlation_data["Timestep"].max()
last_correlation = correlation_data[correlation_data["Timestep"]
== last_timestep]
_ = last_correlation.plot(
x="Time", y=[
"c_pA1*c_pA1", "c_pA2*c_pA2", "c_pA3*c_pA3"])
Total running time of the script: (0 minutes 0.061 seconds)