Skip to content

Commit

Permalink
add protein as test case
Browse files Browse the repository at this point in the history
  • Loading branch information
lilyminium committed Apr 5, 2024
1 parent 30f961b commit fb239d6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
6 changes: 0 additions & 6 deletions openff/nagl/molecule/_graph/_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,8 @@ 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 = []
# for node in nodes:
# for i_, v_ in enumerate(v):
# if v_ == node:
# mask.append(i_)
# mask = []
for node in nodes:
mask.extend(np.where(v == node)[0])

Expand Down
16 changes: 16 additions & 0 deletions openff/nagl/tests/nn/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,22 @@ def test_load_and_compute(self, smiles):

assert_allclose(computed, desired, atol=1e-5)

def test_protein_computable(self):
"""
Test that working with moderately sized protein
is feasible in time and memory.
See Issue #101
"""
from openff.toolkit import Molecule

model = GNNModel.load(EXAMPLE_AM1BCC_MODEL, eval_mode=True)

protein = Molecule.from_smiles(
"CC[C@H](C)[C@H](NC(=O)CNC(=O)CNC(=O)[C@H](CCC(N)=O)NC(=O)[C@H](CCC(N)=O)NC(=O)[C@H](CC(=O)[O-])NC(=O)[C@H](CC(=O)[O-])NC(=O)[C@H](CCCNC(N)=[NH2+])NC(=O)CNC(=O)[C@H](CS)NC(=O)[C@@H](NC(=O)[C@H](CCCNC(N)=[NH2+])NC(=O)[C@H](Cc1ccccc1)NC(=O)[C@@H](NC(=O)[C@H](CC(N)=O)NC(=O)[C@H](Cc1c[nH]c2ccccc12)NC(=O)[C@H](CC(C)C)NC(=O)CNC(=O)[C@H](CCCNC(N)=[NH2+])NC(=O)[C@H](CCC(=O)[O-])NC(=O)[C@@H](NC(=O)[C@H](Cc1ccccc1)NC(=O)[C@@H](NC(=O)[C@@H]1CCCN1C(=O)[C@H](CC(N)=O)NC(=O)[C@@H](NC(=O)[C@H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O)N1CCC[C@H]1C(=O)N[C@@H](CCCC[NH3+])C(=O)N[C@@H](CC(C)C)C(=O)N1CCC[C@H]1C(=O)NCC(=O)N[C@@H](Cc1ccc(O)cc1)C(=O)N[C@H](C(=O)N[C@@H](CCSC)C(=O)N[C@@H](Cc1ccc(O)cc1)C(=O)N[C@@H](CCC(=O)[O-])C(=O)N[C@@H](Cc1c[nH]c2ccccc12)C(=O)N[C@@H](CCCC[NH3+])C(=O)N[C@@H](CCCC[NH3+])C(=O)NCC(=O)N1CCC[C@H]1C(=O)N[C@@H](CC(=O)[O-])C(=O)NCC(=O)N[C@@H](CCCC[NH3+])C(=O)N[C@@H](Cc1ccccc1)C(=O)N[C@H](C(=O)N[C@@H](Cc1ccc(O)cc1)C(=O)N[C@H](C(=O)N[C@@H](CCC(N)=O)C(=O)N[C@@H](CCC(N)=O)C(=O)NC)[C@@H](C)CC)[C@@H](C)O)C(C)C)[C@@H](C)CC)[C@@H](C)O)C(C)C)C(C)C)[C@@H](C)CC)[C@@H](C)O)C(C)C)[C@@H](C)O)[C@@H](C)O)[C@@H](C)O)C(C)C)[C@@H](C)CC)C(C)C)[C@@H](C)CC)C(C)C)[C@@H](C)CC)[C@@H](C)CC)[C@@H](C)O)[C@@H](C)CC)[C@@H](C)CC)C(C)C)[C@@H](C)CC)C(C)C)C(C)C)C(C)C)[C@@H](C)O)C(C)C)[C@@H](C)O)[C@@H](C)O)[C@@H](C)CC)[C@@H](C)CC)C(C)C"
)
model.compute_property(protein, as_numpy=True)

def test_save(self, am1bcc_model, openff_methane_uncharged, tmpdir, expected_methane_charges):
with tmpdir.as_cwd():
am1bcc_model.save("model.pt")
Expand Down

0 comments on commit fb239d6

Please sign in to comment.