Commit 47b69887 authored by Patrick Ropp's avatar Patrick Ropp

Merge branch '47-get_distance_to_another_molecule-issue' into 'master'

Resolve "get_distance_to_another_molecule issue"

Closes #47

See merge request !17
parents 12906ffa d6f10bd9
......@@ -1738,15 +1738,42 @@ class Molecule: # here's the actual Molecule class
other_mol, tethers
)
def get_distance_to_another_molecule(self, other_molecules,
pairwise_comparison = True):
"""
Computes the minimum distance between any of the atoms of this
molecular model and any of the atoms of a second specified model.
Requires the :any:`numpy` and :any:`scipy<scipy.spatial>` libraries.
Wrapper function for :meth:`~scoria.OtherMolecules.OtherMolecules.get_distance_to_another_molecule`
:param scoria.Molecule other_molecules: a scoria.Molecule, the other molecular
model.
:param bool pairwise_comparison: An optional boolean, whether or not to
perform a simple pairwise distance comparison (if True) or
to use a more sophisitcated method (if False). True by
default.
:returns: A float, the minimum distance between any two atoms of the two
specified molecular models (self and other_molecules).
"""
return self.other_molecules.get_distance_to_another_molecule(
other_molecules, pairwise_comparison
)
def get_distance_to_another_molecules(self, other_molecules,
pairwise_comparison = True):
"""
DEPRECATION WARNING: Please use :meth:`~scoria.Molecule.Molecule.get_distance_to_another_molecule`
Computes the minimum distance between any of the atoms of this
molecular model and any of the atoms of a second specified model.
Requires the :any:`numpy` and :any:`scipy<scipy.spatial>` libraries.
Wrapper function for :meth:`~scoria.OtherMolecules.OtherMolecules.get_distance_to_another_molecules`
Wrapper function for :meth:`~scoria.OtherMolecules.OtherMolecules.get_distance_to_another_molecule`
:param scoria.Molecule other_molecules: a scoria.Molecule, the other molecular
model.
......@@ -1759,7 +1786,7 @@ class Molecule: # here's the actual Molecule class
specified molecular models (self and other_molecules).
"""
return self.other_molecules.get_distance_to_another_molecules(
return self.other_molecules.get_distance_to_another_molecule(
other_molecules, pairwise_comparison
)
......@@ -1822,12 +1849,13 @@ class Molecule: # here's the actual Molecule class
def steric_clash_with_another_molecules(self, other_mol, cutoff,
pairwise_comparison = True):
"""
DEPRECATION WARNING: Please use :meth:`~scoria.Molecule.Molecule.steric_clash_with_another_molecule`
Detects steric clashes between the scoria.Molecule (self) and
another scoria.Molecule.
Requires the :any:`numpy` and :any:`scipy<scipy.spatial>` libraries.
Wrapper function for :meth:`~scoria.OtherMolecules.OtherMolecules.steric_clash_with_another_molecules`
Wrapper function for :meth:`~scoria.OtherMolecules.OtherMolecules.steric_clash_with_another_molecule`
:param scoria.Molecule other_mol: The scoria.Molecule object that will be
evaluated for steric clashes.
......@@ -1842,15 +1870,58 @@ class Molecule: # here's the actual Molecule class
are not.
"""
return self.other_molecules.steric_clash_with_another_molecules(
return self.other_molecules.steric_clash_with_another_molecule(
other_mol, cutoff, pairwise_comparison
)
def steric_clash_with_another_molecule(self, other_mol, cutoff,
pairwise_comparison = True):
"""
Detects steric clashes between the scoria.Molecule (self) and
another scoria.Molecule.
Requires the :any:`numpy` and :any:`scipy<scipy.spatial>` libraries.
Wrapper function for :meth:`~scoria.OtherMolecules.OtherMolecules.steric_clash_with_another_molecule`
:param scoria.Molecule other_mol: The scoria.Molecule object that will be
evaluated for steric clashes.
:param float cutoff: A float, the user-defined distance cutoff in
Angstroms.
:param bool pairwise_comparison: An optional boolean, whether or not to
perform a simple pairwise distance comparison (if True) or
to use a more sophisitcated method (if False). True by
default.
:returns: A boolean. True if steric clashes are present, False if they
are not.
"""
return self.other_molecules.steric_clash_with_another_molecule(
other_mol, cutoff, pairwise_comparison
)
def merge_with_another_molecules(self, other_molecules):
"""
DEPRECATION WARNING: Please use :meth:`~scoria.Molecule.Molecule.merge_with_another_molecule`
Merges two molecular models into a single model.
Wrapper function for :meth:`~scoria.OtherMolecules.OtherMolecules.merge_with_another_molecule`
:param scoria.Molecule other_molecules: A molecular model (scoria.Molecule
object).
:returns: A single scoria.Molecule object containing the atoms of
this model combined with the atoms of other_molecules.
"""
return self.other_molecules.merge_with_another_molecule(other_molecules)
def merge_with_another_molecule(self, other_molecules):
"""
Merges two molecular models into a single model.
Wrapper function for :meth:`~scoria.OtherMolecules.OtherMolecules.merge_with_another_molecules`
Wrapper function for :meth:`~scoria.OtherMolecules.OtherMolecules.merge_with_another_molecule`
:param scoria.Molecule other_molecules: A molecular model (scoria.Molecule
object).
......@@ -1859,7 +1930,7 @@ class Molecule: # here's the actual Molecule class
this model combined with the atoms of other_molecules.
"""
return self.other_molecules.merge_with_another_molecules(other_molecules)
return self.other_molecules.merge_with_another_molecule(other_molecules)
######## Supporting functions ########
......
......@@ -157,7 +157,7 @@ class OtherMolecules():
return new_mol
def steric_clash_with_another_molecules(self, other_mol, cutoff,
def steric_clash_with_another_molecule(self, other_mol, cutoff,
pairwise_comparison = True):
"""
Detects steric clashes between the scoria.Molecule (self) and
......@@ -165,7 +165,7 @@ class OtherMolecules():
Requires the :any:`numpy` and :any:`scipy<scipy.spatial>` libraries.
Wrapper function for :meth:`~scoria.Molecule.Molecule.steric_clash_with_another_molecules`
Wrapper function for :meth:`~scoria.Molecule.Molecule.steric_clash_with_another_molecule`
:param scoria.Molecule other_mol: The scoria.Molecule object that will be
evaluated for steric clashes.
......@@ -206,11 +206,11 @@ class OtherMolecules():
else:
return True
def merge_with_another_molecules(self, other_molecules):
def merge_with_another_molecule(self, other_molecules):
"""
Merges two molecular models into a single model.
Wrapper function for :meth:`~scoria.Molecule.Molecule.merge_with_another_molecules`
Wrapper function for :meth:`~scoria.Molecule.Molecule.merge_with_another_molecule`
:param scoria.Molecule other_molecules: A molecular model (scoria.Molecule
object).
......@@ -277,7 +277,7 @@ class OtherMolecules():
return merged
def get_distance_to_another_molecules(self, other_molecules,
def get_distance_to_another_molecule(self, other_molecules,
pairwise_comparison = True):
"""
Computes the minimum distance between any of the atoms of this
......@@ -285,7 +285,7 @@ class OtherMolecules():
Requires the :any:`numpy` and :any:`scipy<scipy.spatial>` libraries.
Wrapper function for :meth:`~scoria.Molecule.Molecule.get_distance_to_another_molecules`
Wrapper function for :meth:`~scoria.Molecule.Molecule.get_distance_to_another_molecule`
:param scoria.Molecule other_molecules: a scoria.Molecule, the other molecular
model.
......
......@@ -385,14 +385,14 @@ class Test:
mol2.translate_molecule(numpy.array([10.0, 10.0, 10.0]))
# Temporarily commented out because no dumbpy implementation needed.
print(" steric_clash_with_another_molecules()")
print(" steric_clash_with_another_molecule()")
print((" " + str(mol1.steric_clash_with_another_molecules(mol2, 5.0, False))))
print((" " + str(mol1.steric_clash_with_another_molecules(mol2, 5.0, True))))
# Temporarily commented out because no dumbpy implementation needed.
print(" get_distance_to_another_molecules()")
print((" " + str(mol1.get_distance_to_another_molecules(mol2, False))))
print((" " + str(mol1.get_distance_to_another_molecules(mol2, True))))
print(" get_distance_to_another_molecule()")
print((" " + str(mol1.get_distance_to_another_molecule(mol2, False))))
print((" " + str(mol1.get_distance_to_another_molecule(mol2, True))))
print(" get_rmsd_order_dependent()")
print((" " + str(mol1.get_rmsd_order_dependent(mol2))))
......
......@@ -94,16 +94,16 @@ class OtherMoleculeTests(unittest.TestCase):
self.assertEqual(new_mol.get_total_number_of_atoms(), expected_total)
def test_get_distance_to_another_molecules(self):
def test_get_distance_to_another_molecule(self):
"""
Empty test.
"""
expected_distance = 20.0
distance = self.mol.get_distance_to_another_molecules(self.other_mol)
distance = self.mol.get_distance_to_another_molecule(self.other_mol)
self.assertAlmostEqual(expected_distance, distance, self.accuracy)
distance = self.mol.get_distance_to_another_molecules(self.mol)
distance = self.mol.get_distance_to_another_molecule(self.mol)
self.assertAlmostEqual(0.0, distance, self.accuracy)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment