Utility functions

nmrcryspy.utils.coords_with_pbc(idx_1, idx_2, stucture, mic=True)

returns the cartesian coordinates between two sites in a structure while applying periodic boundary conditions.

Parameters:
  • idx_1 – integer index for position 1

  • idx_2 – integer index for position 2

  • structure – pymatgen.Structure object

Returns: np.array, np.array

nmrcryspy.utils.dist_from_coords(coord1, coord2)

Helper function to calculate the distance between two sets of Caretsian coordinates

Parameters:
  • coord1 – np.ndarray coordinates of site 1

  • coord2 – np.ndarray coordinates of site 2

Returns: float

nmrcryspy.utils.get_unique_indicies(structure, full_list=False)

Returns a list of the symmetrically equivalent atoms in a structure.

Parameters:
  • structure – pymatgen.Structure object

  • full_list – boolena flag for whether or not to return the full list of lists if True or just the first member of each list if False.

Returns: list

nmrcryspy.utils.make_distance_data(structure)

Helper function to generate the distance data dictionary

Parameters:

structure – pymatgen.Structure object

Returns: list

nmrcryspy.utils.first_coordination_vertex_vertex(index, equiv_indicies, nn_function, structure)

Function to find of all the atoms in the first coordination sphere of a central atom

Parameters:
  • index – integer index of central atom

  • equiv_indicies – list of symmetrically equivalent atom indicies

  • nn_function – pymatgen.analysis.local_env function

  • structure – pymatgen.Structure object

Returns: list

nmrcryspy.utils.first_coordination_distance(index, equiv_indicies, nn_function, structure)

Function to find atom pairs between a central atom and atoms in the first coordination sphere

Parameters:
  • index – integer index of central atom

  • equiv_indicies – list of symmetrically equivalent atom indicies

  • nn_function – pymatgen.analysis.local_env function

  • structure – pymatgen.Structure object

Returns: list

nmrcryspy.utils.second_coordination_distance(index, equiv_indicies, nn_function, structure)

Function to find atom pairs between a central atom and atoms in the second coordination sphere

Parameters:
  • index – integer index of central atom

  • equiv_indicies – list of symmetrically equivalent atom indicies

  • nn_function – pymatgen.analysis.local_env function

  • structure – pymatgen.Structure object

Returns: list

nmrcryspy.utils.remove_repeat_entries(data_list)

Helper function to remove repeated bonding pairs in the bonding data generation function

Parameters:

data_list – list of data to parse over and remove repeated entries.

Returns: list