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 @hothello 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 1.9855451 1.9855451 -1.5981413 4.3555156 4.679503 4.679503 4.679503 3.6518803 0.61270336 1.0276228 3.5497711 3862.4141 0.25890544
Corresponding fix AVE output:
Temp_trasl 2.3966076465001076023
Temp_rototrasl 1.9995185764328464728
Pressure_trasl 4.999155980778550834
Pressure_rototrasl 4.999155980778550834
Pressure_virial 3.9593455670215988995 # virial component of the pressure
ke_trasl 0.62284063344093165693
ke_rototrasl 1.0398104137569483818
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:
- Ricci et al. — referred to as the Matrix Method (MM)
- 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.5981406 -1.5981406 0.5178109 3.6518812 3.6518812 4.1696920 4.1696921 3862.4140770 0.2589054
It can be seen that the per-particle pair potential (-1.5981406) and virial component (3.6518812) of the pressure matches very well with the corresponding values obtained in LAMMPS thermo output. However, the total pressure (kinetic term + virial = 4.1696920) 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 makes the corresponding components of thermo output different, while all other aspect of the simulation (output) remains exactly 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.368883 1.9855451 -1.5981413 1.9516298 4.2645836 4.679503 4.679503 3.6518803 0.61270336 1.0276228 3.5497711 3862.4141 0.25890544
Temp_trasl 2.3966076465001076023
Temp_rototrasl 1.9995185764328464728
Pressure_trasl 4.999155980778550834
Pressure_rototrasl 4.999155980778550834
Pressure_virial 3.9593455670215988995 # virial component of the pressure
ke_trasl 0.62284063344093165693
ke_rototrasl 1.0398104137569483818
Here are the input script, log files and command used to run the simulation:
mpirun -np 4 lmp_gpu -in in.test.set.quat -var seed_vel 22222 -var P 5 -var T 2.0 -log log.npt.annealing -nocite -sf gpu -pk gpu 1 -var seed_quat 11111
log.npt.annealing (161 Bytes)
log.npt.P.5.T.2.00 (30.9 KB)
in.test.set.quat (4.8 KB)
[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).