# Calculating Microcanonical Entropy in Molecular Dynamics

As a beginning, I am simulating Argon liquid at 94 K and characterising as it is done by the Rahman's first paper on Molecular Dynamics. After going through the first two chapters of Art of Molecular Dynamics by D. C. Rapaport, I got interested in calculating the entropy of the system at hand (using a technique outlined in that book). In his book, he has used the fact that H-function can be written as (apart from a constant factor) $$H = \int f(\textbf v,t) \log f(\textbf v,t) d\textbf v$$

where $f(\textbf v,t)$ is the velocity distribution of the system at time $t$. Now as the simulation progresses, one should see that this $H$ function should increase with time (negative of entropy) as the system gets closer to equilibration and becomes a constant after it attains equilibration.

The main catch here is that, with a system that is not at the required temperature one has to scale the velocities for some time to achieve it. So because of this, I am not able to characterise or see this effective shift in H when I calculate and plot it. As it is seen in the image, the H-function drops to a low value and then raises again to reach a constant value.

My question is :

• how can your system be microcanonical and at constant temperature?
– Bort
Dec 17, 2015 at 11:54
• @Bort : Well its not !! Why does it matter ? I am concerned with time average quantities and not instantaneous. The best I can look at is probably rolling averages ! Dec 17, 2015 at 12:00
• How did you calculate $f(\bf{v},t)$ in a MD simulation? Apr 11, 2020 at 17:59
• @Drew: You have the velocity of all the particles in the system at each instant of time in the simulation. You just have to bin all the velocities using a histogram of some bin-width at each timestep. Apr 12, 2020 at 13:14
• @user35952 You may find useful the discussion on Gibbs' vs Boltzmann's $H$ functions done by Jaynes in doi.org/10.1119/1.1971557 . In particular, it is shown that Boltzmann's $H$ function is based on a factorization of the many-body distribution function that is justified only in a dilute gas regime. Jul 15, 2021 at 4:37

This method requires that you first calculate the distribution function $$f(\mathbf{v},t)$$, which could be done by running a few simulations for a long time and binning the velocities. Once you have this distribution, you could use the Gibbs entropy expression

$$=-k_B$$

which is of course a time/ensemble average. During a simulation, at some instantaneous time, you should be able to evaluate $$f(\mathbf{v},t)$$ from your previously calculated distribution. This gives you an instantaneous

$$S=-k_Blog(f)$$

which can be averaged over time, and should converge to some value in an equilibrium simulation.

• But what would this imply? The entropy as a distribution over velocity? Apr 14, 2020 at 5:49
• @user35952 The entropy is an average of the log of the distribution over velocity (more generally, phase space). One can show that that expression for entropy is the same as $S=k_Blog\Omega$, and that it is also the same entropy in $dS=\delta Q/T$. Apr 14, 2020 at 13:50
• But, I don't think instantaneous entropy has any meaning in itself. I say this because, entropy is itself a quantifier of the statistical distribution, without the ensemble averaging it will not make any physical meaning. However, what you say can be achieved by carrying out 100's of simulation independently and averaging over them to obtain an ensemble average. Apr 15, 2020 at 18:28
• @user35952 Instantaneous entropy is similar to instantaneous temperature or pressure in a MD simulation. Both $T$ and $P$ are technically ensemble averages in the macroscopic sense, but using the equipartition theorems, we can derive "instantaneous" versions based purely on dynamical variables like velocities, positions, and forces at some instant in time. Apr 15, 2020 at 20:32