Unverified Commit 30f4ec4e authored by Gao, Xiang's avatar Gao, Xiang Committed by GitHub
Browse files

Fix periodic table (#23) (#544)



* Change 0th index of periodic table

* Change species converter to reflect new convention

* Change None for 'Dummy' and fix flake8
Co-authored-by: default avatarIgnacio Pickering <ign.pickering@gmail.com>
parent d47f39c0
...@@ -125,7 +125,7 @@ class SpeciesConverter(torch.nn.Module): ...@@ -125,7 +125,7 @@ class SpeciesConverter(torch.nn.Module):
def __init__(self, species): def __init__(self, species):
super().__init__() 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()) maxidx = max(rev_idx.values())
self.register_buffer('conv_tensor', torch.full((maxidx + 2,), -1, dtype=torch.long)) self.register_buffer('conv_tensor', torch.full((maxidx + 2,), -1, dtype=torch.long))
for i, s in enumerate(species): for i, s in enumerate(species):
......
...@@ -376,7 +376,10 @@ def get_atomic_masses(species): ...@@ -376,7 +376,10 @@ def get_atomic_masses(species):
return masses 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 H He
Li Be B C N O F Ne Li Be B C N O F Ne
Na Mg Al Si P S Cl Ar Na Mg Al Si P S Cl Ar
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment