pymatgen.optimization package

Optimization utilities.

Submodules

pymatgen.optimization.fast_parser module

parse_n_doubles(file, out, nelem=-1)[source]

Parse doubles from a binary file object into out.

The file is read in 1 MiB chunks. On return, the file position follows the stop pointer returned by the parser without rewinding trailing whitespace.

The file must be a seekable binary stream (the function uses tell()/seek() to leave the cursor right after the last parsed number). Backward seeks on compressed streams (e.g. gzip.GzipFile, bz2.BZ2File) are implemented as decompress-from-start and can be dramatically slower than on uncompressed files; prefer decompressing upstream when parsing large compressed inputs.

Returns:

Parsed element count.

Return type:

int

Raises:
  • TypeError – If file is not a binary stream.

  • ValueError – If nelem exceeds out.shape[0].

pymatgen.optimization.neighbors module

find_points_in_spheres(all_coords: ndarray[Any, dtype[float64]], center_coords: ndarray[Any, dtype[float64]], r: float, pbc: ndarray[Any, dtype[int64]], lattice: ndarray[Any, dtype[float64]], tol: float = Ellipsis, min_r: float = Ellipsis) → tuple[ndarray[Any, dtype[int64]], ndarray[Any, dtype[int64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]][source]