I performed an NpT ensemble simulation of uniaxial Gay-Berne (3, 5, 2, 1) ellipsoidal molecules in a 3D system using LAMMPS (version 29Aug2024). The system parameters are:
N = 1000
T = 2.0
P = 5.0
The ellipsoids are defined and initialized as follows:
set type 1 shape 3 1 1
pair_style gayberne 1 1 2 4
pair_coeff * * 1 1 0.2 1 1.0 0 0 0 4
To understand how pressure is being computed in the system, I included the following compute statements in the script. These were informed by comments from hothelo here.
compute temp_trasl all temp
compute temp_rototrasl all temp/asphere dof all
compute press_trasl all pressure temp_trasl
compute press_rototrasl all pressure temp_rototrasl
compute press_virial all pressure temp_trasl virial
compute press_ke_trasl all pressure temp_trasl ke
compute press_ke_rototrasl all pressure temp_rototrasl ke
compute ke_trasl all ke
The following commands were used to average and output the computed properties:
fix AVE all ave/time 10 50 500 c_temp_trasl c_temp_rototrasl c_press_trasl c_press_rototrasl press_virial press_ke_trasl press_ke_rototrasl mode scalar ave running
thermo_style custom step temp c_temp_rototrasl epair etotal press c_press_trasl c_press_rototrasl c_press_virial c_press_ke_trasl c_press_ke_rototrasl c_ke_trasl vol density
thermo_modify temp temp_rototrasl press press_trasl flush yes
fix 2 all npt/asphere temp ${T} ${T} ${Tdamp} iso ${P} ${P} ${Pdamp} mtk yes pchain 2 tchain 4
fix_modify 2 press press_trasl temp temp_rototrasl
A typical thermo output looks like:
Step Temp c_temp_rototrasl E_pair TotEng Press c_press_trasl c_press_rototrasl c_press_virial c_press_ke_trasl c_press_ke_rototrasl c_ke_trasl Volume Density
100000 2.0075482 2.0075482 -1.4597026 4.5599308 5.018496 5.018496 5.018496 3.9747296 0.62832055 1.0437664 3.6236645 3844.8151 0.26009053
Corresponding fix AVE output:
Temp_trasl 2.4148500600939311056
Temp_rototrasl 2.0107547671483891882
Pressure_trasl 4.9854189312010142032
Pressure_rototrasl 4.9854189312010142032
Pressure_virial 3.9437766225578632096 # virial component of the pressure
ke_trasl 0.62495933946304771389
ke_rototrasl 1.041642308643152548
Question 1: How come Temp_trasl is grater than Temp_rototrasl? In calculating Temp_rototrasl both the translational and rotational kinetic energy are used, where as in Temp_trasl only the translational kinetic energy is included and hence I think Temp_trasl should be smaller than Temp_rototrasl.
To check this is have used the press_ke_trasl and press_ke_rototrasl computes to calculate the kinetic energies (ke) (used the calulaing the temperature in press_trasl and press_rototrasl computes). However looking at the AVE outputs I am not sure if the kinetic energies (and hence the temperature) are calculated correctly or not.
Additional Consistency Check:
To verify the internal calculations, I implemented my own post-processing scripts based on the methods from:
1. Ricci et al. — referred to as the Matrix Method (MM)
2. Calderón-Alcaraz et al. — referred to as the No-Matrix Method (NM)
Using dump files from LAMMPS, I computed pair energy, virial, and pressure. Sample output from my code is:
#time_step, Upair_NM, Upair_MM, P_kin(=rho*T), P_vir_NM, P_MM_vir, P_NM, P_MM, Vol, Dens
100000 -1.4597023 -1.4597023 0.5201811 3.9747307 3.9747308 4.4949118 4.4949118 3844.8151469 0.2600905
It can be seen that the per-particle pair potential (-1.4597023) and virial component (3.9747308) of the pressure matches very well with the LAMMPS thermo output. However, the total pressure (kinetic term + virial = 4.4949118) does not match with any of the pressure calculated in LAMMPS thermo/AVE. I believe, this mis-match in P is due to the kenetic term (rho * T) used in calculating the total pressure.
Final question: How and what changes I need to make in the LAMMPS script to correctly sample the temperature and pressure?
NOTE: I have tried with the thermo_modify temp temp_rototrasl press press_trasl flush yes statement switched off too. However this only changes the corresponding components of thermo output different, while all other aspect of the simulation (output) remains same.
#Step Temp c_temp_rototrasl E_pair TotEng Press c_press_trasl c_press_rototrasl c_press_virial c_press_ke_trasl c_press_ke_rototrasl c_ke_trasl Volume Density
100000 2.4181946 2.0075482 -1.4597026 2.1639619 4.6030501 5.018496 5.018496 3.9747296 0.62832055 1.0437664 3.6236645 3844.8151 0.26009053
[1] Ricci, M., Roscioni, O. M., Querciagrossa, L. & Zannoni, C. MOLC. A reversible coarse grained approach using anisotropic beads for the modelling of organic functional materials. Phys. Chem. Chem. Phys. 21, 26195–26211 (2019).
[2] CalderĂłn-Alcaraz, A. et al. A Bidimensional Gay-Berne Calamitic Fluid: Structure and Phase Behavior in Bulk and Strongly Confined Systems. Front. Phys. 8, (2021).