def get_tol(self, specie1, specie2): """ Returns the tolerance between two species. Args: specie1, specie2: the atomic number (int or float), name (str), symbol (str), an Element object, or a pymatgen Specie object Returns: the tolerance between the provided pair of atomic species """ if self.prototype == "single_value": return self.matrix[0][0] index1 = Element.number_from_specie(specie1) index2 = Element.number_from_specie(specie2) if index1 is not None and index2 is not None: return self.matrix[index1][index2] else: return None
def set_tol(self, specie1, specie2, value): """ Sets the distance tolerance between two species. Args: specie1, specie2: the atomic number (int or float), name (str), symbol (str), an Element object, or a pymatgen Specie object value: the tolerance (in Angstroms) to set to """ index1 = Element.number_from_specie(specie1) index2 = Element.number_from_specie(specie2) if index1 is None or index2 is None: return self.matrix[index1][index2] = float(value) if index1 != index2: self.matrix[index2][index1] = float(value) if (index1, index2) not in self.custom_values and ( index2, index1, ) not in self.custom_values: larger = max(index1, index2) smaller = min(index1, index2) self.custom_values.append((smaller, larger))
def __getitem__(self, index): new_index = Element.number_from_specie(index) return self.matrix[index]