Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASE LAMMPSrun with lammps-nnp binary #197

Open
TomaSusi opened this issue Jan 18, 2024 · 7 comments
Open

ASE LAMMPSrun with lammps-nnp binary #197

TomaSusi opened this issue Jan 18, 2024 · 7 comments

Comments

@TomaSusi
Copy link

I'm trying to do parallel N2P2 calculations using the LAMMPS interface with the neural network potential for water.

I've successfully compiled the lammps-nnp interface and am able to run the example code in n2p2/examples/interface-LAMMPS/H2O_RPBE-D3 directly in LAMMPS via the command line without any issues.

However, when I try to run my own system using the ASE LAMMPSrun interface, I get the error:

ERROR: LAMMPS cutoff via pair_coeff keyword is smaller than maximum symmetry function cutoff.

Thus I think this seems to be an issue with the N2P2 calculator in ASE, which I've posted an issue about there, but I though it might benefit other N2P2 users if they saw this here, too – plus perhaps one of you has insight into the issue!

https://gitlab.com/ase/ase/-/issues/1419

@visika
Copy link

visika commented Feb 26, 2024

I ran into that error when tweaking the runnerCutoff variable. Values as low as 6.0 triggered the error. Higher values are okay. Try setting that to a higher value.

I will paste here the parameters I've been using for comparison.
Differently from you, I'm using lammpslib instead of lammpsrun, so you might need to adapt the definition of the variable in your dictionary.

cmd_nn = [
    "#!/bin/bash",
    'variable runnerDir       string "/path/to/train_008"',
    "variable runnerCutoff    equal  8.466835984",
    "pair_style hdnnp ${runnerCutoff} dir ${runnerDir} showew no showewsum 1 resetew yes maxew 200000 cflength 1.889726 cfenergy 0.036749",
    "pair_coeff * * H O",
]

@TomaSusi
Copy link
Author

TomaSusi commented Mar 4, 2024

Thanks for the tip! However, I didn't explicitly set runnerCutoff in my scripts, and don't think I can – it seems you are using the ML-HDNNP package instead of the standard N2P2 lammps-nnp interface?

@TomaSusi
Copy link
Author

TomaSusi commented Mar 4, 2024

Ahh... now I realize what I did wrong. I was reading the N2P2 interface instructions and trying to translate them into a LAMMPSrun dictionary, but what my syntax:

parameters = {'pair_style': 'nnp showew no showewsum 10 resetew no maxew 100 cflength 1.8897261328 cfenergy 0.0367493254 emap "1:H,2:O"',
              'pair_style': 'nnp dir ' + directory,
              'pair_coeff': ['* * 6.36'],
             }

ended up doing was overriding the first pair_style keyword with the second one, and thus losing the scale normalizations. I still couldn't figure out how to give both the dir and the parameters at the same time, but putting my NN files into the default nnp folder and omitting that line resolves the issue.

I did also have to hack the LAMMPSrun ASCII parsers since that was throwing errors that made this harder to troubleshoot.

@TomaSusi
Copy link
Author

TomaSusi commented Mar 7, 2024

Unfortunately my MD runs keep producing unphysically large forces/velocities and crashing LAMMPS, I don't think I saw similar issues with the ASE N2P2 calculator but it could be I was only able to reach longer runs in this system size with the LAMMPS calculator...

@TomaSusi TomaSusi closed this as completed Mar 7, 2024
@visika
Copy link

visika commented Mar 7, 2024

Unfortunately my MD runs keep producing unphysically large forces/velocities and crashing LAMMPS, I don't think I saw similar issues with the ASE N2P2 calculator but it could be I was only able to reach longer runs in this system size with the LAMMPS calculator...

@TomaSusi Which version of ASE are you using? In the release notes for the master branch (version 3.23.0b1) there is a fix that could interest you:

Fixed conversion of force units between LAMMPS and ASE (MR: !2720)

@TomaSusi TomaSusi reopened this Mar 7, 2024
@TomaSusi
Copy link
Author

TomaSusi commented Mar 7, 2024

Hmm... probably slightly older than that, but my crashes started happening after a long while of nice-looking dynamics, so I don't think it could be just a unit error. But I'll try to update to verify, and maybe also just need to look into lammpslib...

@TomaSusi
Copy link
Author

TomaSusi commented Mar 7, 2024

No help from updating ASE (and LAMMPS version). LAMMPSlib is probably my last hope, or the MD I am trying to run is simply difficult for the neural network (I'm kicking water molecules around to emulate electron impacts).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants