Skip to content

do not return g2, h2, sw in hybrid descriptors #3396

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

Merged
merged 1 commit into from
Mar 3, 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
8 changes: 1 addition & 7 deletions deepmd/dpmodel/descriptor/hybrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def call(
"""
out_descriptor = []
out_gr = []
out_g2 = []
out_g2 = None
out_h2 = None
out_sw = None
if self.sel_no_mixed_types is not None:
Expand All @@ -199,15 +199,9 @@ def call(
out_descriptor.append(odescriptor)
if gr is not None:
out_gr.append(gr)
if g2 is not None:
out_g2.append(g2)
if self.get_rcut() == descrpt.get_rcut():
out_h2 = h2
out_sw = sw

out_descriptor = np.concatenate(out_descriptor, axis=-1)
out_gr = np.concatenate(out_gr, axis=-2) if out_gr else None
out_g2 = np.concatenate(out_g2, axis=-1) if out_g2 else None
return out_descriptor, out_gr, out_g2, out_h2, out_sw

@classmethod
Expand Down
8 changes: 1 addition & 7 deletions deepmd/pt/model/descriptor/hybrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def forward(
"""
out_descriptor = []
out_gr = []
out_g2 = []
out_g2: Optional[torch.Tensor] = None
out_h2: Optional[torch.Tensor] = None
out_sw: Optional[torch.Tensor] = None
if self.sel_no_mixed_types is not None:
Expand All @@ -225,14 +225,8 @@ def forward(
out_descriptor.append(odescriptor)
if gr is not None:
out_gr.append(gr)
if g2 is not None:
out_g2.append(g2)
if self.get_rcut() == descrpt.get_rcut():
out_h2 = h2
out_sw = sw
out_descriptor = torch.cat(out_descriptor, dim=-1)
out_gr = torch.cat(out_gr, dim=-2) if out_gr else None
out_g2 = torch.cat(out_g2, dim=-1) if out_g2 else None
return out_descriptor, out_gr, out_g2, out_h2, out_sw

@classmethod
Expand Down