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

Cherry-pick roitberg-group#23 #544

Merged
merged 1 commit into from
Nov 13, 2020
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
2 changes: 1 addition & 1 deletion torchani/nn.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class SpeciesConverter(torch.nn.Module):

def __init__(self, species):
super().__init__()
rev_idx = {s: k for k, s in enumerate(utils.PERIODIC_TABLE, 1)}
rev_idx = {s: k for k, s in enumerate(utils.PERIODIC_TABLE)}
maxidx = max(rev_idx.values())
self.register_buffer('conv_tensor', torch.full((maxidx + 2,), -1, dtype=torch.long))
for i, s in enumerate(species):
Expand Down
5 changes: 4 additions & 1 deletion torchani/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,10 @@ def get_atomic_masses(species):
return masses


PERIODIC_TABLE = """
# This constant, when indexed with the corresponding atomic number, gives the
# element associated with it. Note that there is no element with atomic number
# 0, so 'Dummy' returned in this case.
PERIODIC_TABLE = ['Dummy'] + """
H He
Li Be B C N O F Ne
Na Mg Al Si P S Cl Ar
Expand Down