Geometric functions¶
-
class
nmrcryspy.geometric.Distance_Function(distance_measures: Optional[dict] = None)¶ Bases:
objectDistance_Function class used to calculate the distance and gradients between atoms in the structure.
-
distance_measures¶ deviation of relevant bond distance types. Example: {‘SiO’:{‘mu’: 1.595, ‘sigma’: 0.011}}
- Type:
Dictionary containing mean bond distance and standard
-
assemble_residual_and_grad(structure, data_dictionary)¶ Function to package the Jacobian matrix and residual vector for the Gauss_Newton_Solver class.
- Parameters:
structure – pymatgen.Structure object used to calculate the residual and Jacobian.
data_dictionary – Dict of the data_dictionary attribute from the Gauss_Newton_Solver which contains the ML data.
Returns: np.ndarray, np.array
-
calculate_gradients(idx_1, idx_2, structure, structure_e, epsilon, bond_type, mic=True)¶ Function to calculate the gradient and residual for processing by the assemble_residual_and_grad function.
- Parameters:
idx_1 – integer index of atom 1
idx_2 – integer index of atom 2
structure – pymatgen.Structure
structure_e – pymatgen.Structure perturbed by a translation to one of the coordinates by epsilon.
epsilon – float of the stepsize used for calculating numerical derivatives.
bond_type – string denoting the type of bond
Returns: np.array
-
calculate_residual(idx_1, idx_2, structure, bond_type, mic=True)¶ Function to calculate the gradient and residual for processing by the assemble_residual_and_grad function.
- Parameters:
idx_1 – integer index of atom 1
idx_2 – integer index of atom 2
structure – pymatgen.Structure
bond_type – string denoting the type of bond
Returns: np.array
-
make_symmetry_dictionary(structure)¶ Given the structure, finds the mapping between the atoms in the complete cell and the base atoms. Returns a dictionary where each entry is an atom in the structure, its symmetry operation, and the original atom it is derived from.
- Parameters:
structure – pymatgen.Structure object to derive symmetry dictionary from.
Returns: list
-
perturb_structure(initial_structure, sym_dict, x_prime, epsilon=1e-05)¶ Applies a translation to one of the atom sites for the calculation of numerical derivatives.
- Parameters:
initial_structure – pymatgen.Structure object of the original structure
sym_dict – dictionary of symmetry operation mappings to the atoms in the structure
x_prime – np.ndarray for the perturbation vector.
epsilon – float of the scaling parameter for the perturbation vector.
Returns: pymatgen.Structure
-