Skip to content

Commit 36832c6

Browse files
committed
small documentation modification
1 parent cd2d10f commit 36832c6

File tree

5 files changed

+19
-18
lines changed

5 files changed

+19
-18
lines changed

doc/source/api/data.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ Molecule Features
127127
Element Constants
128128
-----------------
129129

130-
Element constants are provided for convenient manipulating of atom types. The atomic
130+
Element constants are provided for convenient manipulation of atom types. The atomic
131131
numbers can be accessed by uppercased element names at the root of the package. For
132132
example, we can get the carbon scaffold of a molecule with the following code.
133133

doc/source/api/layers.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
torchdrug.layers
22
================
33

4+
.. currentmodule:: torchdrug.layers
5+
46
Common Layers
57
-------------
68

7-
.. currentmodule:: torchdrug.layers
8-
99
GaussianSmearing
1010
^^^^^^^^^^^^^^^^
1111
.. autoclass:: GaussianSmearing

doc/source/api/models.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ torchdrug.models
33

44
.. currentmodule:: torchdrug.models
55

6-
Knowledge Graph Embedding
7-
-------------------------
6+
Knowledge Graph Reasoning Models
7+
--------------------------------
88

99
TransE
1010
^^^^^^
@@ -102,8 +102,8 @@ SchNet
102102
.. autoclass:: SchNet
103103
:members:
104104

105-
Normalizing Flow
106-
----------------
105+
Normalizing Flows
106+
-----------------
107107

108108
GraphAutoregressiveFlow
109109
^^^^^^^^^^^^^^^^^^^^^^^

torchdrug/data/constant.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
module = sys.modules[__name__]
44

5+
# orderd by perodic table
56
ATOM_NAME = ["Null",
67
"Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine",
78
"Neon", "Sodium", "Magnesium", "Aluminium", "Silicon", "Phosphorus", "Sulfur", "Chlorine", "Argon",

torchdrug/data/feature.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from torchdrug.core import Registry as R
77

88

9+
# orderd by perodic table
910
atom_vocab = ["H", "B", "C", "N", "O", "F", "Mg", "Si", "P", "S", "Cl", "Cu", "Zn", "Se", "Br", "Sn", "I"]
1011
atom_vocab = {a: i for i, a in enumerate(atom_vocab)}
1112
degree_vocab = range(7)
@@ -45,7 +46,6 @@ def onehot(x, vocab, allow_unknown=False):
4546
return feature
4647

4748

48-
# TODO: this one is too slow
4949
@R.register("features.atom.default")
5050
def atom_default(atom):
5151
"""Default atom feature.
@@ -68,8 +68,6 @@ def atom_default(atom):
6868
GetIsAromatic(): whether the atom is aromatic
6969
7070
IsInRing(): whether the atom is in a ring
71-
72-
atom_position(): the 3D position of the atom
7371
"""
7472
return onehot(atom.GetSymbol(), atom_vocab, allow_unknown=True) + \
7573
onehot(atom.GetChiralTag(), chiral_tag_vocab) + \
@@ -78,8 +76,7 @@ def atom_default(atom):
7876
onehot(atom.GetTotalNumHs(), num_hs_vocab) + \
7977
onehot(atom.GetNumRadicalElectrons(), num_radical_vocab) + \
8078
onehot(atom.GetHybridization(), hybridization_vocab) + \
81-
[atom.GetIsAromatic(), atom.IsInRing()] + \
82-
atom_position(atom)
79+
[atom.GetIsAromatic(), atom.IsInRing()]
8380

8481

8582
@R.register("features.atom.center_identification")
@@ -192,8 +189,10 @@ def atom_property_prediction(atom):
192189
@R.register("features.atom.position")
193190
def atom_position(atom):
194191
"""
195-
Atom position.
192+
Atom position in the molecular conformation.
196193
Return 3D position if available, otherwise 2D position is returned.
194+
195+
Note it takes much time to compute the conformation for large molecules.
197196
"""
198197
mol = atom.GetOwningMol()
199198
if mol.GetNumConformers() == 0:
@@ -228,19 +227,20 @@ def bond_default(bond):
228227
GetStereo(): one-hot embedding for the stereo configuration of the bond
229228
230229
GetIsConjugated(): whether the bond is considered to be conjugated
231-
232-
bond_length: the length of the bond
233230
"""
234231
return onehot(bond.GetBondType(), bond_type_vocab) + \
235232
onehot(bond.GetBondDir(), bond_dir_vocab) + \
236233
onehot(bond.GetStereo(), bond_stereo_vocab) + \
237-
[int(bond.GetIsConjugated())] + \
238-
bond_length(bond)
234+
[int(bond.GetIsConjugated())]
239235

240236

241237
@R.register("features.bond.length")
242238
def bond_length(bond):
243-
"""Bond length"""
239+
"""
240+
Bond length in the molecular conformation.
241+
242+
Note it takes much time to compute the conformation for large molecules.
243+
"""
244244
mol = bond.GetOwningMol()
245245
if mol.GetNumConformers() == 0:
246246
mol.Compute2DCoords()

0 commit comments

Comments
 (0)