-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
357 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--- | ||
layout: default | ||
title: ACE | ||
parent: MLIP calculators | ||
nav_order: 9 | ||
--- | ||
|
||
# ACE calculator | ||
|
||
[ACEpotentials](https://github.com/ACEsuit/ACEpotentials.jl) is an atomic cluster expansion (ACE)-based linear MLIP. | ||
|
||
Below are the instructions on how to initialize the ACEpotentials calculator, to run dynamics simulations within [NQCDynamics.jl](https://github.com/NQCD/NQCDynamics.jl) using [ASE interface](https://nqcd.github.io/NQCDynamics.jl/stable/NQCModels/ase/). | ||
|
||
{: .warning } | ||
The following instructions will include **Julia**-based code. | ||
|
||
We start with importing NQCDynamics.jl packages and PyCall which allows importing Python-based packages. | ||
|
||
```jl | ||
using NQCDynamics | ||
using PyCall | ||
using NQCModels | ||
|
||
# Importing Python modules with PyCall | ||
io = pyimport("ase.io") | ||
pyjulip = pyimport("pyjulip") | ||
``` | ||
|
||
|
||
Now, we specify the cutoff distance, paths to the model, and Atoms objects. Then we read the ASE atoms object and we convert it to NQCDynamics object. | ||
|
||
```jl | ||
pes_model_path = "path/to/ace/model/h2cu_ace.json" | ||
atoms_path = "path/to/atoms.xyz" | ||
ase_atoms = io.read(atoms_path) | ||
atoms, positions, cell = NQCDynamics.convert_from_ase_atoms(ase_atoms) | ||
``` | ||
|
||
|
||
We then set up our ACEpotentials calculator and create NQCModels [AdiabaticASEModel](https://nqcd.github.io/NQCDynamics.jl/stable/api/NQCModels/adiabaticmodels/#NQCModels.AdiabaticModels.AdiabaticASEModel) object that includes the model. | ||
|
||
```jl | ||
calculator = pyjulip.ACE1(pes_model_path) | ||
ase_atoms.set_calculator(calculator) | ||
pes_model = AdiabaticASEModel(ase_atoms) | ||
``` | ||
|
||
The model can be loaded also directly within julia: | ||
|
||
```jl | ||
using ASE | ||
using JuLIP | ||
using ACE1 | ||
|
||
IP = ACE1.read_dict(load_dict(model_path)["IP"]) | ||
JuLIP.set_calculator!(ase_atoms, IP) | ||
pes_model = AdiabaticModels.JuLIPModel(ase_atoms) | ||
``` | ||
|
||
Finally, we can use the model to e.g. initialize [Simulation](https://nqcd.github.io/NQCDynamics.jl/stable/api/NQCDynamics/nonadiabaticmoleculardynamics/#NQCDynamics.Simulation-Union%7BTuple%7BT%7D,%20Tuple%7BM%7D,%20Tuple%7BAtoms%7BT%7D,%20NQCModels.Model,%20M%7D%7D%20where%20%7BM,%20T%7D) object that is employed to run MD simulations. | ||
|
||
```jl | ||
sim = Simulation{Classical}(atoms, pes_model, cell=cell) | ||
``` | ||
|
||
|
||
## References | ||
|
||
[K. Schütt, O. Unke, M. Gastegger, Equivariant message passing for the prediction of tensorial properties and molecular spectra, PMLR 2021](https://proceedings.mlr.press/v139/schutt21a.html) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
layout: default | ||
title: MACE | ||
parent: MLIP calculators | ||
nav_order: 8 | ||
--- | ||
|
||
# MACE calculator | ||
|
||
[MACE](https://github.com/ACEsuit/mace) is an equivariant message-passing neural-network-based MLIP. | ||
|
||
Below are the instructions on how to initialize the MACE calculator, to run dynamics simulations within [NQCDynamics.jl](https://github.com/NQCD/NQCDynamics.jl) using [ASE interface](https://nqcd.github.io/NQCDynamics.jl/stable/NQCModels/ase/). | ||
|
||
{: .warning } | ||
The following instructions will include **Julia**-based code. | ||
|
||
We start with importing NQCDynamics.jl packages and PyCall which allows importing Python-based packages. | ||
|
||
```jl | ||
using NQCDynamics | ||
using PyCall | ||
using NQCModels | ||
|
||
# Importing Python modules with PyCall | ||
io = pyimport("ase.io") | ||
mace_calc = pyimport("mace.calculators") | ||
``` | ||
|
||
|
||
Now, we specify the cutoff distance, paths to the model, and Atoms objects. Then we read the ASE atoms object and we convert it to NQCDynamics object. | ||
|
||
```jl | ||
pes_model_path = "path/to/ace/model/MACE_model_swa.model" | ||
atoms_path = "path/to/atoms.xyz" | ||
ase_atoms = io.read(atoms_path) | ||
atoms, positions, cell = NQCDynamics.convert_from_ase_atoms(ase_atoms) | ||
``` | ||
|
||
|
||
We then set up our MACE calculator and create NQCModels [AdiabaticASEModel](https://nqcd.github.io/NQCDynamics.jl/stable/api/NQCModels/adiabaticmodels/#NQCModels.AdiabaticModels.AdiabaticASEModel) object that includes the model. | ||
|
||
```jl | ||
calculator = mace_calc.MACECalculator( | ||
model_path=pes_model_path, | ||
device="cpu", | ||
default_dtype="float32") # device = "cpu" or "cuda" | ||
ase_atoms.set_calculator(calculator) | ||
pes_model = AdiabaticASEModel(ase_atoms) | ||
``` | ||
|
||
Finally, we can use the model to e.g. initialize [Simulation](https://nqcd.github.io/NQCDynamics.jl/stable/api/NQCDynamics/nonadiabaticmoleculardynamics/#NQCDynamics.Simulation-Union%7BTuple%7BT%7D,%20Tuple%7BM%7D,%20Tuple%7BAtoms%7BT%7D,%20NQCModels.Model,%20M%7D%7D%20where%20%7BM,%20T%7D) object that is employed to run MD simulations. | ||
|
||
```jl | ||
sim = Simulation{Classical}(atoms, pes_model, cell=cell) | ||
``` | ||
|
||
|
||
## References | ||
|
||
[K. Schütt, O. Unke, M. Gastegger, Equivariant message passing for the prediction of tensorial properties and molecular spectra, PMLR 2021](https://proceedings.mlr.press/v139/schutt21a.html) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
--- | ||
layout: default | ||
title: REANN | ||
parent: MLIP calculators | ||
nav_order: 7 | ||
--- | ||
|
||
# REANN calculator | ||
|
||
[REANN](https://github.com/zhangylch/REANN) (recursively embedded atom neural network) is a message-passing neural-network-based MLIP. | ||
|
||
Below are the instructions on how to initialize the REANN calculator, to run dynamics simulations within [NQCDynamics.jl](https://github.com/NQCD/NQCDynamics.jl) using [ASE interface](https://nqcd.github.io/NQCDynamics.jl/stable/NQCModels/ase/). | ||
|
||
{: .warning } | ||
The following instructions will include **Julia**-based code. | ||
|
||
We start with importing NQCDynamics.jl packages and PyCall which allows importing Python-based packages. | ||
|
||
```jl | ||
using NQCDynamics | ||
using PyCall | ||
using NQCModels | ||
|
||
# Importing Python modules with PyCall | ||
io = pyimport("ase.io") | ||
reann = pyimport("ase.calculators.reann") | ||
``` | ||
|
||
|
||
Now, we specify the cutoff distance, paths to the model, and Atoms objects. Then we read the ASE atoms object and we convert it to NQCDynamics object. | ||
|
||
```jl | ||
pes_model_path = "path/to/reann/model/REANN_PES_DOUBLE.pt" | ||
atoms_path = "path/to/atoms.xyz" | ||
ase_atoms = io.read(atoms_path) | ||
atoms, positions, cell = NQCDynamics.convert_from_ase_atoms(ase_atoms) | ||
``` | ||
|
||
|
||
We then set up our REANN calculator and create NQCModels [AdiabaticASEModel](https://nqcd.github.io/NQCDynamics.jl/stable/api/NQCModels/adiabaticmodels/#NQCModels.AdiabaticModels.AdiabaticASEModel) object that includes the model. | ||
|
||
```jl | ||
atomtype = ["Cu","H"] | ||
period = [1,1,1] | ||
|
||
calculator = reann.REANN( | ||
device="cpu", | ||
atomtype=atomtype, | ||
period=period, | ||
nn=pes_model_path) | ||
ase_atoms.set_calculator(calculator) | ||
pes_model = AdiabaticASEModel(ase_atoms) | ||
``` | ||
|
||
Finally, we can use the model to e.g. initialize [Simulation](https://nqcd.github.io/NQCDynamics.jl/stable/api/NQCDynamics/nonadiabaticmoleculardynamics/#NQCDynamics.Simulation-Union%7BTuple%7BT%7D,%20Tuple%7BM%7D,%20Tuple%7BAtoms%7BT%7D,%20NQCModels.Model,%20M%7D%7D%20where%20%7BM,%20T%7D) object that is employed to run MD simulations. | ||
|
||
```jl | ||
sim = Simulation{Classical}(atoms, pes_model, cell=cell) | ||
``` | ||
|
||
|
||
## References | ||
|
||
[K. Schütt, O. Unke, M. Gastegger, Equivariant message passing for the prediction of tensorial properties and molecular spectra, PMLR 2021](https://proceedings.mlr.press/v139/schutt21a.html) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using NQCDynamics | ||
using PyCall | ||
using NQCModels | ||
using ASE | ||
using JuLIP | ||
using ACE1 | ||
|
||
# Importing Python modules with PyCall | ||
io = pyimport("ase.io") | ||
pyjulip = pyimport("pyjulip") | ||
|
||
""" | ||
Function for creating ASE object from ACE model | ||
""" | ||
function ace_model_pes(model_path, cur_atoms) # cur_atoms has to be JuLIP atoms object | ||
IP = ACE1.read_dict(load_dict(model_path)["IP"]) | ||
JuLIP.set_calculator!(cur_atoms, IP) | ||
model = AdiabaticModels.JuLIPModel(cur_atoms) | ||
|
||
return model | ||
end | ||
|
||
|
||
################################################ | ||
################### USE MODEL ################## | ||
################################################ | ||
pes_model_path = "../../../models/ace/h2cu_ace.json" | ||
atoms_path = "../../../dbs/example_structures/cu111_h7.0_full_925K.in" | ||
ase_atoms = io.read(atoms_path) | ||
ase_jl = ASE.ASEAtoms(ase_atoms) | ||
atoms_julip = JuLIP.Atoms(ase_jl) | ||
atoms, positions, cell = NQCDynamics.convert_from_ase_atoms(ase_atoms) | ||
|
||
println("Load ML models and initialize the simulation...") | ||
pes_model = ace_model_pes(pes_model_path, atoms_julip) | ||
sim = Simulation{Classical}(atoms, pes_model, cell=cell) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using NQCDynamics | ||
using PyCall | ||
using NQCModels | ||
|
||
# Importing Python modules with PyCall | ||
io = pyimport("ase.io") | ||
pyjulip = pyimport("pyjulip") | ||
|
||
""" | ||
Function for creating ASE object from ACE model | ||
""" | ||
function ace_model_pes(model_path, cur_atoms) # cur_atoms has to be JuLIP atoms object | ||
calculator = pyjulip.ACE1(model_path) | ||
cur_atoms.set_calculator(calculator) | ||
model = AdiabaticASEModel(cur_atoms) | ||
|
||
return model | ||
end | ||
|
||
|
||
################################################ | ||
################### USE MODEL ################## | ||
################################################ | ||
pes_model_path = "../../../models/ace/h2cu_ace.json" | ||
atoms_path = "../../../dbs/example_structures/cu111_h7.0_full_925K.in" | ||
ase_atoms = io.read(atoms_path) | ||
atoms, positions, cell = NQCDynamics.convert_from_ase_atoms(ase_atoms) | ||
|
||
println("Load ML models and initialize the simulation...") | ||
pes_model = ace_model_pes(pes_model_path, ase_atoms) | ||
sim = Simulation{Classical}(atoms, pes_model, cell=cell) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using NQCDynamics | ||
using PyCall | ||
using NQCModels | ||
|
||
# Importing Python modules with PyCall | ||
io = pyimport("ase.io") | ||
mace_calc = pyimport("mace.calculators") | ||
|
||
""" | ||
Function for creating ASE object from MACE model | ||
""" | ||
function mace_model_pes(model_path, cur_atoms) | ||
calculator = mace_calc.MACECalculator( | ||
model_path=model_path, | ||
device="cpu", | ||
default_dtype="float32") # device = "cpu" or "cuda" | ||
cur_atoms.set_calculator(calculator) | ||
model = AdiabaticASEModel(cur_atoms) | ||
|
||
return model | ||
end | ||
|
||
|
||
################################################ | ||
################### USE MODEL ################## | ||
################################################ | ||
pes_model_path = "../../../models/mace/MACE_model_swa.model" | ||
atoms_path = "../../../dbs/example_structures/cu111_h7.0_full_925K.in" | ||
ase_atoms = io.read(atoms_path) | ||
atoms, positions, cell = NQCDynamics.convert_from_ase_atoms(ase_atoms) | ||
|
||
println("Load ML models and initialize the simulation...") | ||
pes_model = mace_model_pes(pes_model_path, ase_atoms) | ||
sim = Simulation{Classical}(atoms, pes_model, cell=cell) |
Oops, something went wrong.