Phonons¶
janus-core
contains an interface to phonopy to compute phonons and ready made workflows these calculations.
Set up environment (optional)¶
These steps are required for Google Colab, but may work on other systems too:
[ ]:
# import locale
# locale.getpreferredencoding = lambda: "UTF-8"
# ! pip uninstall torch torchaudio torchvision numpy -y
# ! uv pip install janus-core[all] data-tutorials torch==2.5.1 --system
# get_ipython().kernel.do_shutdown(restart=True)
Use data_tutorials
to get the data required for this tutorial:
[ ]:
from data_tutorials.data import get_data
get_data(
url="https://raw.githubusercontent.com/stfc/janus-core/main/docs/source/tutorials/data/",
filename=["NaCl.cif"],
folder="../data",
)
view the data
[1]:
from ase.io import read
from weas_widget import WeasWidget
NaCl = read("../data/NaCl.cif")
print(NaCl.cell)
v=WeasWidget()
v.from_ase(NaCl)
v.avr.model_style = 1
v
Cell([5.63, 5.63, 5.63])
[1]:
Command-line help and options¶
Once janus-core
is installed, the janus phonons
command should be available. You may want to execute it in a real terminal to see all the options.
[2]:
! janus phonons --help
Usage: janus phonons [OPTIONS]
Calculate phonons and save results.
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ * --struct PATH Path of structure │
│ to simulate. │
│ [default: None] │
│ [required] │
│ --supercell TEXT Supercell matrix, │
│ in the Phonopy │
│ style. Must be │
│ passed as a │
│ string in one of │
│ three forms: │
│ single integer │
│ ('2'), which │
│ specifies all │
│ diagonal │
│ elements; three │
│ integers ('1 2 │
│ 3'), which │
│ specifies each │
│ individual │
│ diagonal element; │
│ or nine values │
│ ('1 2 3 4 5 6 7 8 │
│ 9'), which │
│ specifies all │
│ elements, filling │
│ the matrix │
│ row-wise. │
│ [default: 2 2 2] │
│ --displacement FLOAT Displacement for │
│ force constants │
│ calculation, in │
│ A. │
│ [default: 0.01] │
│ --displacement… DICT Keyword arguments │
│ to pass to │
│ generate_displac… │
│ Must be passed as │
│ a dictionary │
│ wrapped in │
│ quotes, e.g. │
│ "{'key' : │
│ value}". │
│ [default: None] │
│ --mesh <INTEGER Mesh numbers │
│ INTEGER along a, b, c │
│ INTEGER>... axes. │
│ [default: 10, 10, │
│ 10] │
│ --bands --no-bands Whether to │
│ compute band │
│ structure. │
│ [default: │
│ no-bands] │
│ --n-qpoints INTEGER Number of │
│ q-points to │
│ sample along │
│ generated path, │
│ including end │
│ points. Unused if │
│ `qpoint_file` is │
│ specified │
│ [default: 51] │
│ --qpoint-file PATH Path to yaml file │
│ with info to │
│ generate a path │
│ of q-points for │
│ band structure. │
│ [default: None] │
│ --dos --no-dos Whether to │
│ calculate the │
│ DOS. │
│ [default: no-dos] │
│ --dos-kwargs DICT Keyword arguments │
│ to pass to │
│ run_total_dos. │
│ Must be passed as │
│ a dictionary │
│ wrapped in │
│ quotes, e.g. │
│ "{'key' : │
│ value}". │
│ [default: None] │
│ --pdos --no-pdos Whether to │
│ calculate the │
│ PDOS. │
│ [default: │
│ no-pdos] │
│ --pdos-kwargs DICT Keyword arguments │
│ to pass to │
│ run_projected_do… │
│ Must be passed as │
│ a dictionary │
│ wrapped in │
│ quotes, e.g. │
│ "{'key' : │
│ value}". │
│ [default: None] │
│ --thermal --no-thermal Whether to │
│ calculate thermal │
│ properties. │
│ [default: │
│ no-thermal] │
│ --temp-min FLOAT Start temperature │
│ for thermal │
│ properties │
│ calculations, in │
│ K. │
│ [default: 0.0] │
│ --temp-max FLOAT End temperature │
│ for thermal │
│ properties │
│ calculations, in │
│ K. │
│ [default: 1000.0] │
│ --temp-step FLOAT Temperature step │
│ for thermal │
│ properties │
│ calculations, in │
│ K. │
│ [default: 50] │
│ --symmetrize --no-symmetrize Whether to │
│ symmetrize force │
│ constants. │
│ [default: │
│ no-symmetrize] │
│ --minimize --no-minimize Whether to │
│ minimize │
│ structure before │
│ calculations. │
│ [default: │
│ no-minimize] │
│ --fmax FLOAT Maximum force for │
│ optimization │
│ convergence. │
│ [default: 0.1] │
│ --minimize-kwa… DICT Keyword arguments │
│ to pass to │
│ optimizer. Must │
│ be passed as a │
│ dictionary │
│ wrapped in │
│ quotes, e.g. │
│ "{'key': value}". │
│ [default: None] │
│ --hdf5 --no-hdf5 Whether to save │
│ force constants │
│ in hdf5. │
│ [default: hdf5] │
│ --plot-to-file --no-plot-to-fi… Whether to plot │
│ band structure │
│ and/or dos/pdos │
│ when calculated. │
│ [default: │
│ no-plot-to-file] │
│ --write-full --no-write-full Whether to write │
│ eigenvectors, │
│ group velocities, │
│ etc. to bands │
│ file. │
│ [default: │
│ write-full] │
│ --arch [mace|mace_mp|m MLIP architecture │
│ ace_off|m3gnet| to use for │
│ chgnet|alignn|s calculations. │
│ evennet|nequip| [default: │
│ dpa3|orb|matter mace_mp] │
│ sim] │
│ --device [cpu|cuda|mps|x Device to run │
│ pu] calculations on. │
│ [default: cpu] │
│ --model-path TEXT Path to MLIP │
│ model. │
│ [default: None] │
│ --read-kwargs DICT Keyword arguments │
│ to pass to │
│ ase.io.read. Must │
│ be passed as a │
│ dictionary │
│ wrapped in │
│ quotes, e.g. │
│ "{'key': value}". │
│ By default, │
│ read_kwargs['ind… │
│ = -1, so only the │
│ last structure is │
│ read. │
│ [default: None] │
│ --calc-kwargs DICT Keyword arguments │
│ to pass to │
│ selected │
│ calculator. Must │
│ be passed as a │
│ dictionary │
│ wrapped in │
│ quotes, e.g. │
│ "{'key': value}". │
│ For the default │
│ architecture │
│ ('mace_mp'), │
│ "{'model': │
│ 'small'}" is set │
│ unless │
│ overwritten. │
│ [default: None] │
│ --file-prefix PATH Prefix for output │
│ files, including │
│ directories. │
│ Default directory │
│ is │
│ ./janus_results, │
│ and default │
│ filename prefix │
│ is inferred from │
│ the input │
│ stucture │
│ filename. │
│ [default: None] │
│ --log PATH Path to save logs │
│ to. Default is │
│ inferred from │
│ `file_prefix` │
│ [default: None] │
│ --tracker --no-tracker Whether to save │
│ carbon emissions │
│ of calculation │
│ [default: │
│ tracker] │
│ --summary PATH Path to save │
│ summary of │
│ inputs, start/end │
│ time, and carbon │
│ emissions. │
│ Default is │
│ inferred from │
│ `file_prefix`. │
│ [default: None] │
│ --config TEXT Configuration │
│ file. │
│ --help Show this message │
│ and exit. │
╰──────────────────────────────────────────────────────────────────────────────╯
simple calculation¶
start by creating a config for the calculations. In this we performs
geometry optimisation
force constants calculations
band structure (on a path determined by seekpath)
density of states calculation
[3]:
%%writefile phonons.yml
supercell: 2 2 2
displacement: 0.001
fmax: 1.0e-6
bands: True
dos: True
minimize: True
minimize-kwargs:
write_results: True
arch: mace_mp
write-full: False
plot-to-file: True
calc-kwargs:
model: medium-mpa-0
device: cpu
tracker: False
Writing phonons.yml
now run the calculation itself
[4]:
! janus phonons --config phonons.yml --struct ../data/NaCl.cif
/Users/elliottkasoar/Documents/PSDI/janus-core/.venv/lib/python3.12/site-packages/e3nn/o3/_wigner.py:10: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
_Jd, _W3j_flat, _W3j_indices = torch.load(os.path.join(os.path.dirname(__file__), 'constants.pt'))
cuequivariance or cuequivariance_torch is not available. Cuequivariance acceleration will be disabled.
Using medium MPA-0 model as default MACE-MP model, to use previous (before 3.10) default model please specify 'medium' as model argument
Using Materials Project MACE for MACECalculator with /Users/elliottkasoar/.cache/mace/macempa0mediummodel
Using float64 for MACECalculator, which is slower but more accurate. Recommended for geometry optimization.
/Users/elliottkasoar/Documents/PSDI/janus-core/.venv/lib/python3.12/site-packages/mace/calculators/mace.py:139: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
torch.load(f=model_path, map_location=device)
Step Time Energy fmax
LBFGS: 0 15:57:52 -27.068017 0.139945
LBFGS: 1 15:57:52 -27.068849 0.137428
LBFGS: 2 15:57:52 -27.092226 0.007598
LBFGS: 3 15:57:52 -27.092302 0.000368
LBFGS: 4 15:57:52 -27.092303 0.000001
Computing displacements... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/2 0:00:00m -:--:--
explore the results
[5]:
!ls janus_results/
NaCl-auto_bands.yml.xz NaCl-mace-geomopt-log.yml
NaCl-bands.svg NaCl-mace-geomopt-summary.yml
NaCl-bs-dos.svg NaCl-mace-opt.extxyz
NaCl-deformed-geomopt-log.yml NaCl-opt.extxyz
NaCl-deformed-geomopt-summary.yml NaCl-phonons-log.yml
NaCl-deformed-opt.extxyz NaCl-phonons-summary.yml
NaCl-deformed-traj.extxyz NaCl-phonopy.yml
NaCl-dos.dat NaCl-sevennet-geomopt-log.yml
NaCl-dos.svg NaCl-sevennet-geomopt-summary.yml
NaCl-force_constants.hdf5 NaCl-sevennet-opt.extxyz
[6]:
from IPython.display import SVG, display
NaCl_opt = read("janus_results/NaCl-opt.extxyz")
print(NaCl_opt.cell)
display(SVG("janus_results/NaCl-bands.svg"))
display(SVG("janus_results/NaCl-dos.svg"))
Cell([[5.713563543365217, 1.8332163481995608e-15, 4.754467402654071e-14], [3.0202271055772404e-14, 5.713563543365362, -1.1609437950735153e-13], [2.5690502526151777e-14, -1.8339327482739338e-13, 5.71356354336537]])
advanced options¶
we compute thermal properties and also we specify the granularity of the DOS
[7]:
%%writefile phonons-adv.yml
supercell: 2 2 2
displacement: 0.001
fmax: 1.0e-6
thermal: True
temp-min: 0
temp-max: 1000
temp-step: 10
bands: True
dos: True
pdos: False
dos-kwargs:
freq_pitch: 0.05
mesh: [11,11,11]
minimize: True
minimize-kwargs:
write_results: True
arch: mace_mp
write-full: False
plot-to-file: True
calc-kwargs:
dispersion: False
skin: 0
model: medium-mpa-0
device: cpu
tracker: False
Writing phonons-adv.yml
[8]:
! janus phonons --config phonons-adv.yml --struct ../data/NaCl.cif
/Users/elliottkasoar/Documents/PSDI/janus-core/.venv/lib/python3.12/site-packages/e3nn/o3/_wigner.py:10: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
_Jd, _W3j_flat, _W3j_indices = torch.load(os.path.join(os.path.dirname(__file__), 'constants.pt'))
cuequivariance or cuequivariance_torch is not available. Cuequivariance acceleration will be disabled.
Using medium MPA-0 model as default MACE-MP model, to use previous (before 3.10) default model please specify 'medium' as model argument
Using Materials Project MACE for MACECalculator with /Users/elliottkasoar/.cache/mace/macempa0mediummodel
Using float64 for MACECalculator, which is slower but more accurate. Recommended for geometry optimization.
/Users/elliottkasoar/Documents/PSDI/janus-core/.venv/lib/python3.12/site-packages/mace/calculators/mace.py:139: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
torch.load(f=model_path, map_location=device)
Step Time Energy fmax
LBFGS: 0 15:58:00 -27.068017 0.139945
LBFGS: 1 15:58:01 -27.068849 0.137428
LBFGS: 2 15:58:01 -27.092226 0.007598
LBFGS: 3 15:58:01 -27.092302 0.000368
LBFGS: 4 15:58:01 -27.092303 0.000001
Computing displacements... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/2 0:00:00m -:--:--
[9]:
!ls janus_results/
NaCl-auto_bands.yml.xz NaCl-mace-geomopt-summary.yml
NaCl-bands.svg NaCl-mace-opt.extxyz
NaCl-bs-dos.svg NaCl-opt.extxyz
NaCl-deformed-geomopt-log.yml NaCl-phonons-log.yml
NaCl-deformed-geomopt-summary.yml NaCl-phonons-summary.yml
NaCl-deformed-opt.extxyz NaCl-phonopy.yml
NaCl-deformed-traj.extxyz NaCl-sevennet-geomopt-log.yml
NaCl-dos.dat NaCl-sevennet-geomopt-summary.yml
NaCl-dos.svg NaCl-sevennet-opt.extxyz
NaCl-force_constants.hdf5 NaCl-thermal.yml
NaCl-mace-geomopt-log.yml
[10]:
from IPython.display import SVG, display
display(SVG("janus_results/NaCl-bands.svg"))
display(SVG("janus_results/NaCl-dos.svg"))
phonons under pressure¶
[11]:
%%writefile phonons-pressure.yml
supercell: 2 2 2
displacement: 0.001
fmax: 1.0e-6
thermal: True
temp-min: 0
temp-max: 1000
temp-step: 10
bands: True
dos: True
pdos: False
dos-kwargs:
freq_pitch: 0.05
mesh: [11,11,11]
minimize: True
minimize-kwargs:
write_results: True
filter_kwargs:
scalar_pressure: 1.0
arch: mace_mp
write-full: False
plot-to-file: True
calc-kwargs:
dispersion: False
skin: 0
model: medium-mpa-0
device: cpu
tracker: False
Writing phonons-pressure.yml
[12]:
! janus phonons --config phonons-pressure.yml --struct ../data/NaCl.cif
/Users/elliottkasoar/Documents/PSDI/janus-core/.venv/lib/python3.12/site-packages/e3nn/o3/_wigner.py:10: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
_Jd, _W3j_flat, _W3j_indices = torch.load(os.path.join(os.path.dirname(__file__), 'constants.pt'))
cuequivariance or cuequivariance_torch is not available. Cuequivariance acceleration will be disabled.
Using medium MPA-0 model as default MACE-MP model, to use previous (before 3.10) default model please specify 'medium' as model argument
Using Materials Project MACE for MACECalculator with /Users/elliottkasoar/.cache/mace/macempa0mediummodel
Using float64 for MACECalculator, which is slower but more accurate. Recommended for geometry optimization.
/Users/elliottkasoar/Documents/PSDI/janus-core/.venv/lib/python3.12/site-packages/mace/calculators/mace.py:139: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
torch.load(f=model_path, map_location=device)
Step Time Energy fmax
LBFGS: 0 15:58:05 -25.954198 0.000718
LBFGS: 1 15:58:06 -25.954198 0.000704
LBFGS: 2 15:58:06 -25.954198 0.000000
Computing displacements... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/2 0:00:00m -:--:--
[13]:
from IPython.display import SVG, display
display(SVG("janus_results/NaCl-bands.svg"))
display(SVG("janus_results/NaCl-dos.svg"))
isotropic optimisation of the cell¶
[14]:
%%writefile phonons-iso.yml
supercell: 2 2 2
displacement: 0.001
fmax: 1.0e-6
thermal: True
temp-min: 0
temp-max: 1000
temp-step: 10
bands: True
dos: True
pdos: False
dos-kwargs:
freq_pitch: 0.05
mesh: [11,11,11]
minimize: True
minimize-kwargs:
write_results: True
filter_kwargs:
hydrostatic_strain: True
arch: mace_mp
write-full: False
plot-to-file: True
calc-kwargs:
dispersion: False
skin: 0
model: medium-mpa-0
device: cpu
tracker: False
Writing phonons-iso.yml
[15]:
!janus phonons --config phonons-iso.yml --struct ../data/NaCl.cif
/Users/elliottkasoar/Documents/PSDI/janus-core/.venv/lib/python3.12/site-packages/e3nn/o3/_wigner.py:10: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
_Jd, _W3j_flat, _W3j_indices = torch.load(os.path.join(os.path.dirname(__file__), 'constants.pt'))
cuequivariance or cuequivariance_torch is not available. Cuequivariance acceleration will be disabled.
Using medium MPA-0 model as default MACE-MP model, to use previous (before 3.10) default model please specify 'medium' as model argument
Using Materials Project MACE for MACECalculator with /Users/elliottkasoar/.cache/mace/macempa0mediummodel
Using float64 for MACECalculator, which is slower but more accurate. Recommended for geometry optimization.
/Users/elliottkasoar/Documents/PSDI/janus-core/.venv/lib/python3.12/site-packages/mace/calculators/mace.py:139: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
torch.load(f=model_path, map_location=device)
Step Time Energy fmax
LBFGS: 0 15:58:10 -27.068017 0.139945
LBFGS: 1 15:58:10 -27.068849 0.137428
LBFGS: 2 15:58:10 -27.092226 0.007598
LBFGS: 3 15:58:11 -27.092302 0.000368
LBFGS: 4 15:58:11 -27.092303 0.000001
Computing displacements... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/2 0:00:00m -:--:--
[16]:
from IPython.display import SVG, display
display(SVG("janus_results/NaCl-bands.svg"))
display(SVG("janus_results/NaCl-dos.svg"))
using a path for band structure¶
download mof-5.cif and paths.yaml from examples folder
[ ]:
get_data(
url="https://raw.githubusercontent.com/stfc/janus-core/main/docs/source/tutorials/data/",
filename=["mof-5.cif", "paths.yaml"],
folder="../data",
)
[17]:
mof5 = read("../data/mof-5.cif")
v=WeasWidget()
v.from_ase(mof5)
v.avr.model_style = 1
v
[17]:
[18]:
%%writefile phonons-mof5.yml
supercell: 1 1 1
displacement: 0.001
fmax: 1.0e-6
thermal: True
temp-min: 0
temp-max: 1000
temp-step: 10
bands: True
dos: True
pdos: False
dos-kwargs:
freq_pitch: 0.05
mesh: [11,11,11]
minimize: True
minimize-kwargs:
write_results: True
arch: mace_mp
write-full: False
plot-to-file: True
calc-kwargs:
dispersion: False
skin: 0
model: medium-mpa-0
device: cpu
tracker: False
Writing phonons-mof5.yml
please note parameters here are chosen for speed rather than correctness
[19]:
! janus phonons --config phonons-mof5.yml --struct ../data/mof-5.cif
/Users/elliottkasoar/Documents/PSDI/janus-core/.venv/lib/python3.12/site-packages/e3nn/o3/_wigner.py:10: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
_Jd, _W3j_flat, _W3j_indices = torch.load(os.path.join(os.path.dirname(__file__), 'constants.pt'))
cuequivariance or cuequivariance_torch is not available. Cuequivariance acceleration will be disabled.
Using medium MPA-0 model as default MACE-MP model, to use previous (before 3.10) default model please specify 'medium' as model argument
Using Materials Project MACE for MACECalculator with /Users/elliottkasoar/.cache/mace/macempa0mediummodel
Using float64 for MACECalculator, which is slower but more accurate. Recommended for geometry optimization.
/Users/elliottkasoar/Documents/PSDI/janus-core/.venv/lib/python3.12/site-packages/mace/calculators/mace.py:139: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
torch.load(f=model_path, map_location=device)
Step Time Energy fmax
LBFGS: 0 15:58:35 -717.990651 0.453342
LBFGS: 1 15:58:35 -718.036579 0.118547
LBFGS: 2 15:58:36 -718.042364 0.051292
LBFGS: 3 15:58:37 -718.043794 0.031008
LBFGS: 4 15:58:37 -718.044806 0.023343
LBFGS: 5 15:58:38 -718.045403 0.025471
LBFGS: 6 15:58:39 -718.045801 0.016009
LBFGS: 7 15:58:39 -718.046041 0.014984
LBFGS: 8 15:58:40 -718.046126 0.014026
LBFGS: 9 15:58:41 -718.046161 0.013629
LBFGS: 10 15:58:41 -718.046202 0.013497
LBFGS: 11 15:58:42 -718.046262 0.013703
LBFGS: 12 15:58:43 -718.046327 0.014230
LBFGS: 13 15:58:43 -718.046388 0.014738
LBFGS: 14 15:58:44 -718.046459 0.014931
LBFGS: 15 15:58:45 -718.046571 0.014507
LBFGS: 16 15:58:46 -718.046746 0.017375
LBFGS: 17 15:58:46 -718.046972 0.016781
LBFGS: 18 15:58:47 -718.047220 0.014905
LBFGS: 19 15:58:48 -718.047515 0.014402
LBFGS: 20 15:58:48 -718.047938 0.020799
LBFGS: 21 15:58:49 -718.048500 0.028931
LBFGS: 22 15:58:50 -718.048972 0.022752
LBFGS: 23 15:58:50 -718.049151 0.008560
LBFGS: 24 15:58:51 -718.049179 0.003982
LBFGS: 25 15:58:52 -718.049182 0.002267
LBFGS: 26 15:58:53 -718.049184 0.001018
LBFGS: 27 15:58:53 -718.049184 0.000499
LBFGS: 28 15:58:54 -718.049184 0.000184
LBFGS: 29 15:58:55 -718.049184 0.000024
LBFGS: 30 15:58:55 -718.049184 0.000004
LBFGS: 31 15:58:56 -718.049184 0.000004
LBFGS: 32 15:58:57 -718.049184 0.000005
LBFGS: 33 15:58:57 -718.049184 0.000004
LBFGS: 34 15:58:58 -718.049184 0.000003
LBFGS: 35 15:58:59 -718.049184 0.000001
LBFGS: 36 15:58:59 -718.049184 0.000001
Computing displacements... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 19/19 0:00:00m 0:00:01
[20]:
!ls janus_results/
NaCl-auto_bands.yml.xz NaCl-phonopy.yml
NaCl-bands.svg NaCl-sevennet-geomopt-log.yml
NaCl-bs-dos.svg NaCl-sevennet-geomopt-summary.yml
NaCl-deformed-geomopt-log.yml NaCl-sevennet-opt.extxyz
NaCl-deformed-geomopt-summary.yml NaCl-thermal.yml
NaCl-deformed-opt.extxyz mof-5-auto_bands.yml.xz
NaCl-deformed-traj.extxyz mof-5-bands.svg
NaCl-dos.dat mof-5-bs-dos.svg
NaCl-dos.svg mof-5-dos.dat
NaCl-force_constants.hdf5 mof-5-dos.svg
NaCl-mace-geomopt-log.yml mof-5-force_constants.hdf5
NaCl-mace-geomopt-summary.yml mof-5-opt.extxyz
NaCl-mace-opt.extxyz mof-5-phonons-log.yml
NaCl-opt.extxyz mof-5-phonons-summary.yml
NaCl-phonons-log.yml mof-5-phonopy.yml
NaCl-phonons-summary.yml mof-5-thermal.yml
[21]:
from IPython.display import SVG, display
display(SVG("janus_results/mof-5-bs-dos.svg"))
[22]:
%%writefile phonons-mof5-path.yml
supercell: 1 1 1
displacement: 0.001
fmax: 1.0e-6
thermal: True
temp-min: 0
temp-max: 1000
temp-step: 10
bands: True
dos: True
pdos: False
dos-kwargs:
freq_pitch: 0.05
mesh: [11,11,11]
qpoint-file: ../data/paths.yaml
minimize: True
minimize-kwargs:
write_results: True
arch: mace_mp
write-full: False
plot-to-file: True
calc-kwargs:
dispersion: False
skin: 0
model: medium-mpa-0
device: cpu
tracker: False
Writing phonons-mof5-path.yml
[23]:
! janus phonons --config phonons-mof5-path.yml --struct ../data/mof-5.cif
/Users/elliottkasoar/Documents/PSDI/janus-core/.venv/lib/python3.12/site-packages/e3nn/o3/_wigner.py:10: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
_Jd, _W3j_flat, _W3j_indices = torch.load(os.path.join(os.path.dirname(__file__), 'constants.pt'))
cuequivariance or cuequivariance_torch is not available. Cuequivariance acceleration will be disabled.
Using medium MPA-0 model as default MACE-MP model, to use previous (before 3.10) default model please specify 'medium' as model argument
Using Materials Project MACE for MACECalculator with /Users/elliottkasoar/.cache/mace/macempa0mediummodel
Using float64 for MACECalculator, which is slower but more accurate. Recommended for geometry optimization.
/Users/elliottkasoar/Documents/PSDI/janus-core/.venv/lib/python3.12/site-packages/mace/calculators/mace.py:139: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
torch.load(f=model_path, map_location=device)
Step Time Energy fmax
LBFGS: 0 15:59:29 -717.990651 0.453342
LBFGS: 1 15:59:30 -718.036579 0.118547
LBFGS: 2 15:59:30 -718.042364 0.051292
LBFGS: 3 15:59:31 -718.043794 0.031008
LBFGS: 4 15:59:32 -718.044806 0.023343
LBFGS: 5 15:59:32 -718.045403 0.025471
LBFGS: 6 15:59:33 -718.045801 0.016009
LBFGS: 7 15:59:34 -718.046041 0.014984
LBFGS: 8 15:59:34 -718.046126 0.014026
LBFGS: 9 15:59:35 -718.046161 0.013629
LBFGS: 10 15:59:36 -718.046202 0.013497
LBFGS: 11 15:59:36 -718.046262 0.013703
LBFGS: 12 15:59:37 -718.046327 0.014230
LBFGS: 13 15:59:38 -718.046388 0.014738
LBFGS: 14 15:59:38 -718.046459 0.014931
LBFGS: 15 15:59:39 -718.046571 0.014507
LBFGS: 16 15:59:40 -718.046746 0.017375
LBFGS: 17 15:59:40 -718.046972 0.016781
LBFGS: 18 15:59:41 -718.047220 0.014905
LBFGS: 19 15:59:42 -718.047515 0.014402
LBFGS: 20 15:59:42 -718.047938 0.020799
LBFGS: 21 15:59:43 -718.048500 0.028931
LBFGS: 22 15:59:44 -718.048972 0.022752
LBFGS: 23 15:59:44 -718.049151 0.008560
LBFGS: 24 15:59:45 -718.049179 0.003982
LBFGS: 25 15:59:46 -718.049182 0.002267
LBFGS: 26 15:59:46 -718.049184 0.001018
LBFGS: 27 15:59:47 -718.049184 0.000499
LBFGS: 28 15:59:48 -718.049184 0.000184
LBFGS: 29 15:59:48 -718.049184 0.000024
LBFGS: 30 15:59:49 -718.049184 0.000004
LBFGS: 31 15:59:50 -718.049184 0.000004
LBFGS: 32 15:59:50 -718.049184 0.000005
LBFGS: 33 15:59:51 -718.049184 0.000004
LBFGS: 34 15:59:52 -718.049184 0.000003
LBFGS: 35 15:59:52 -718.049184 0.000001
LBFGS: 36 15:59:53 -718.049184 0.000001
Computing displacements... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 19/19 0:00:00m 0:00:01
[24]:
! ls janus_results/
NaCl-auto_bands.yml.xz NaCl-sevennet-geomopt-log.yml
NaCl-bands.svg NaCl-sevennet-geomopt-summary.yml
NaCl-bs-dos.svg NaCl-sevennet-opt.extxyz
NaCl-deformed-geomopt-log.yml NaCl-thermal.yml
NaCl-deformed-geomopt-summary.yml mof-5-auto_bands.yml.xz
NaCl-deformed-opt.extxyz mof-5-bands.svg
NaCl-deformed-traj.extxyz mof-5-bands.yml.xz
NaCl-dos.dat mof-5-bs-dos.svg
NaCl-dos.svg mof-5-dos.dat
NaCl-force_constants.hdf5 mof-5-dos.svg
NaCl-mace-geomopt-log.yml mof-5-force_constants.hdf5
NaCl-mace-geomopt-summary.yml mof-5-opt.extxyz
NaCl-mace-opt.extxyz mof-5-phonons-log.yml
NaCl-opt.extxyz mof-5-phonons-summary.yml
NaCl-phonons-log.yml mof-5-phonopy.yml
NaCl-phonons-summary.yml mof-5-thermal.yml
NaCl-phonopy.yml
[25]:
display(SVG("janus_results/mof-5-bs-dos.svg"))
extra bits¶
now as a challenge you can do a more realistic example, change the above example to
use a 2 2 2 supercell
use a more accurate model for MoFs mof0_v2 from here https://github.com/ddmms/data/tree/main/mace-mof-0/v2
this is part of this paper if you want to know more: https://arxiv.org/abs/2412.02877