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

Fix edge ordering #34

Merged
merged 9 commits into from
Mar 22, 2023
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
6 changes: 3 additions & 3 deletions .github/workflows/gh-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ jobs:
# broken OpenMM build for Mac on 3.10
- os: "macOS-latest"
python-version: "3.10"
- os: "macOS-latest"
python-version: "3.9"
include-dgl: false
# - os: "macOS-latest"
# python-version: "3.9"
# include-dgl: false


steps:
Expand Down
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,25 @@ The rules for this file:
- @lilyminium

### Reviewers
- @mattwthompson
-

### Added
- `GNNModel.save` function (PR #29)

### Fixed
<!-- Bug fixes -->
- Fix edge ordering in NXMol graph (Issue #28, PR #34)

## v0.2.1

### Authors
<!-- GitHub usernames of contributors to this release -->
- @lilyminium

### Reviewers
- @mattwthompson

### Added
- `GNNModel.load` function (PR #26)
- `convolution_dropout` and `readout_dropout` keywords to GNNModel (PR #26)

Expand Down
9 changes: 8 additions & 1 deletion openff/nagl/molecule/_graph/_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,14 @@ def number_of_nodes(self):

def in_edges(self, nodes, form="uv"):
u, v, i = self._all_edges()
mask = [x in nodes for x in v]
# mask = [x in nodes for x in v]

mask = []
for node in nodes:
for i_, v_ in enumerate(v):
if v_ == node:
mask.append(i_)

U, V, I = u[mask], v[mask], i[mask]

if form == "uv":
Expand Down
14 changes: 14 additions & 0 deletions openff/nagl/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,17 @@ def openff_carboxylate():
from openff.toolkit.topology.molecule import Molecule

return Molecule.from_mapped_smiles("[H:1][C:2](=[O:3])[O-:4]")


@pytest.fixture()
def openff_ccnco():
from openff.toolkit.topology.molecule import Molecule

return Molecule.from_mapped_smiles("[H:6][C:1]([H:7])([H:8])[C:2]([H:9])([H:10])[N:3]([H:11])[C:4]([H:12])([H:13])[O:5][H:14]")


@pytest.fixture()
def openff_cnc():
from openff.toolkit.topology.molecule import Molecule

return Molecule.from_mapped_smiles("[H:4][C:1]([H:5])([H:6])[N:2]([H:7])[C:3]([H:8])([H:9])[H:10]")
14 changes: 14 additions & 0 deletions openff/nagl/tests/data/example_am1bcc_sage_charges/C#N.sdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

-OEChem-03222312172D

3 2 0 0 0 0 0 0 0999 V2000
0.0000 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1.0000 0.0000 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0
-0.7500 0.0000 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
1 2 3 0 0 0 0
1 3 1 0 0 0 0
M END
> <atom.dprop.PartialCharge>
0.299528 -0.437890 0.138363

$$$$
27 changes: 27 additions & 0 deletions openff/nagl/tests/data/example_am1bcc_sage_charges/C1CC1.sdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

-OEChem-03222312172D

9 9 0 0 0 0 0 0 0999 V2000
0.0000 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1.0000 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.5000 0.8682 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.1300 -0.7387 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.7050 0.2560 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
1.7050 0.2560 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
1.1300 -0.7387 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.0747 1.3501 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
1.0747 1.3501 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
1 3 1 0 0 0 0
1 2 1 0 0 0 0
2 3 1 0 0 0 0
1 4 1 0 0 0 0
1 5 1 0 0 0 0
2 6 1 0 0 0 0
2 7 1 0 0 0 0
3 8 1 0 0 0 0
3 9 1 0 0 0 0
M END
> <atom.dprop.PartialCharge>
-0.136480 -0.136480 -0.136480 0.068240 0.068240 0.068240 0.068240 0.068240 0.068240

$$$$
33 changes: 33 additions & 0 deletions openff/nagl/tests/data/example_am1bcc_sage_charges/C1CCC1.sdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

-OEChem-03222312172D

12 12 0 0 0 0 0 0 0999 V2000
0.0000 1.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.0000 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1.0000 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1.0000 1.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.7500 1.0000 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.0000 1.7500 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.0000 -0.7500 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.7500 0.0000 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
1.7500 0.0000 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
1.0000 -0.7500 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
1.0000 1.7500 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
1.7500 1.0000 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
1 4 1 0 0 0 0
1 2 1 0 0 0 0
2 3 1 0 0 0 0
3 4 1 0 0 0 0
1 5 1 0 0 0 0
1 6 1 0 0 0 0
2 7 1 0 0 0 0
2 8 1 0 0 0 0
3 9 1 0 0 0 0
3 10 1 0 0 0 0
4 11 1 0 0 0 0
4 12 1 0 0 0 0
M END
> <atom.dprop.PartialCharge>
-0.094868 -0.094868 -0.094868 -0.094868 0.047434 0.047434 0.047434 0.047434 0.047434 0.047434 0.047434 0.047434

$$$$
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

-OEChem-03222312172D

16 16 0 0 0 0 0 0 0999 V2000
0.8674 0.4976 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.8674 1.5027 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.0000 2.0102 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0
-0.8674 1.5027 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.7349 2.0002 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
-0.8674 0.4976 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.0000 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1.6061 0.6272 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
1.1226 -0.2076 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
1.1266 2.2065 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
1.6058 1.3710 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.0000 2.7602 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-1.1226 -0.2076 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-1.6061 0.6272 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
0.4816 -0.5750 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.4816 -0.5750 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
1 7 1 0 0 0 0
1 2 1 0 0 0 0
2 3 1 0 0 0 0
3 4 1 0 0 0 0
4 5 2 0 0 0 0
4 6 1 0 0 0 0
6 7 1 0 0 0 0
1 8 1 0 0 0 0
1 9 1 0 0 0 0
2 10 1 0 0 0 0
2 11 1 0 0 0 0
3 12 1 0 0 0 0
6 13 1 0 0 0 0
6 14 1 0 0 0 0
7 15 1 0 0 0 0
7 16 1 0 0 0 0
M END
> <atom.dprop.PartialCharge>
-0.096102 0.100700 -0.573760 0.694888 -0.654050 -0.146955 -0.077452 0.052578 0.052578 0.037306 0.037306 0.319356 0.075585 0.075585 0.051219 0.051219

$$$$
37 changes: 37 additions & 0 deletions openff/nagl/tests/data/example_am1bcc_sage_charges/C1CNCC1.sdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

-OEChem-03222312172D

14 14 0 0 0 0 0 0 0999 V2000
0.0000 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.3065 0.9519 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.5007 1.5426 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0
1.3131 0.9519 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1.0014 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.0777 -0.7460 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.7339 -0.1546 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.9919 0.6473 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.6824 1.6009 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
0.4996 2.2926 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
1.6888 1.6010 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
1.9978 0.6457 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
1.7348 -0.1571 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
0.9224 -0.7458 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
1 5 1 0 0 0 0
1 2 1 0 0 0 0
2 3 1 0 0 0 0
3 4 1 0 0 0 0
4 5 1 0 0 0 0
1 6 1 0 0 0 0
1 7 1 0 0 0 0
2 8 1 0 0 0 0
2 9 1 0 0 0 0
3 10 1 0 0 0 0
4 11 1 0 0 0 0
4 12 1 0 0 0 0
5 13 1 0 0 0 0
5 14 1 0 0 0 0
M END
> <atom.dprop.PartialCharge>
-0.094856 0.147007 -0.807302 0.147007 -0.094856 0.046052 0.046052 0.040568 0.040568 0.356520 0.040568 0.040568 0.046052 0.046052

$$$$
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@

-OEChem-03222312172D

50 50 0 1 0 0 0 0 0999 V2000
-7.7927 0.4827 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-7.7898 -0.5173 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-8.6544 -1.0198 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-9.5190 -1.5223 0.0000 N 0 3 0 0 0 0 0 0 0 0 0 0
-9.5161 -2.5223 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
-10.3864 -1.0248 0.0000 O 0 5 0 0 0 0 0 0 0 0 0 0
-6.9223 -1.0148 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0
-6.0578 -0.5123 0.0000 C 0 0 1 0 0 0 0 0 0 0 0 0
-6.5603 0.3523 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-5.1932 -0.0098 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-4.3286 0.4927 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-3.4640 0.9952 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-2.5994 1.4977 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.7349 2.0002 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0
-0.8674 1.5027 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.8674 0.4976 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.0000 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.8674 0.4976 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1.7327 -0.0036 0.0000 N 0 3 0 0 0 0 0 0 0 0 0 0
1.7313 -1.0036 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
2.5994 0.4952 0.0000 O 0 5 0 0 0 0 0 0 0 0 0 0
0.8674 1.5027 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.0000 2.0102 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.0000 3.0102 0.0000 N 0 3 0 0 0 0 0 0 0 0 0 0
1.0000 3.0102 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
0.0000 4.0102 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
-5.5553 -1.3769 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-4.5553 -1.3740 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
-6.0527 -2.2443 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
-7.1443 0.8596 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-8.4433 0.8558 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-9.0312 -0.3714 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-8.2775 -1.6682 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-6.9202 -1.7648 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-4.8163 -0.6582 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-5.5700 0.6386 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-3.9517 -0.1557 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-4.7055 1.1411 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-3.0871 0.3468 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-3.8409 1.6436 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-2.2226 0.8493 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-2.9763 2.1461 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-1.7370 2.7502 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-1.5164 0.1217 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.0000 -0.7500 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
1.5180 1.8758 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.7500 3.0102 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
1.3750 3.6597 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
0.6495 4.3852 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-5.6759 -2.8928 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
1 2 2 0 0 0 0
2 3 1 0 0 0 0
3 4 1 0 0 0 0
4 5 2 0 0 0 0
4 6 1 0 0 0 0
2 7 1 0 0 0 0
7 8 1 0 0 0 0
8 9 1 6 0 0 0
8 10 1 0 0 0 0
10 11 1 0 0 0 0
11 12 1 0 0 0 0
12 13 1 0 0 0 0
13 14 1 0 0 0 0
14 15 1 0 0 0 0
15 23 2 0 0 0 0
15 16 1 0 0 0 0
16 17 2 0 0 0 0
17 18 1 0 0 0 0
18 19 1 0 0 0 0
19 20 2 0 0 0 0
19 21 1 0 0 0 0
18 22 2 0 0 0 0
22 23 1 0 0 0 0
23 24 1 0 0 0 0
24 25 1 0 0 0 0
24 26 1 0 0 0 0
8 27 1 0 0 0 0
27 28 2 0 0 0 0
27 29 1 0 0 0 0
1 30 1 0 0 0 0
1 31 1 0 0 0 0
3 32 1 0 0 0 0
3 33 1 0 0 0 0
7 34 1 0 0 0 0
10 35 1 0 0 0 0
10 36 1 0 0 0 0
11 37 1 0 0 0 0
11 38 1 0 0 0 0
12 39 1 0 0 0 0
12 40 1 0 0 0 0
13 41 1 0 0 0 0
13 42 1 0 0 0 0
14 43 1 0 0 0 0
16 44 1 0 0 0 0
17 45 1 0 0 0 0
22 46 1 0 0 0 0
24 47 1 0 0 0 0
25 48 1 0 0 0 0
26 49 1 0 0 0 0
29 50 1 0 0 0 0
M CHG 5 4 1 6 -1 19 1 21 -1 24 1
M END
> <atom.dprop.PartialCharge>
-0.145565 0.052631 -0.024285 0.235461 -0.181124 -0.181124 -0.729195 0.179873 0.101546 -0.089651 -0.078116 -0.093485 0.207505 -0.745512 0.319480 -0.199739 0.046619 -0.220202 0.327581 -0.169637 -0.169637 0.002191 -0.296023 -0.259791 -0.389817 -0.389817 0.630067 -0.521354 -0.583301 0.150995 0.150995 0.118116 0.118116 0.422894 0.077684 0.077684 0.060830 0.060830 0.065409 0.065409 0.065492 0.065492 0.458932 0.182641 0.199426 0.185416 0.388538 0.495482 0.495482 0.458557

$$$$
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

-OEChem-03222312172D

7 6 0 0 0 0 0 0 0999 V2000
0.0000 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1.0000 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1.5000 -0.8660 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
1.5000 0.8660 0.0000 O 0 5 0 0 0 0 0 0 0 0 0 0
-0.0000 -0.7500 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
0.0000 0.7500 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.7500 0.0000 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
1 2 1 0 0 0 0
2 3 2 0 0 0 0
2 4 1 0 0 0 0
1 5 1 0 0 0 0
1 6 1 0 0 0 0
1 7 1 0 0 0 0
M CHG 1 4 -1
M END
> <atom.dprop.PartialCharge>
-0.239300 0.899138 -0.851818 -0.851818 0.014599 0.014599 0.014599

$$$$
24 changes: 24 additions & 0 deletions openff/nagl/tests/data/example_am1bcc_sage_charges/CC(=O)O.sdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

-OEChem-03222312172D

8 7 0 0 0 0 0 0 0999 V2000
0.0000 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1.0000 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1.5000 -0.8660 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
1.5000 0.8660 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
-0.0000 -0.7500 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
0.0000 0.7500 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.7500 0.0000 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
2.2500 0.8660 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
1 2 1 0 0 0 0
2 3 2 0 0 0 0
2 4 1 0 0 0 0
1 5 1 0 0 0 0
1 6 1 0 0 0 0
1 7 1 0 0 0 0
4 8 1 0 0 0 0
M END
> <atom.dprop.PartialCharge>
-0.155042 0.633318 -0.550004 -0.608805 0.078161 0.078161 0.078161 0.446051

$$$$
Loading