Skip to content

Commit

Permalink
deploy: 30a1698
Browse files Browse the repository at this point in the history
  • Loading branch information
yanghan234 committed Nov 22, 2024
1 parent 93fa777 commit 43f184d
Show file tree
Hide file tree
Showing 18 changed files with 194 additions and 147 deletions.
Binary file removed _images/examples_phonon_example_7_5.png
Binary file not shown.
Binary file removed _images/examples_phonon_example_7_6.png
Binary file not shown.
Binary file added _images/examples_phonon_example_7_7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _images/examples_phonon_example_7_8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
84 changes: 44 additions & 40 deletions _sources/examples/phonon_example.ipynb

Large diffs are not rendered by default.

20 changes: 17 additions & 3 deletions _sources/examples/relax_example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ Import the necessary modules
import numpy as np
from ase.build import bulk
from ase.units import GPa
from mattersim.forcefield.potential import Potential
from mattersim.forcefield.potential import DeepCalculator
from mattersim.applications.relax import Relaxer
Set up the structure to relax
-----------------------------
Expand All @@ -28,12 +30,24 @@ Set up the structure to relax
potential = Potential.load(load_path="/path/to/checkpoint", device="cuda:0")
# create a calculator from the model
calculator = DeepCalculator(potential=potential)
calc = DeepCalculator(potential=potential, stress_weight=GPa)
# attach the calculator to the atoms object
si.calc = calculator
si.calc = calc
Create the optimizer
Run the relaxation
--------------------

MatterSim implements a built-in relaxation class to support the relaxation of ase atoms.

.. code-block:: python
# initialize the relaxation object
relaxer = Relaxer(
optimizer="BFGS", # the optimization method
filter="ExpCellFilter", # filter to apply to the cell
constrain_symmetry=True, # whether to constrain the symmetry
)
relaxed_structure = relaxer.run(si, steps=500)
4 changes: 2 additions & 2 deletions _sources/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ Pre-trained Models

We currently offer two pre-trained versions of MatterSim with **M3GNet** architecture:

1. **mattersim-mini-v1.0.0**: A mini version of the model that is faster to run.
2. **mattersim-medium-v1.0.0**: A medium version of the model that is more accurate.
1. **mattersim-v1.0.0-1M**: A mini version of the model that is faster to run.
2. **mattersim-v1.0.0-5M**: A medium version of the model that is more accurate.

These models have been trained using the data generated through the workflows
introduced in the `MatterSim <https://arxiv.org/abs/2405.04967>`_ manuscript, which provides an in-depth
Expand Down
3 changes: 2 additions & 1 deletion _sources/user_guide/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ MatterSim provides an interface to the Atomic Simulation Environment (ASE) to fa
:linenos:
from ase.build import bulk
from ase.units import GPa
from mattersim.forcefield.potential import DeepCalculator
# same as before
Expand All @@ -50,7 +51,7 @@ MatterSim provides an interface to the Atomic Simulation Environment (ASE) to fa
calculator = DeepCalculator(
potential=potential,
# important! convert GPa to eV/Angstrom^3
stress_weight=1 / 160.21766208,
stress_weight=GPa,
)
si.calc = calculator
Expand Down
1 change: 0 additions & 1 deletion _sources/user_guide/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Install from source code
Requirements:

* Python == 3.9
* PyTorch == 1.11.0

To install the package, run the following command under the root of the folder:

