Commit 9d47bce4 authored by pjropp's avatar pjropp

Updating `get_distance_to_another_molecule`

parent 367b4969
......@@ -1733,9 +1733,36 @@ 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.
......@@ -1754,7 +1781,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
)
......
......@@ -266,7 +266,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
......
......@@ -374,14 +374,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))))
......
......@@ -83,16 +83,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