pymatgen.optimization package — pymatgen 2026.3.9 documentation

# pymatgen.optimization package

Optimization utilities.

## Submodules

## pymatgen.optimization.neighbors module

find_points_in_spheres(all_coords, center_coords, r, pbc, lattice, tol=1e-08, min_r=1.0)

  For each point in center_coords, get all the neighboring points in all_coords that are within the cutoff radius r. All the coordinates should be Cartesian.

  Parameters:

    - all_coords – (np.ndarray[double, dim=2]) all available points. When periodic boundary is considered, this is all the points in the lattice.

    - center_coords – (np.ndarray[double, dim=2]) all centering points

    - r – (float) cutoff radius

    - pbc – (np.ndarray[np.int64_t, dim=1]) whether to set periodic boundaries

    - lattice – (np.ndarray[double, dim=2]) 3x3 lattice matrix

    - tol – (float) numerical tolerance

    - min_r – (float) minimal cutoff to calculate the neighbor list directly. If the cutoff is less than this value, the algorithm will calculate neighbor list using min_r as cutoff and discard those that have larger distances.

  Returns:

    Indexes of center_coords. index2 (n, ): Indexes of all_coords that form the neighbor pair. offset_vectors (n, 3): The periodic image offsets for all_coords. distances (n, ).

  Return type:

    index1 (n, )