mirror of
https://github.com/OpenFreeEnergy/openfe.git
synced 2026-06-04 14:14:22 +08:00
Merge pull request #690 from OpenFreeEnergy/tokenizable_atom_mappers
Tokenizable atom mappers
This commit is contained in:
@@ -23,6 +23,17 @@ class TestAtomMapper:
|
||||
def __init__(self, mappings):
|
||||
self.mappings = mappings
|
||||
|
||||
@classmethod
|
||||
def _defaults(cls):
|
||||
return {}
|
||||
|
||||
def _to_dict(self):
|
||||
return {'mappings': self.mappings}
|
||||
|
||||
@classmethod
|
||||
def _from_dict(cls, dct):
|
||||
return cls(**dct)
|
||||
|
||||
def _mappings_generator(self, componentA, componentB):
|
||||
for mapping in self.mappings:
|
||||
yield mapping.componentA_to_componentB
|
||||
|
||||
@@ -10,6 +10,17 @@ from ..conftest import mol_from_smiles
|
||||
|
||||
|
||||
class BadMapper(openfe.setup.atom_mapping.LigandAtomMapper):
|
||||
@classmethod
|
||||
def _defaults(cls):
|
||||
return {}
|
||||
|
||||
def _to_dict(self):
|
||||
return {}
|
||||
|
||||
@classmethod
|
||||
def _from_dict(cls, d):
|
||||
return cls()
|
||||
|
||||
def _mappings_generator(self, molA, molB):
|
||||
yield {0: 0}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user