Dimension of ML_HEAT output

Queries about input and output files, running specific calculations, etc.


Moderators: Moderator, Global Moderator

Post Reply
Message
Author
akretschmer
Newbie
Newbie
Posts: 34
Joined: Wed Nov 13, 2019 8:14 am

Dimension of ML_HEAT output

#1 Post by akretschmer » Mon Oct 13, 2025 7:03 pm

Hi,

I have a question regarding the units of the ML_HEAT file containing the local heat flux.

I have written some python code to compute the thermal conductivity using the Green-Kubo formalism. When I load the ML_HEAT files using my code and convert the units from eV*A/fs, as specified in the documentation, to W*m I get a thermal conductivity 4 orders of magnitude too high. Moreover, when I simulate SPC/E water using LAMMPS, output the heat flux in the same units and then use the same code to compute the thermal conductivity of this water I get a correct result, the same as in literature.

I would get results around the correct value if I suppose that the units I convert from are eV*pm/fs, i.e. I use a conversion factor of 1.602e-16 instead of 1.602e-14 when I convert from eV*A/fs to W*m.

My question is if it is possible that the units in the documentation are incorrect, i.e. that they should be eV*pm/fs instead of eV*A/fs?


martin.schlipf
Global Moderator
Global Moderator
Posts: 651
Joined: Fri Nov 08, 2019 7:18 am

Re: Dimension of ML_HEAT output

#2 Post by martin.schlipf » Tue Oct 14, 2025 8:55 am

I will inquire whether users need to be careful with converting ML_HEAT to SI units. Looking just at the code it seems that eVA/fs is correct

Code: Select all

WRITE(IU,1) NSTEP,(QHEAT(IXYZ)*EUNIT*AUTOA/TUNIT,IXYZ=1, 3)

where EUNIT, AUTOA, and TUNIT convert atomic units to eV, A, and fs, respectively (check ml_ff_iohandle.F and ml_ff_constant.F).

[Edit: removed incorrect statement about LAMMPS interface]

Martin Schlipf
VASP developer


martin.schlipf
Global Moderator
Global Moderator
Posts: 651
Joined: Fri Nov 08, 2019 7:18 am

Re: Dimension of ML_HEAT output

#3 Post by martin.schlipf » Tue Oct 14, 2025 9:27 am

Perhaps you can share the Python code if you think that would help.

Another alternative is to compute the thermal conductivity with a the Müller-Plathe method.

Martin Schlipf
VASP developer


martin.schlipf
Global Moderator
Global Moderator
Posts: 651
Joined: Fri Nov 08, 2019 7:18 am

Re: Dimension of ML_HEAT output

#4 Post by martin.schlipf » Fri Oct 17, 2025 9:17 am

As a correction to the earlier post: The LAMMPS interface will actually not work to compute the thermal transport. Some quantities required are not communicated via the force-field interface so LAMMPS cannot compute the heat flux.

The Müller-Plathe method is therefore the best alternative. It usually also shows a better convergence behavior with the required sample data.

Martin Schlipf
VASP developer


akretschmer
Newbie
Newbie
Posts: 34
Joined: Wed Nov 13, 2019 8:14 am

Re: Dimension of ML_HEAT output

#5 Post by akretschmer » Fri Sep 11, 2026 9:57 am

Sorry for the delayed response, and thank you for pointing out the LAMMPS interface for VASP. Even though it won't work for this specific use case, I wasn't aware of it beforehand, so it's a great tip.

Regarding your correction about the LAMMPS interface, could you clarify exactly which quantities are not communicated to LAMMPS? I was initially confused by this because I assumed LAMMPS simply reads all the necessary information directly from the MLFF file, using the exact same data VASP uses.

Does this limitation stem from the known issues with stress calculations for many-body potentials when using compute stress/atom? If so, would switching to compute centroid/stress/atom in LAMMPS bypass the problem? I'm very curious to understand the underlying technical reason why the heat flux calculation works directly inside VASP, but fails when routed through the LAMMPS patch.

Finally, thank you for the suggestion to use the Müller-Plathe method, that is probably the way to go.


andreas.singraber
Global Moderator
Global Moderator
Posts: 382
Joined: Mon Apr 26, 2021 7:40 am

Re: Dimension of ML_HEAT output

#6 Post by andreas.singraber » Tue Sep 22, 2026 11:12 am

Hello!

Sorry for the late reply, although I did some research on this topic a while ago it took me some time to read up on this again...

You are correct that the ML_FF file is read and processed via LAMMPS exactly the same way it is used inside VASP when using the VASPml C++ library (ML_LIB = .TRUE.). Hence, the predicted energies and forces should be identical up to numeric rounding errors. To be precise: the major part of computing the predicted force contributions (descriptors, kernel, per-atom and per-neighbor terms) is handled inside the VASPml library and is therefore processed by the same source code. However, since LAMMPS has a much more sophisticated MD parallelization (spatial domain decomposition) the final summation of force contributions over neighboring cells and the computation of stress is handled inside LAMMPS, VASPml just computes the contributions and stores them in arrays provided by LAMMPS.

Now, if we want to calculate the heat flux via per-atom stress contributions we need this virial term:
\(\sum_i \mathsf{W}_i \cdot \mathbf{v}_i
\qquad\text{with}\qquad
\mathsf{W}_i = \sum_{j \ne i} \mathbf{r}_{ij} \otimes \frac{\partial E_j}{\partial \mathbf{r}_i},
\qquad
\mathbf{r}_{ij} = \mathbf{r}_j - \mathbf{r}_i
\)

Atom \(i\) collects, for every neighbor \(j\) whose environment contains \(i\), the vector to that neighbor times the force that the atomic energy of \(j\) exerts on \(i\). The whole term belongs to atom \(i\), because it needs to be multiplied with \(\mathbf{v}_i\) . Unfortunately, atoms \(i\) and \(j\) may not "live" on the same processor, hence they cannot fill their respective arrays without communication. Therefore, we would need to first compute the contributions for all local and ghost atoms and then let LAMMPS communicate/sum up the contributions of \(\mathsf{W}_i\) similarly to the forces (this time 9 components for each atom). This is certainly possible but at the time of writing the LAMMPS interface this was simply not implemented. Hence, the corresponding arrays which are needed by "compute stress/atom" and "compute centroid/stress/atom" are not filled and therefore the heat flux computation cannot work via this method for the VASP force fields inside LAMMPS. As far as I know the situation is similar for other manybody force fields. On the other hand, as you already mentioned, inside VASP the formula above is implemented and accessible via the ML_LHEAT tag.

I am sorry that this was not communicated properly so far... I will update the Wiki and put the implementation of per-atom stress within LAMMPS on our ToDo list. I think the infrastructure in LAMMPS and VASPml is available and we know in principle what needs to be done, so I personally would like to have this feature available. However, since the Müller-Plathe method is our recommended alternative it will not have top priority and hence I cannot give a timeline for this feature.

All the best,
Andreas Singraber


Post Reply