Expand Down
Binary file added _static/mattersim-banner.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
73 changes: 43 additions & 30 deletions examples/phonon_example.html
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ <h1><span class="section-number">2. </span>Phonon Dispersion<a class="headerlink
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre><span></span>import numpy as np
from ase.build import bulk
from ase.units import GPa
from ase.visualize import view
from mattersim.forcefield.potential import Potential, DeepCalculator
from mattersim.applications.phonon import PhononWorkflow
Expand Down Expand Up @@ -362,7 +363,7 @@ <h2><span class="section-number">2.1. </span>Set up the atomic structure with at
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre><span></span># create MatterSim calculator
potential = Potential.load(load_path=&quot;/path/to/checkpoint&quot;)
calc = DeepCalculator(potential=potential)
calc = DeepCalculator(potential=potential, stress_weight=GPa)
</pre></div>
</div>
</div>
Expand All @@ -387,7 +388,7 @@ <h2><span class="section-number">2.2. </span>Set up the phonon workflow<a class=
find_prim = False,
work_dir = &quot;/tmp/phonon_si_example&quot;,
amplitude = 0.01,
supercell_matrix = np.diag([2,2,2]),
supercell_matrix = np.diag([4,4,4]),
)
has_imag, phonons = ph.run()
print(f&quot;Has imaginary phonon: {has_imag}&quot;)
Expand All @@ -398,21 +399,32 @@ <h2><span class="section-number">2.2. </span>Set up the phonon workflow<a class=
<div class="nboutput docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
Supercell matrix for 2nd force constants :
[[4 0 0]
[0 4 0]
[0 0 4]]
</pre></div></div>
</div>
<div class="nboutput docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area stderr docutils container">
<div class="highlight"><pre>
/home/hanyang/miniforge3/envs/mattersim/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset[&#39;transformation_matrix&#39;]) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
/home/hanyang/miniforge3/envs/mattersim-public/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset[&#39;transformation_matrix&#39;]) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
warnings.warn(
/home/hanyang/miniforge3/envs/mattersim/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset[&#39;international&#39;]) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
/home/hanyang/miniforge3/envs/mattersim-public/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset[&#39;international&#39;]) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
warnings.warn(
/home/hanyang/miniforge3/envs/mattersim/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset[&#39;rotations&#39;]) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
/home/hanyang/miniforge3/envs/mattersim-public/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset[&#39;rotations&#39;]) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
warnings.warn(
/home/hanyang/miniforge3/envs/mattersim/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset[&#39;translations&#39;]) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
/home/hanyang/miniforge3/envs/mattersim-public/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset[&#39;translations&#39;]) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
warnings.warn(
/home/hanyang/miniforge3/envs/mattersim/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset[&#39;number&#39;]) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
/home/hanyang/miniforge3/envs/mattersim-public/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset[&#39;number&#39;]) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
warnings.warn(
/home/hanyang/miniforge3/envs/mattersim/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset[&#39;wyckoffs&#39;]) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
/home/hanyang/miniforge3/envs/mattersim-public/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset[&#39;wyckoffs&#39;]) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
warnings.warn(
/home/hanyang/miniforge3/envs/mattersim/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset[&#39;equivalent_atoms&#39;]) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
/home/hanyang/miniforge3/envs/mattersim-public/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset[&#39;equivalent_atoms&#39;]) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
warnings.warn(
</pre></div></div>
</div>
Expand All @@ -421,10 +433,6 @@ <h2><span class="section-number">2.2. </span>Set up the phonon workflow<a class=
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
Supercell matrix for 2nd force constants :
[[2 0 0]
[0 2 0]
[0 0 2]]


Inferring forces for displaced atoms and computing fcs ...
Expand All @@ -435,14 +443,14 @@ <h2><span class="section-number">2.2. </span>Set up the phonon workflow<a class=
</div>
<div class="output_area stderr docutils container">
<div class="highlight"><pre>
0%| | 0/1 [00:00&lt;?, ?it/s]100%|██████████| 1/1 [00:00&lt;00:00, 1.19it/s]
/home/hanyang/miniforge3/envs/mattersim/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset[&#39;std_lattice&#39;]) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
100%|██████████| 1/1 [00:00&lt;00:00, 3.64it/s]
/home/hanyang/miniforge3/envs/mattersim-public/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset[&#39;std_lattice&#39;]) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
warnings.warn(
/home/hanyang/miniforge3/envs/mattersim/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset[&#39;std_positions&#39;]) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
/home/hanyang/miniforge3/envs/mattersim-public/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset[&#39;std_positions&#39;]) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
warnings.warn(
/home/hanyang/miniforge3/envs/mattersim/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset[&#39;std_types&#39;]) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
/home/hanyang/miniforge3/envs/mattersim-public/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset[&#39;std_types&#39;]) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
warnings.warn(
/home/hanyang/miniforge3/envs/mattersim/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset[&#39;std_rotation_matrix&#39;]) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
/home/hanyang/miniforge3/envs/mattersim-public/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset[&#39;std_rotation_matrix&#39;]) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
warnings.warn(
</pre></div></div>
</div>
Expand All @@ -451,42 +459,47 @@ <h2><span class="section-number">2.2. </span>Set up the phonon workflow<a class=
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
Max drift of force constants: 0.000003 (xx) 0.000003 (yy)
Max drift after symmetrization by translation: 0.000000 (zz) 0.000000 (zz)
Qpoints mesh for Brillouin Zone integration : [12 12 12]
Max drift of force constants: -0.000009 (yy) -0.000009 (zz)
Max drift after symmetrization by translation: -0.000000 (xx) -0.000000 (xx)
Qpoints mesh for Brillouin Zone integration : [24 24 24]
Dispersion relations using phonopy for Si2 ...

Has imaginary phonon: False
Phonon frequencies: &lt;phonopy.api_phonopy.Phonopy object at 0x7af8347654c0&gt;
</pre></div></div>
</div>
<div class="nboutput docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area stderr docutils container">
<div class="highlight"><pre>
/home/hanyang/miniforge3/envs/mattersim/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset[&#39;uni_number&#39;]) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
/home/hanyang/miniforge3/envs/mattersim-public/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset[&#39;international&#39;]) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
warnings.warn(
/home/hanyang/miniforge3/envs/mattersim/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset[&#39;international&#39;]) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
/home/hanyang/miniforge3/envs/mattersim-public/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset[&#39;number&#39;]) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
warnings.warn(
/home/hanyang/miniforge3/envs/mattersim/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset[&#39;number&#39;]) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
warnings.warn(
/home/hanyang/miniforge3/envs/mattersim/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset[&#39;hall&#39;]) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
/home/hanyang/miniforge3/envs/mattersim-public/lib/python3.9/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset[&#39;hall&#39;]) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead
warnings.warn(
</pre></div></div>
</div>
<div class="nboutput docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<img alt="../_images/examples_phonon_example_7_5.png" class="no-scaled-link" src="../_images/examples_phonon_example_7_5.png" style="width: 563px; height: 394px;" />
<div class="highlight"><pre>
Has imaginary phonon: False
Phonon frequencies: &lt;phonopy.api_phonopy.Phonopy object at 0x7cb2848fe7c0&gt;
</pre></div></div>
</div>
<div class="nboutput docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<img alt="../_images/examples_phonon_example_7_7.png" class="no-scaled-link" src="../_images/examples_phonon_example_7_7.png" style="width: 563px; height: 394px;" />
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<img alt="../_images/examples_phonon_example_7_6.png" class="no-scaled-link" src="../_images/examples_phonon_example_7_6.png" style="width: 562px; height: 428px;" />
<img alt="../_images/examples_phonon_example_7_8.png" class="no-scaled-link" src="../_images/examples_phonon_example_7_8.png" style="width: 562px; height: 428px;" />
</div>
</div>
<div class="nbinput docutils container">
Expand Down
Loading

0 comments on commit 43f184d

Please sign in to comment.