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

Fix ruff by sorting the class variables in _so3.py #441

Merged
merged 69 commits into from
Nov 22, 2024
Merged
Changes from 1 commit
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
fc94e79
improve TensorNet model coverage
kenko911 Jun 22, 2024
53357d7
Update pyproject.toml
kenko911 Jun 22, 2024
f65cdba
Improve the unit test for SO(3) equivarance in TensorNet class
kenko911 Jun 22, 2024
93574e0
Merge branch 'main' of https://github.com/kenko911/matgl
kenko911 Jun 22, 2024
16abc38
improve SO3Net model class coverage and simplify TensorNet implementa…
kenko911 Jun 23, 2024
6aaad51
Merge branch 'materialsvirtuallab:main' into main
kenko911 Jun 23, 2024
2798176
improve the coverage in MLP_norm class
kenko911 Jun 24, 2024
e24bbdd
Merge branch 'main' of https://github.com/kenko911/matgl
kenko911 Jun 24, 2024
2101bb0
Merge branch 'materialsvirtuallab:main' into main
kenko911 Jun 24, 2024
147d4f5
Better documentation for M3GNet potential training with stresses
kenko911 Jun 25, 2024
e144ae2
Merge branch 'materialsvirtuallab:main' into main
kenko911 Jun 28, 2024
9b17963
Improve the implementation of three-body interactions
kenko911 Jul 3, 2024
dc6ed59
fixed black
kenko911 Jul 3, 2024
59ab134
Merge branch 'materialsvirtuallab:main' into main
kenko911 Jul 5, 2024
522809c
Optimize the speed of _compute_3body class
kenko911 Jul 5, 2024
e290538
Merge branch 'materialsvirtuallab:main' into main
kenko911 Jul 8, 2024
27c728f
type checking is added for scheduler
kenko911 Jul 8, 2024
355ee6b
Merge branch 'materialsvirtuallab:main' into main
kenko911 Jul 14, 2024
3ac4f39
update M3GNet Potential training notebook for the demonstration of ob…
kenko911 Jul 14, 2024
992c17e
Downgrade sympy to avoid crash of SO3 operations
kenko911 Jul 14, 2024
193aaff
Merge branch 'materialsvirtuallab:main' into main
kenko911 Jul 17, 2024
38df100
Smooth l1 loss function is added and united tests are improved
kenko911 Jul 17, 2024
ea64ed9
Merge branch 'main' of https://github.com/kenko911/matgl
kenko911 Jul 20, 2024
40133c0
merge the method predict_structure and featurize_structure into a fun…
kenko911 Jul 21, 2024
6ebdb57
Merge branch 'materialsvirtuallab:main' into main
kenko911 Jul 28, 2024
c469ef7
remove unnecessary else statement for training magmoms
kenko911 Jul 28, 2024
6a3e736
Merge branch 'materialsvirtuallab:main' into main
kenko911 Aug 1, 2024
a4de37b
Merge branch 'materialsvirtuallab:main' into main
kenko911 Aug 7, 2024
bdb5ee0
Merge branch 'materialsvirtuallab:main' into main
kenko911 Aug 14, 2024
e5764b3
modify so3 operation implementation to make united tests pass due to …
kenko911 Aug 14, 2024
07d9bdd
Merge branch 'main' of https://github.com/kenko911/matgl
kenko911 Aug 14, 2024
b57f0be
Merge branch 'main' of https://github.com/kenko911/matgl
kenko911 Aug 14, 2024
ef0ce51
skip test_load_all_models for MacOS pytest now
kenko911 Aug 14, 2024
ae43929
Merge branch 'materialsvirtuallab:main' into main
kenko911 Aug 16, 2024
c355500
Merge branch 'materialsvirtuallab:main' into main
kenko911 Sep 4, 2024
7f34ed9
Reference for CHGNet is added
kenko911 Sep 4, 2024
fdae7a1
Update README.md and index.md for including CHGNet
kenko911 Sep 4, 2024
6438649
add more description for using CHGNet pretrained models in Relaxation…
kenko911 Sep 4, 2024
981b9c1
Merge branch 'materialsvirtuallab:main' into main
kenko911 Sep 4, 2024
984f9fa
Merge branch 'main' of https://github.com/kenko911/matgl
kenko911 Sep 4, 2024
c00594b
Merge branch 'main' of https://github.com/kenko911/matgl
kenko911 Sep 18, 2024
b4e34cd
A command-line interface for performing ASE MD simulations is added
kenko911 Sep 18, 2024
efe4118
added back py.typed
kenko911 Sep 18, 2024
a32bddc
Merge branch 'materialsvirtuallab:main' into main
kenko911 Sep 22, 2024
d2f1c43
ExpNormal Smearing for radial basis functions is added
kenko911 Sep 22, 2024
916a77c
Changed deprecated torch.scalar_tensor into torch.Tensor
kenko911 Sep 23, 2024
49ba5d8
Converted the float number into tensor
kenko911 Sep 23, 2024
cba6fd6
Upgrade torch to 2.4.0 in pyproject.toml
kenko911 Oct 6, 2024
8b63fdc
fix the united test in test_bond.py
kenko911 Oct 6, 2024
cf9fc6a
Merge branch 'main' into main
shyuep Oct 10, 2024
a20fa10
Bump boto3 from 1.35.38 to 1.35.39
dependabot[bot] Oct 14, 2024
2c1a096
Merge branch 'materialsvirtuallab:main' into main
kenko911 Oct 14, 2024
7209f48
fix the error from the upgrade of boto3
kenko911 Oct 14, 2024
10932c0
Downgrade DGL to 2.2.1
kenko911 Oct 14, 2024
104b53e
Downgrade pytorch
kenko911 Oct 14, 2024
ae09d16
fix mypy by adding self.norm_layers is not None
kenko911 Oct 14, 2024
9f9f43c
Downgrade Pytorch and DGL version (#392)
kenko911 Oct 14, 2024
cf79de7
correct the downgrade for torch
kenko911 Oct 14, 2024
3aa5ef9
Merge branch 'dependabot/pip/boto3-1.35.39' into main
kenko911 Oct 14, 2024
9c185ed
fix the version of torchdata
kenko911 Oct 14, 2024
e6502e8
merged the conflicts
kenko911 Oct 14, 2024
a997119
downgrade torch to 2.2.1
kenko911 Oct 14, 2024
a2c6b80
included symbreak for chgnet training to improve code coverage
kenko911 Oct 22, 2024
f0112a0
Merge branch 'materialsvirtuallab:main' into main
kenko911 Nov 8, 2024
9ece41b
Merge branch 'materialsvirtuallab:main' into main
kenko911 Nov 22, 2024
b30f5b9
fix ruff by sorting '__all__' in _so3.py
kenko911 Nov 22, 2024
296a834
remove Bussi for MD now
kenko911 Nov 22, 2024
189a330
remove Bussi for now
kenko911 Nov 22, 2024
33c156d
Remove trailing whitespace
kenko911 Nov 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Downgrade Pytorch and DGL version (#392)
* improve TensorNet model coverage

* Update pyproject.toml

Signed-off-by: Tsz Wai Ko <[email protected]>

* Improve the unit test for SO(3) equivarance in TensorNet class

* improve SO3Net model class coverage and simplify TensorNet implementations

* improve the coverage in MLP_norm class

* Improve the implementation of three-body interactions

* fixed black

* Optimize the speed of _compute_3body class

* type checking is added for scheduler

* update M3GNet Potential training notebook for the demonstration of obtaining and using element offsets

* Downgrade sympy to avoid crash of SO3 operations

* Smooth l1 loss function is added and united tests are improved

* merge the method predict_structure and featurize_structure into a function including both

* remove unnecessary else statement for training magmoms

* modify so3 operation implementation to make united tests pass due to the update of sympy

* skip test_load_all_models for MacOS pytest now

* Reference for CHGNet is added

* Update README.md and index.md for including CHGNet

Signed-off-by: Tsz Wai Ko <[email protected]>

* add more description for using CHGNet pretrained models in Relaxations and Simulations using the M3GNet Universal Potential.ipynb

* A command-line interface for performing ASE MD simulations is added

* added back py.typed

* ExpNormal Smearing for radial basis functions is added

* Changed deprecated torch.scalar_tensor into torch.Tensor

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Signed-off-by: Tsz Wai Ko <[email protected]>

* Converted the float number into tensor

Signed-off-by: Tsz Wai Ko <[email protected]>

* fix the united test in test_bond.py

* fix the error from the upgrade of boto3

* Downgrade DGL to 2.2.1

* Downgrade pytorch

* fix mypy by adding self.norm_layers is not None

---------

Signed-off-by: Tsz Wai Ko <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Shyue Ping Ong <[email protected]>
3 people authored Oct 14, 2024
commit 9f9f43c5b874ad2b3efb00dc0140b791ef236620
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -50,10 +50,10 @@ classifiers = [
]
dependencies = [
"ase",
"dgl<=2.4.0",
"dgl<=2.2.1",
"pymatgen",
"lightning<=2.4.0",
"torch<=2.2.1",
"lightning<=2.3.0",
"torch<=2.4.0",
"pydantic",
"torchdata<=0.7.1",
"boto3",
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dgl==2.4.0
dgl==2.2.1
torch==2.4.0
lightning==2.4.0
lightning==2.3.0
pymatgen==2024.10.3
ase==3.23.0
pydantic==2.9.2
14 changes: 8 additions & 6 deletions src/matgl/layers/_core.py
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

from __future__ import annotations

from typing import TYPE_CHECKING, Any, Callable, Literal
from typing import TYPE_CHECKING, Any, Callable, Literal, cast

import dgl
import torch
@@ -130,21 +130,23 @@ def __init__(
self.activate_last = activate_last
self.normalize_hidden = normalize_hidden
norm_kwargs = norm_kwargs or {}
norm_kwargs = cast(dict, norm_kwargs)

for i, (in_dim, out_dim) in enumerate(zip(dims[:-1], dims[1:])):
if i < self._depth - 1:
self.layers.append(Linear(in_dim, out_dim, bias=use_bias))
if normalize_hidden:
if normalize_hidden and self.norm_layers is not None:
if normalization == "graph":
self.norm_layers.append(GraphNorm(out_dim, **norm_kwargs))
elif normalization == "layer":
self.norm_layers.append(LayerNorm(out_dim, **norm_kwargs))
else:
self.layers.append(Linear(in_dim, out_dim, bias=use_bias and bias_last))
if normalization == "graph":
self.norm_layers.append(GraphNorm(out_dim, **norm_kwargs))
elif normalization == "layer":
self.norm_layers.append(LayerNorm(out_dim, **norm_kwargs))
if self.norm_layers is not None:
if normalization == "graph":
self.norm_layers.append(GraphNorm(out_dim, **norm_kwargs))
elif normalization == "layer":
self.norm_layers.append(LayerNorm(out_dim, **norm_kwargs))

def forward(self, inputs: torch.Tensor, g: dgl.Graph | None = None) -> torch.Tensor:
"""Applies all layers in turn.
3 changes: 3 additions & 0 deletions tests/layers/test_bond.py
Original file line number Diff line number Diff line change
@@ -42,6 +42,9 @@ def test_exp_normal(self, graph_MoS, graph_CO):
bond_basis = bond_expansion(g1.edata["bond_dist"])
assert bond_basis.shape == (28, 9)

bond_basis = bond_expansion(g2.edata["bond_dist"])
assert bond_basis.shape == (2, 9)

def test_exception(self):
with pytest.raises(ValueError, match="Undefined rbf_type"):
BondExpansion(rbf_type="nonsense")