Skip to content

Commit

Permalink
fix duplicated (1/r) terms
Browse files Browse the repository at this point in the history
  • Loading branch information
wiederm committed Sep 14, 2024
1 parent b383625 commit 6e70893
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions modelforge/potential/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,9 +495,8 @@ def forward(self, data: Dict[str, torch.Tensor]) -> Dict[str, torch.Tensor]:
coulomb_interactions = (
(per_atom_charge[idx_i] * per_atom_charge[idx_j])
* chi_r
/ pairwise_distances
)

# 138.96 in kj/mol nm
# Zero out diagonal terms (self-interaction)
mask = torch.eye(
coulomb_interactions.size(0), device=coulomb_interactions.device
Expand All @@ -506,7 +505,6 @@ def forward(self, data: Dict[str, torch.Tensor]) -> Dict[str, torch.Tensor]:

# Sum over all interactions for each atom
coulomb_interactions_per_atom = coulomb_interactions.sum(dim=1)

data["per_atom_electrostatic_energy"] = coulomb_interactions_per_atom

return data

0 comments on commit 6e70893

Please sign in to comment.