mir-group / pair_allegro

LAMMPS pair style for Allegro deep learning interatomic potentials with parallelization support
https://www.nature.com/articles/s41467-023-36329-y
MIT License
34 stars 8 forks source link

Calculating virial stress in lammps #42

Open Tawfiq1448 opened 4 months ago

Tawfiq1448 commented 4 months ago

Hi,

I am trying to calculate virial stress in lammps using pair_allegro. I have trained the model with stress. I am using the develop branch of Nequip and the main branch of Allegro. For pair_allegro, I am using the stress branch. I am encountering the following error:

ERROR: Pair style Allegro does not support per-atom virial

I have compiled lammps with pytorch version 1.11.0. Please, let me know if you have any suggestions. Thanks.

Linux-cpp-lisp commented 4 months ago

Hi @Tawfiq1448 ,

We do not support per-atom virials; likely your LAMMPS script is unnecessarily requesting them, somehow. (They are not necessary to run NPT simulations.)

Tawfiq1448 commented 4 months ago

Thanks for your reply. I am also trying to implement Green-Kubo formulation for my system. For that, I need per-atom stress. https://docs.lammps.org/compute_heat_flux.html It is good to know that currently, allegro does not support per-atom virials. Thanks.

Hongyu-yu commented 4 months ago

Thanks for your reply. I am also trying to implement Green-Kubo formulation for my system. For that, I need per-atom stress. https://docs.lammps.org/compute_heat_flux.html It is good to know that currently, allegro does not support per-atom virials. Thanks.

You may try this repo which supports per-atom virials with ParaStressForceOutput: https://github.com/koheishimamura/nequip_allegro_tc with details in http://arxiv.org/abs/2403.14130 and https://journals.aps.org/prb/abstract/10.1103/PhysRevB.109.144426. Hope it helps.

Tawfiq1448 commented 4 months ago

@Hongyu-yu Thanks for your response. Which branch of pair_allegro do I need to use for my lammps calculations? Can I retrain my model trained with StressForceOutput using ParaStressForceOutput?

Hongyu-yu commented 4 months ago

@Tawfiq1448 You can try with https://github.com/Hongyu-yu/pair_allegro or just add related lines in you pair_allegro.cpp with https://github.com/Hongyu-yu/pair_allegro/blob/1061c6ec414b8cf597ceb54387b86f1e8678a088/pair_allegro.cpp#L486-L503 You don't have to retrain. Just

Tawfiq1448 commented 4 months ago

Hi @Hongyu-yu , I have followed the steps you provided. I have installed nequip and allegro from https://github.com/koheishimamura/nequip_allegro_tc and compiled lammps with pair_allegro from https://github.com/Hongyu-yu/pair_allegro/blob/1061c6ec414b8cf597ceb54387b86f1e8678a088/pair_allegro.cpp#L486-L503

My simulation crashes with a segmentation fault error:

Primary job  terminated normally, but 1 process returned
a non-zero exit code. Per user-direction, the job has been aborted.
--------------------------------------------------------------------------
--------------------------------------------------------------------------
mpiexec noticed that process rank 6 with PID 34294 on node ccc0207 exited on signal 11 (Segmentation fault).
--------------------------------------------------------------------------
[ccc0207.campuscluster.illinois.edu:34284] 31 more processes have sent help message help-mpi-btl-openib.txt / no device params found
[ccc0207.campuscluster.illinois.edu:34284] Set MCA parameter "orte_base_help_aggregate" to 0 to see all help / error messages
[ccc0207.campuscluster.illinois.edu:34284] 15 more processes have sent help message help-mpi-btl-openib-cpc-base.txt / no cpcs for port

I have torch version 1.11.0+cu113 in my environment. The lammps branch I cloned is stable_2Aug2023. I also tried it with the latest develop branch of lammps. Please, let me know if you know any solution to this. Thanks.

Hongyu-yu commented 3 months ago

@Tawfiq1448 I haven't encountered this kind of error, maybe you can try this version of lammps “stable_29Sep2021_update2”.

baoanh13 commented 1 week ago

https://github.com/Hongyu-yu/pair_allegro

Hello, I also need per-atom stress so I am trying to follow above steps.

With the latest version of LAMMPS (git clone --depth=1 https://github.com/lammps/lammps), I can compile without problem but when adding "compute sv all stress/atom NULL" to the lammps input file, the similar segmentation fault appeared...

Therefore I tried: git clone -b stable_29Sep2021_update2 --depth 1 https://github.com/lammps/lammps.git but it seems there are some conflicts in pair_allegro.cpp that I took snapshoot below, which caused the fail in compiling LAMMPS with that version:

image

Do you have any solution for this problem?

Thank you in advance.