We derive the conserved energy-like quantity and ensemble measure for Martyna–Tobias–Klein (MTK) barostats in which only a restricted subset of the cell degrees of freedom are active. In the standard fully anisotropic MTK formulation, the number of barostat degrees of freedom is d2, where d is the spatial dimension. When only nc axes of the cell matrix are allowed to fluctuate, the conserved energy-like quantity retains the same functional form but with d2 replaced by nc in every term that counts barostat degrees of freedom. The derivation builds on the generalized Liouville framework for non-Hamiltonian systems and the existing MTK integration machinery. We verify that this quantity is exactly conserved, show that the resulting dynamics samples the isothermal–isobaric ensemble restricted to the submanifold of cell shapes in which inactive components are held fixed, and provide a complete Liouville-operator-based integration scheme for the masked MTK variant.
Introduction
The Martyna–Tobias–Klein (MTK) equations of motion [1] extend the Nosé–Hoover chain (NHC) thermostat [2, 3] to constant-pressure molecular dynamics by coupling the simulation cell to a barostat variable. When combined with a measure-preserving, time-reversible integrator derived from the Liouville-operator formalism [4], the MTK scheme provides a robust route to sampling the isothermal–isobaric (NPT) ensemble.
In many practical applications, one does not wish to allow the full cell tensor to fluctuate. For example, slab geometries call for pressure control only along the surface normal (NPzT ensemble), while uniaxial-stress simulations constrain the lateral dimensions. Codes such as LAMMPS [5] already support such restricted-axis ensembles, following the Shinoda formulation [6]. The original MTK paper [1] derives the conserved energy-like quantity for the isotropic and fully anisotropic (d2 degrees of freedom) cases, but does not treat the intermediate case in which a subset of cell axes is active. To the best of my knowledge, no compact published derivation exists for the corresponding reduced-degree-of-freedom conserved energy-like quantity and ensemble measure.
Two restrictions apply to the present formulation. First, we address only diagonal cell-length fluctuations; the extension to off-diagonal tilt factors is left for future work. Second, each active cell axis must be orthogonal to all other axes (Sec. III), which excludes certain non-orthogonal cell shapes from partial barostatting. This orthogonality condition is automatically satisfied for orthorhombic cells. For a hexagonal cell, the unique six-fold axis is orthogonal to the basal plane and may be barostatted alone, but simultaneous control of both in-plane basis vectors requires reformulation in an orthohexagonal supercell because they are not orthogonal. A fully triclinic cell cannot satisfy the condition at all.
This short note fills the derivation gap identified above: we recall the generalized Liouville framework for non-Hamiltonian systems (Sec. II), derive the equations of motion, the conserved energy-like quantity, and the expected ensemble for the masked MTK barostat (Sec. III), and provide the Liouville-operator-based integration scheme for the masked variant (Appendix D). For completeness, Appendices A–C summarize the standard integration schemes—the NHC thermostat, the isotropic MTK barostat, and the fully anisotropic MTK barostat—on which Appendix D builds. Sec. II and Appendices A–C review established material from Refs. [1, 2, 3, 4]; the novel contributions of this note are contained in Sec. III and Appendix D.
The implementation of the masked MTK barostat in ASE [7] is available at ase.md.nose_hoover_chain.MaskedMTKNPT.
Non-Hamiltonian Systems
The MTK equations of motion are non-Hamiltonian: the thermostat and barostat couplings break the symplectic structure. Their statistical-mechanical validity rests on the generalized Liouville framework for non-Hamiltonian systems [3, 4, 8, 9], which we now summarize.
We consider a dynamical system
x˙=ξ(x)(1)
for n-dimensional phase-space variables x. We write an initial condition x0 and the corresponding trajectory xt:=x(x0,t) at time t. The Liouville operator
iL:=ξ(x)⋅∇x,(2)
gives the formal solution xt=eiLtx0. Factorizing eiLΔt via symmetric Trotter splittings yields time-reversible, measure-preserving integrators [4].
The phase-space compressibility of the dynamical system is defined as
κ(x):=∇x⋅x˙=i=1∑n∂xi∂ξi(x).(3)
The phase-space volume elements dx0 and dxt are related by the phase-space compressibility as
dxt=exp(∫0tκ(xs)ds)dx0.(4)
The measure e−w(t)dxt is conserved along the trajectory, where w(t) is an indefinite time integral of κ(x) along the trajectory,
w(t):=∫tκ(xs)ds.(5)
Note that we drop the dependence of w(t) on the initial condition x0 when it is clear from context.
We suppose that the system has m independent conserved quantities Λk(x) (k=1,…,m). For the initial condition x0, we write the values as Ck=Λk(xt). The microcanonical partition function of this system with conserved quantities {Ck} is defined as
Ω({Ck})=∫dxe−w(t)k=1∏mδ(Λk(x)−Ck).(6)
Because the measure e−wdx is conserved along the trajectory, we can sample the microcanonical distribution by running a single trajectory and accumulating time averages with the assumption of ergodicity.
Masked MTK barostat
Throughout this section, d denotes the spatial dimension, N the number of particles, and Nf=dN the number of physical degrees of freedom (in the absence of constraints). We write ri, pi, mi, and Fi for the position, momentum, mass, and force on particle i, and h for the d×d cell matrix whose rows are the basis vectors.
We consider the case where only nc of the d cell axes are allowed to fluctuate, i.e. the barostat momentum pg is restricted to have at most nc nonzero diagonal entries while the cell matrix h itself may have arbitrary shape. Label the first nc axes as active and the remaining d−nc axes as inactive, and let ek be the unit vector along the k-th cartesian axis associated with the cell matrix h, not a fixed cartesian unit vector. We denote the length of the k-th axis as λk,
h=λ1e1T⋮λdedT.(7)
The masked barostat momentum is restricted to the subspace spanned by the active axes:
pg=c=1∑ncpcececT,(8)
where pc is the scalar momentum conjugate to axis c. We assume the active axes are orthogonal to all other axes,
ecTek=0,c=1,…,nc,k=c.(9)
This condition is automatically satisfied for orthorhombic cells. For non-orthogonal cells it restricts which axes may be active: in a hexagonal cell the unique six-fold axis is orthogonal to the basal plane and may be barostatted alone, but activating both in-plane hexagonal basis vectors would violate orthogonality because they are not orthogonal; one must instead adopt an orthohexagonal supercell. A fully triclinic cell, in which no pair of axes is in general orthogonal, falls outside the scope of this formulation entirely.
Equations of motion
To make the masked formulation explicit, we first write the physical Hamiltonian and instantaneous internal stress tensor:
H(r,p):=i=1∑N2mipi2+U(r),(10)
Pint=deth1i=1∑N[mipipiT+FiriT],(11)
where we assume the potential energy U depends only on the particle positions r and not on the cell h. The thermostat chain variables are (ηj,pηj) and the barostat chain variables are (ξj,pξj) for j=1,…,M. Their driving forces are
G1:=i=1∑Nmipi2−NfkT,(12)
Gj:=Qj−1pηj−12−kT(j=2,…,M),(13)
G1′:=c=1∑ncWgpc2−nckT,(14)
Gj′:=Qj−1′pξj−12−kT(j=2,…,M).(15)
The thermostat and barostat mass parameters are [1, 2, 3]
Q1=NfkTτ2,(16)
Qj=kTτ2(j=2,…,M),(17)
Q1′=nckTτ2,(18)
Qj′=kTτ2(j=2,…,M),(19)
Wg=dNf+dkTτ2,(20)
where τ is the characteristic thermostat/barostat time scale and Q1′ replaces d2 with nc to match the reduced barostat degrees of freedom. The barostat mass Wg retains its fully anisotropic form rather than being re-derived for the restricted case; this is a pragmatic choice that preserves compatibility with existing implementations. The masked MTK equations of motion are then
Here P is the target pressure, I is the d×d identity matrix, and only the nc active cell components fluctuate. The orthogonality condition Eq. (9) ensures that ecT(Pint−PI)ec extracts a single diagonal element of the stress tensor, giving a well-defined scalar pressure along axis c.
Although we write as if h is fully anisotropic in Eq. (14), the masked form of pg ensures that only the nc active cell lengths fluctuate,
λ˙c=Wgλcpc(c=1,…,nc).(31)
Conserved energy-like quantity
The conserved energy-like quantity for the masked MTK barostat is
where ηc:=∑j=2Mηj and ξc:=∑j=2Mξj. Comparing with the fully anisotropic conserved energy-like quantity [Eq. (C2)], the only structural differences are:
The barostat kinetic energy sums over the nc active components pc instead of the full d×d matrix pg.
The coupling to the first barostat chain variable is nckTξ1 instead of d2kTξ1.
We now verify that H˙′=0 by computing the time derivative and using the equations of motion.
(I) Physical Hamiltonian, barostat kinetic energy, and PV term. Using Fi=−∂U/∂ri and the stress tensor identity [Eq. (11)], the time derivative of the physical Hamiltonian is
Summing Eqs. (36)–(38), all terms cancel and H˙′=0.
Phase-space compressibility and metric factor
The extended phase space comprises the variables x=({ri,pi},{λc},{pc},{ηj,pηj},{ξj,pξj}). We compute the compressibility κ=∇x⋅x˙ by summing the diagonal contributions from each group of variables:
where Eq. (24b) uses Nf=dN. The NHC chains contribute
−j=2∑MQjpηj−j=2∑MQj′pξj.(43)
Collecting all terms and using pηj/Qj=η˙j, pξj/Qj′=ξ˙j:
κ=−dtd(Nfη1+ncξ1+ηc+ξc).(44)
Since κ=w˙, the metric factor is
e−w=exp(Nfη1+ncξ1+ηc+ξc).(45)
Geometrically, the masked barostat momentum pg [Eq. (8)] lives in the $n_c$-dimensional linear subspace spanned by $\{\boldsymbol{e}_c\boldsymbol{e}_c^{\mathsf{T}}\}$, so the first barostat-chain entropic term $(n_c\xi_1)$ and the metric factor [Eq. (27)] each count nc degrees of freedom rather than the d2 of the fully anisotropic case.
In passing from the first to the second line, the barostat momenta pc (c=1,…,nc), the thermostat momenta pηj, and the thermostat positions ηj (j≥2), ξj (j≥2) are integrated out as Gaussian integrals, producing the square-root prefactors. The η1 integral enforces the energy-shell constraint via δ(H′−E′), and because the conserved energy-like quantity H′ [Eq. (32)] contains the term nckTξ1, integrating ξ1 over the delta function yields the prefactor 1/(nckT)—directly analogous to the 1/(d2kT) factor in the fully anisotropic case. Only the nc active cell lengths λc appear as dynamical variables in H′; the inactive cell lengths λk (k=nc+1,…,d) satisfy λ˙k=0 and are absent from the conserved energy-like quantity, so they contribute no integration measure. These inactive axes are externally fixed parameters determined by the initial condition, not sampled variables; they enter det[h] only as constant multiplicative factors.
Because the prefactors are independent of the real dynamical variables r, p, and λc, the microcanonical partition function is proportional to the isothermal–isobaric partition function,
Thus, the masked MTK equations sample the isothermal–isobaric ensemble (N,P,T) restricted to the submanifold in which the d−nc inactive cell axes are held fixed.
Isothermal–isobaric ensemble without external forces
When there is no external field ∑i=1NFi=0, the total momentum P=∑i=1Npi obeys
is also conserved. Because K is a constant of motion, the trajectory is confined to a fixed-K submanifold of the extended phase space. To ensure that the dynamics still samples the correct isothermal–isobaric ensemble under this additional constraint, we must verify that the microcanonical partition function Ω(E′,K′) remains proportional to Δ(N,P,T). We write the values as K′=K(x).
When K′=0, the microcanonical partition function is
The first-to-second-line step performs the same Gaussian integrations as in the K′-unconstrained case: the barostat momenta pc, thermostat momenta pηj, pξj, and the ξ1 and η1 integrals produce the square-root prefactors and 1/(nckT), while the delta function δ(d)(K−K′) passes through unchanged because none of the integrated-out variables appear in K. In the third line, the remaining thermostat positions ηj (j≥2) and ξj (j≥2) are absorbed into the proportionality constant, leaving the integration over drdpdλncdη1 with the delta-function constraint on K′.
The η1 integral is then evaluated against δ(d)(K(x)−K′); since K depends on η1 only through the overall factor eη1, the substitution uα=Kα′e−η1 produces the Jacobian 1/∏α∣Kα′∣ and eliminates η1,
This prefactor is independent of the remaining integration variables, so it factors out and the surviving integral is Δ(N,P,T).
When K(x)=0, the total momentum P is always zero and the microcanonical partition function is
Ω(E′,K′)∝Ω(E′)∝Δ(N,P,T).(54)
Thus, in either case, the masked MTK equations sample the isothermal–isobaric ensemble (N,P,T) restricted to the submanifold in which the inactive cell axes are held fixed.
Summary
We have derived the conserved energy-like quantity for MTK barostats with a restricted subset of nc active cell degrees of freedom [Eq. (32)] and verified that it is exactly conserved (§ 0.3 B). Using the generalized Liouville framework, we computed the phase-space compressibility and metric factor for the restricted system [Eqs. (44)–(45)] and showed that the resulting dynamics samples the isothermal–isobaric ensemble restricted to the submanifold of cell shapes with inactive axes held fixed (§ 0.3 D). The key structural difference from the fully anisotropic case is that d2 is replaced by nc in every term that counts barostat degrees of freedom—the barostat NHC driving force, the NHC mass parameter, the conserved energy-like quantity, and the metric factor. This result provides a compact reference for verifying energy conservation and ensemble correctness in restricted-axis isobaric simulations. The orthogonality assumption on the active axes [Eq. (9)] limits the method to cell shapes where each active axis is perpendicular to all others; non-orthogonal active subspaces such as hexagonal in-plane pairs require an orthohexagonal redefinition, while fully triclinic cells are excluded altogether. We also provide a complete Liouville-operator-based integration scheme for the restricted MTK barostat (Appendix § 0.3.4), constructed from the same operator-splitting approach used for the isotropic and fully anisotropic cases summarized for completeness in Appendices B–C.
Acknowledgments
The author acknowledges the use of the AI-based writing tool ChatGPT (OpenAI, version 5.4) and Claude (Anthropic, version 4.6) for language polishing. The author takes full responsibility for the content of this manuscript.
Isothermal integrator with Nosé–Hoover chains
Equations of motion, conserved energy-like quantity, and conserved momentum-like quantity
Section III already includes the thermostat and barostat chains used in the masked MTK dynamics. This appendix isolates the standard Nosé–Hoover chain (NHC) thermostat, which is reused unchanged in both the masked and fully anisotropic formulations [2, 3].
together with the same thermostat chain equations as in Eq. (A2) and barostat chain equations of the same form as Eq. (15), with driving forces
G1′:=Wpϵ2−kT(79)
Gj′:=Qj−1′pξj−12−kT(j=2,…,M).(80)
Here Pint denotes the isotropic part of the internal stress tensor, Pint:=d1Tr[Pint]. The thermostat driving forces G1, Gj and thermostat masses Q1, Qj are the same as in Appendix A.
Reference [1] suggests W=(Nf+d)kTτ2 and Q1′=kTτ2; the remaining barostat chain masses Qj′ (j≥2) and time scale τ are as in Eq. (13).
The conserved energy-like quantity of the isotropic MTK equations is
The NHC-thermostat and NHC-barostat parts iLNHC-thermo and iLNHC-baro have the same structure as in Eq. (A7), acting on the thermostat chain (ηj,pηj) and barostat chain (ξj,pξj) variables, respectively. For iLNHC-baro, the particle momentum pi in the drag term is replaced by the scalar barostat momentum pϵ:
Isothermal–isobaric integrator with fully anisotropic MTK barostat
Equations of motion, conserved energy-like quantity, and conserved momentum-like quantity
Relative to the masked system, the particle and cell equations are unchanged; only the barostat momentum is promoted from the diagonal masked form [Eq. (8)] to a full matrix variable. The MTK equations for fully anisotropic cell fluctuations are [1, 4]
together with the same thermostat chain equations as in Eq. (A2) and the barostat chain equations obtained by replacing G1′ in Eq. (15) with the fully anisotropic driving force below. Here P is the target pressure and I is the d×d identity matrix.
The thermostat driving forces G1, Gj and thermostat masses Q1, Qj are the same as in § 0.3 A and Appendix A. The anisotropic barostat differs only in the first driving force, G1′:=Tr[pgTpg]/Wg−d2kT; the remaining forces Gj′ (j≥2) are as in Eq. (12). The cell mass Wg and remaining chain masses Qj′ (j≥2) are as in Eq. (13); the first barostat chain mass is Q1′=d2kTτ2, where d2 counts the independent components of pg.
The conserved energy-like quantity of the fully anisotropic MTK equations is [1, 4]
Since pg is a real symmetric matrix, it admits an eigendecomposition
pg=μ=1∑dρμuμuμT,U:=(u1,…,ud),(110)
with ρμ∈R and uμTuν=δμν. Introducing scaled coordinates xi:=UTri and yi:=UTpi, the actions of eiL1Δt and eiL22Δt decouple along each eigenvector direction [4]:
Isothermal–isobaric integrator with masked MTK barostat
For the masked case with nc active axes, the Liouville operator splitting Eq. (103) and the Trotter factorization Eq. (109) remain unchanged. The only modification is to iLg,2, which now sums only over active axes:
Since each barostat momentum pc is a scalar, the NHC-barostat operator iLNHC−baro acts on each active axis independently. Its explicit form is analogous to the isotropic case Eq. (91), with pϵ replaced by the sum over active momenta:
The masked pg [Eq. (8)] is already diagonal in the ec basis with entries ρc=pc on active axes and ρc=0 on inactive axes, so that U=I. The actions of eiL1Δt and eiL22Δt [Eqs. (C11a)–(C11b)] therefore apply directly without requiring a coordinate transformation.
References
References
[1]G. J. Martyna, D. J. Tobias, and M. L. Klein, Constant pressure molecular dynamics algorithms, J. Chem. Phys. 101, 4177 (1994).DOI
[2]G. J. Martyna, M. L. Klein, and M. J. Tuckerman, Nosé–Hoover chains: The canonical ensemble via continuous dynamics, J. Chem. Phys. 97, 2635 (1992).DOI
[3]M. E. Tuckerman, Statistical Mechanics: Theory and Molecular Simulation, 2nd ed. (Oxford University Press, 2010).
[4]M. E. Tuckerman, J. Alejandre, R. López-Rendón, A. L. Jochim, and G. J. Martyna, A Liouville-operator derived measure-preserving integrator for molecular dynamics simulations in the isothermal-isobaric ensemble, J. Phys. A: Math. Gen. 39, 5629 (2006).DOI
[5]A. P. Thompson, H. M. Aktulga, R. Berger, D. S. Bolintineanu, W. M. Brown, P. S. Crozier, P. J. in ’t Veld, A. Kohlmeyer, S. G. Moore, T. D. Nguyen, R. Shan, M. J. Stevens, J. Tranchida, C. Trott, and S. J. Plimpton, LAMMPS – a flexible simulation tool for particle-based materials modeling at the atomic, meso, and continuum scales, Comput. Phys. Commun. 271, 108171 (2022).DOI
[6]W. Shinoda, M. Shiga, and M. Mikami, Rapid estimation of elastic constants by molecular dynamics simulation under constant stress, Phys. Rev. B 69, 134103 (2004).DOI
[7]A. H. Larsen, J. J. Mortensen, J. Blomqvist, I. E. Castelli, R. Christensen, M. Dulak, J. Friis, M. N. Groves, B. Hammer, C. Hargus, E. D. Hermes, P. C. Jennings, P. B. Jensen, J. Kermode, J. R. Kitchin, E. L. Kolsbjerg, J. Kubal, K. Kaasbjerg, S. Lysgaard, J. B. Maronsson, T. Maxson, T. Olsen, L. Pastewka, A. Peterson, C. Rostgaard, J. Schiøtz, O. Schütt, M. Strange, K. S. Thygesen, T. Vegge, L. Vilhelmsen, M. Walter, Z. Zeng, and K. W. Jacobsen, The atomic simulation environment—a python library for working with atoms, J. Phys.: Condens. Matter 29, 273002 (2017).DOI
[8]M. E. Tuckerman, C. J. Mundy, and G. J. Martyna, On the classical statistical mechanics of non-hamiltonian systems, Europhys. Lett. 45, 149 (1999).DOI
[9]M. E. Tuckerman, Y. Liu, G. Ciccotti, and G. J. Martyna, Non-hamiltonian molecular dynamics: Generalizing hamiltonian phase space principles to non-hamiltonian systems, J. Chem. Phys. 115, 1678 (2001).DOI
[10]H. Yoshida, Construction of higher order symplectic integrators, Phys. Lett. A 150, 262 (1990).