pele.mindist.exact_match#
- class pele.mindist.exact_match.StandardClusterAlignment[source]
-
class StandardClusterAlignment:class to iterate over standard alignments for atomic clusters
Quickly determines alignments of clusters which are possible exact matches. It uses atoms which are far away from the center to determine possible rotations. The algorithm does the following:
Get 2 reference atoms from structure 1 which are farthest away from center and are not linear
Determine candidates from structure 2 which are in same shell as reference atoms from structure 1 (+- accuracy)
loop over all candidate combinations to determine orientation and check for match. Skip directly if angle of candidates does not match angle of reference atoms in structure 1.
- Parameters:
- coords1np.array
first coordinates
- coords2np.array
second coordinates
- accuracyfloat
accuracy of shell for atom candidates in standard alignment
- can_invertboolean
is an inversion possible?
Examples
>> for rot, invert in StandardClusterAlignment(X1, X2): >> print “possible rotation:”,rot,”inversion:”,invert
- class pele.mindist.exact_match.ClusterTransoformation[source]
-
class ClusterTransoformation:an object that defines a transformation on a cluster
- class pele.mindist.exact_match.ExactMatchCluster[source]
-
class ExactMatchCluster:Deterministic check if 2 clusters are a perfect match
Determines quickly if 2 clusters are a perfect match. It uses check_standard_alignment_cluster to get possible orientations.
- Parameters:
- accuracy: float, optional
maximum deviation of atoms to still consider cluster as a match
- check_inversion: boolean, optional
check for inversion symmetry, default is True
- permlist: iteratable, optional
list of allowed permutations. Default is None which means all particles can be permuted
- align_com: boolean, optional
Flag if com should be removed before comparison
Examples
>>> x1 = np.random.random(3*natoms) >>> x2 = x1 + 1e-4*np.random.random(x1.shape) >>> matches = ExactClusterMatch(accuracy=1e-3) >>> if match(x1, x2): >>> print "the two structures are identical
- ExactMatchCluster.standard_alignments()[source]
-
def standard_alignments(self, coords1, coords2):return an iterator over the standard alignments
- ExactMatchCluster.__call__()[source]
-
def __call__(self, coords1, coords2, check_inversion=True):return True if the structures are an exact mach, False otherwise
- ExactMatchCluster.find_transformation()[source]
-
def find_transformation(self, coords1, coords2, check_inversion=True):Return None if the two structures are different, else return the transformations that brings them into alignment
- Returns:
- None:
if the two structures are different
- namedtuple:
with fields: rotation, permutation, inversion
- ExactMatchCluster.check_match()[source]
-
def check_match(self, x1, x2, rot, invert):Give a rotation and inversion, make a more detailed comparison if the 2 structures match
- Parameters:
- rot: np.array, 3x3
guessed rotation based on reference atoms
- invert: boolean
True do match for inverted coordinates
- returns: boolean
True or False for match