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

Clean up unused args #436

Merged
merged 3 commits into from
Apr 1, 2020
Merged
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
7 changes: 3 additions & 4 deletions torchani/aev.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,7 @@ def neighbor_pairs(padding_mask: Tensor, coordinates: Tensor, cell: Tensor,
return molecule_index + atom_index1, molecule_index + atom_index2, shifts


def neighbor_pairs_nopbc(padding_mask: Tensor, coordinates: Tensor, cell: Tensor,
shifts: Tensor, cutoff: float) -> Tuple[Tensor, Tensor, Tensor]:
def neighbor_pairs_nopbc(padding_mask: Tensor, coordinates: Tensor, cutoff: float) -> Tuple[Tensor, Tensor, Tensor]:
"""Compute pairs of atoms that are neighbors (doesn't use PBC)

This function bypasses the calculation of shifts and duplication
Expand Down Expand Up @@ -199,7 +198,7 @@ def neighbor_pairs_nopbc(padding_mask: Tensor, coordinates: Tensor, cell: Tensor
atom_index1 = p1_all[pair_index] + molecule_index
atom_index2 = p2_all[pair_index] + molecule_index
# shifts
shifts = shifts.new_zeros((p1_all.shape[0], 3)).index_select(0, pair_index)
shifts = p1_all.new_zeros((p1_all.shape[0], 3)).index_select(0, pair_index)
return atom_index1, atom_index2, shifts


Expand Down Expand Up @@ -275,7 +274,7 @@ def compute_aev(species: Tensor, coordinates: Tensor, cell: Tensor,
num_species_pairs = angular_length // angular_sublength
# PBC calculation is bypassed if there are no shifts
if shifts.numel() == 0:
atom_index1, atom_index2, shifts = neighbor_pairs_nopbc(species == -1, coordinates, cell, shifts, Rcr)
atom_index1, atom_index2, shifts = neighbor_pairs_nopbc(species == -1, coordinates, Rcr)
else:
atom_index1, atom_index2, shifts = neighbor_pairs(species == -1, coordinates, cell, shifts, Rcr)
coordinates = coordinates.flatten(0, 1)
Expand Down