Skip to content

Commit

Permalink
Small tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
frostedoyster committed Sep 18, 2024
1 parent 669f0e3 commit 5d230d7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
12 changes: 6 additions & 6 deletions examples/heat-capacity/README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Running, analizing and visualizing a path integral MD simulation
================================================================
Heat capacity of water from path integral molecular dynamics
============================================================

This example shows how to run a path integral molecular dynamics
simulation using ``i-PI``, analyze the output and visualize the
trajectory in ``chemiscope``. It uses `LAMMPS <http://lammps.org>`_
as the driver to simulate the q-TIP4P/f water model.
This example shows how to calculate the constant-volume heat
capacity from a path integral molecular dynamics simulation
using ``i-PI``. `LAMMPS <http://lammps.org>`_ is used
as the driver for the evaluation of the q-TIP4P/f water model.
3 changes: 0 additions & 3 deletions examples/heat-capacity/data/input.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<simulation verbosity='medium' safe_stride='100'>
<output prefix='simulation'>
<properties stride='1' filename='out'> [ step, time{picosecond}, conserved{electronvolt}, temperature{kelvin}, kinetic_cv{electronvolt}, potential{electronvolt}, scaledcoords ] </properties>
<trajectory filename='pos' stride='20'> positions </trajectory>
<trajectory filename='kin' stride='20'> kinetic_cv </trajectory>
<trajectory filename='kod' stride='20'> kinetic_od </trajectory>
</output>
<total_steps> 200 </total_steps>
<prng>
Expand Down
17 changes: 10 additions & 7 deletions examples/heat-capacity/heat-capacity.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Path integral molecular dynamics
================================
Quantum heat capacity of water
==============================
:Authors: Michele Ceriotti `@ceriottm <https://github.com/ceriottm/>`_
Expand All @@ -21,8 +21,8 @@


# %%
# Quantum heat capacity of water
# ------------------------------
# A non-trivial estimator
# -----------------------
#
# As introduced in the ``path-integrals`` example, path-integral estimators
# for observables that depend on momenta are generally not trivial to compute.
Expand Down Expand Up @@ -89,6 +89,7 @@
ax.set_xlabel(r"$t$ / ps")
ax.set_ylabel(r"energy / eV")
ax.legend()
plt.show()

# %%
# We will now plot the values of the energy and heat capacity estimators
Expand All @@ -102,21 +103,23 @@
#
# First the energy:

eps_v = np.loadtxt("simulation.out")[:, 6]
eps_v_prime = np.loadtxt("simulation.out")[:, 7]
eps_v = np.loadtxt("simulation.out")[20:, 6]
eps_v_prime = np.loadtxt("simulation.out")[20:, 7]
# discarding the first 20 steps which are highly non-equilibrated

energy_estimator = eps_v # from the paper

fix, ax = plt.subplots(1, 1, figsize=(4, 3), constrained_layout=True)
ax.plot(
output_data["time"],
output_data["time"][20:],
energy_estimator,
"b",
label="Total energy$",
)
ax.set_xlabel(r"$t$ / ps")
ax.set_ylabel(r"$E / a.u.$")
ax.legend()
plt.show()

# %%
# And, finally, the heat capacity:
Expand Down
1 change: 0 additions & 1 deletion log.lammps

This file was deleted.

0 comments on commit 5d230d7

Please sign in to comment.