Some questions to add HNEMD Method

Hi everyone,

I’m currently working on implementing the HNEMD method to calculate thermal conductivity, as it offers a faster alternative to the EMD method. However, I’ve run into some challenges due to my limited familiarity with LAMMPS interfaces.

Specifically, I need to compute the following expression:

W_{\text{prop}}[i] = \sum_{j \neq i}^N r_{ij} \otimes \frac{\partial U_j}{\partial r_{ji}}

I’m unsure if there is a built-in function in LAMMPS that can help with this calculation. If anyone has experience with this or can offer guidance on how to proceed, I would greatly appreciate it.

Thank you in advance for any assistance or suggestions!

What is available in LAMMPS is mentioned in the documentation, there even is a Howto document on thermal conductivity. 8.3.6. Calculate thermal conductivity — LAMMPS documentation
If what you want to do is not what is documented, you would need to implement it as custom c++ code. There is documentation for that as well.

Thank you very much for your helpful response and guidance. I am specifically interested in calculating the contribution of forces from other atoms on a particular atom. Is there any built-in methods in LAMMPS to achieve this? If not, I am prepared to explore writing custom C++ code to implement this functionality.

Thank you again for your support!

As I already wrote, anything that is available is documented. You know your research best, so you are in a much better position to decide which is suitable or not.

Anything that is based on pairwise contributions is going to be far too slow and too memory consuming to be done through scripting or similar. You may check in the TALLY package to see if there is something to your liking, but I have my doubts about that. That package is also limited in as far as support for pair styles goes.

Thank you for your suggestions.

While working on the code, I realized I need an interface like compute_force(i, j, force) to calculate the force contributions between atoms, considering the neighbor list. Unfortunately, I couldn’t find a similar function in the source code.

I appreciate your mention of the TALLY Package and plan to explore it further to see if it offers any suitable methods for my needs.

Thank you again for your assistance and guidance!

For pairwise additive pair styles you have Pair::single() which is used by styles like compute group/group, for others, there is not an easy way to project the forces on individual pairs.

Thank you very much!

Since I need to modify forces at each step, I’m concerned about the efficiency of my code, so it’s better to use a built-in function if possible. This seems to be exactly what I need. I’ll explore this further to see if I can use it effectively.

Try sitting a bit with the math before you get to coding – that looks suspiciously like a virial calculation, which LAMMPS already does efficiently in most cases.

See compute stress/atom command — LAMMPS documentation – this is not a new problem in MD.

Indeed! Thanks a lot.

After reading the paper, I realize they are the same, I misunderstand the formula and the words. Now I get it works. Thanks!