Skip to content

Commit

Permalink
Little cleanup in so3.py and _so3.py (#231)
Browse files Browse the repository at this point in the history
* model version for Potential class is added

* model version for Potential class is modified

* Enable the smooth version of Spherical Bessel function in TensorNet

* max_n, max_l for SphericalBessel radial basis functions are included in TensorNet class

* adding united tests for improving the coverage score

* little clean up in _so3.py and so3.py
  • Loading branch information
kenko911 authored Feb 20, 2024
1 parent e9383cf commit 1b25a18
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/matgl/layers/_so3.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ def __init__(self, lmax: int):

ls = torch.arange(0, lmax + 1)
nls = 2 * ls + 1
self.lidx = torch.repeat_interleave(ls, nls).cpu()
self.midx = torch.cat([torch.arange(-l_id, l_id + 1) for l_id in ls]).cpu()
self.lidx = torch.repeat_interleave(ls, nls)
self.midx = torch.cat([torch.arange(-l_id, l_id + 1) for l_id in ls])

self.register_buffer("flidx", self.lidx.to(dtype=dtype), False)

Expand Down Expand Up @@ -356,7 +356,6 @@ def __init__(self, n_in: int, lmax: int):
self.n_in = n_in
self.lidx, _ = sh_indices(lmax)
self.scaling = nn.Linear(n_in, n_in * (lmax + 1))
self.lidx = self.lidx.cpu() # added by kenko

def forward(self, x: torch.Tensor) -> torch.Tensor:
s0 = x[:, 0, :]
Expand Down
4 changes: 2 additions & 2 deletions src/matgl/utils/so3.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ def generate_clebsch_gordan(lmax: int) -> torch.Tensor:
"""
lidx, midx = sh_indices(lmax)
cg = torch.zeros((lidx.shape[0], lidx.shape[0], lidx.shape[0]))
lidx = lidx.cpu().numpy()
midx = midx.cpu().numpy()
lidx = lidx.numpy()
midx = midx.numpy()
for c1, (l1, m1) in enumerate(zip(lidx, midx)):
for c2, (l2, m2) in enumerate(zip(lidx, midx)):
for c3, (l3, m3) in enumerate(zip(lidx, midx)):
Expand Down

0 comments on commit 1b25a18

Please sign in to comment.