Expose HostGuest* host and guest via OEMol if openeye is installed
@@ -69,6 +69,31 @@ DEFAULT_SWITCH_WIDTH = 1.5 * unit.angstroms # default switch width
# SUBROUTINES
#=============================================================================================
+def _read_oemol(filename):
+ """Retrieve a molecule from a file as an OpenEye OEMol.
+
+ This will raise an exception if the OpenEye toolkit is not installed or licensed.
+
+ Parameters
+ ----------
+ filename : str
+ Filename to read from, either absolute path or in data directory.
+
+ Returns
+ -------
+ molecule : openeye.oechem.OEMol
+ The molecule
+ """
+ if not os.path.exists(filename):
+ filename = get_data_filename(filename)
+
+ from openeye import oechem
+ ifs = oechem.oemolistream(filename)
+ mol = oechem.OEGraphMol()
+ oechem.OEReadMolecule(ifs, mol)
+ ifs.close()
+ return mol
+
def unwrap_py2(func):
"""Unwrap a wrapped function.
The function inspect.unwrap has been implemented only in Python 3.4. With
@@ -3610,7 +3635,24 @@ class TolueneImplicitGBn2(TolueneImplicit):
# Host-guest in vacuum
#=============================================================================================
-class HostGuestVacuum(TestSystem):
+class _HostGuestBase(object):
+
+ @property
+ def oemols(self):
+ """List of OpenEye ``OEMol``s contained in the system."""
+ return [self.host_oemol, self.guest_oemol]
+
+ @property
+ def host_oemol(self):
+ """OpenEye ``OEMol`` for the host."""
+ return _read_oemol("data/cb7-b2/cb7_tripos.mol2")
+
+ @property
+ def guest_oemol(self):
+ """OpenEye ``OEMol`` for the guest."""
+ return _read_oemol("data/cb7-b2/b2_tripos.mol2")
+
+class HostGuestVacuum(TestSystem, _HostGuestBase):
"""CB7:B2 host-guest system in vacuum.
@@ -3652,7 +3694,7 @@ class HostGuestVacuum(TestSystem):
# Host guest system in implicit solvent.
#=============================================================================================
-class HostGuestImplicit(TestSystem):
+class HostGuestImplicit(TestSystem, _HostGuestBase):
"""CB7:B2 host-guest system implicit solvent.
@@ -3724,7 +3766,7 @@ class HostGuestImplicitGBn2(HostGuestImplicit):
# Host-guest system in explicit solvent
#=============================================================================================
-class HostGuestExplicit(TestSystem):
+class HostGuestExplicit(TestSystem, _HostGuestBase):
"""CB7:B2 host-guest system in TIP3P explicit solvent.
