Skip to content

Commit

Permalink
fix: add rcut check
Browse files Browse the repository at this point in the history
  • Loading branch information
Anyang Peng authored and Anyang Peng committed Jan 26, 2024
1 parent 34b566e commit 7ea3656
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions deepmd_pt/model/model/pair_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ def __init__(
self.tab_info = torch.from_numpy(tab_info)
self.tab_data = torch.from_numpy(tab_data)

if self.tab_info[1] < rcut:
raise ValueError("The tabulation file does not have enough data to cover the cutoff radius.")

# self.model_type = "ener"
# self.model_version = MODEL_VERSION ## this shoud be in the parent class


if isinstance(sel, int):
self.sel = sel
elif isinstance(sel, list):
Expand Down Expand Up @@ -114,7 +116,7 @@ def forward_atomic(

atomic_energy = 0.5 * torch.sum(torch.where(nlist != -1, raw_atomic_energy, torch.zeros_like(raw_atomic_energy)) ,dim=-1)

return {"atomic_energy": atomic_energy}
return {"energy": atomic_energy}

def _pair_tabulated_inter(self, nlist: torch.Tensor,i_type: torch.Tensor, j_type: torch.Tensor, rr: torch.Tensor) -> torch.Tensor:
"""Pairwise tabulated energy.
Expand Down

0 comments on commit 7ea3656

Please sign in to comment.