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 se_r consistency #3366

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions deepmd/dpmodel/descriptor/se_r.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,9 @@
gg = self.cal_g(tr, tt)
gg = np.mean(gg, axis=2)
# nf x nloc x ng x 1
xyz_scatter += gg
xyz_scatter += gg * (self.sel[tt] / self.nnei)

Check warning on line 279 in deepmd/dpmodel/descriptor/se_r.py

View check run for this annotation

Codecov / codecov/patch

deepmd/dpmodel/descriptor/se_r.py#L279

Added line #L279 was not covered by tests

res_rescale = 1.0 / 10.0
res_rescale = 1.0 / 5.0

Check warning on line 281 in deepmd/dpmodel/descriptor/se_r.py

View check run for this annotation

Codecov / codecov/patch

deepmd/dpmodel/descriptor/se_r.py#L281

Added line #L281 was not covered by tests
res = xyz_scatter * res_rescale
res = res.reshape(nf, nloc, -1).astype(GLOBAL_NP_FLOAT_PRECISION)
return res, None, None, None, ww
Expand Down
4 changes: 2 additions & 2 deletions deepmd/pt/model/descriptor/se_r.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,9 @@
# nfnl x nt x ng
gg = ll.forward(ss)
gg = torch.mean(gg, dim=1).unsqueeze(1)
xyz_scatter += gg
xyz_scatter += gg * (self.sel[ii] / self.nnei)

Check warning on line 261 in deepmd/pt/model/descriptor/se_r.py

View check run for this annotation

Codecov / codecov/patch

deepmd/pt/model/descriptor/se_r.py#L261

Added line #L261 was not covered by tests

res_rescale = 1.0 / 10.0
res_rescale = 1.0 / 5.0

Check warning on line 263 in deepmd/pt/model/descriptor/se_r.py

View check run for this annotation

Codecov / codecov/patch

deepmd/pt/model/descriptor/se_r.py#L263

Added line #L263 was not covered by tests
result = xyz_scatter * res_rescale
result = result.view(-1, nloc, self.filter_neuron[-1])
return (
Expand Down
2 changes: 1 addition & 1 deletion source/tests/consistent/descriptor/test_se_e2_a.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def data(self) -> dict:
precision,
) = self.param
return {
"sel": [10, 10],
"sel": [9, 10],
"rcut_smth": 5.80,
"rcut": 6.00,
"neuron": [6, 12, 24],
Expand Down
2 changes: 1 addition & 1 deletion source/tests/consistent/descriptor/test_se_r.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def data(self) -> dict:
precision,
) = self.param
return {
"sel": [10, 10],
"sel": [9, 10],
"rcut_smth": 5.80,
"rcut": 6.00,
"neuron": [6, 12, 24],
Expand Down
Loading