pyextal.potentialMap.analysis ============================= .. py:module:: pyextal.potentialMap.analysis .. autoapi-nested-parse:: Peak shifts, Poisson charge density and line profiles of a map. Classes ------- .. autoapisummary:: pyextal.potentialMap.analysis.PeakShift Functions --------- .. autoapisummary:: pyextal.potentialMap.analysis.find_atom_peaks pyextal.potentialMap.analysis._laplacian_spectral pyextal.potentialMap.analysis.charge_density pyextal.potentialMap.analysis.charge_from_potential pyextal.potentialMap.analysis._periodic_interpolator pyextal.potentialMap.analysis.line_profile pyextal.potentialMap.analysis.integrated_profile Module Contents --------------- .. py:class:: PeakShift A reference-map peak and the refined-map maximum near it. :ivar ref: Grid index of the reference peak. :vartype ref: tuple :ivar refined: Grid index of the refined maximum. :vartype refined: tuple :ivar ref_val, refined_val: Map values there. :vartype ref_val, refined_val: float :ivar shift: Signed index offset, refined minus reference, wrapped to the nearest image. :vartype shift: tuple :ivar distance_A: Length of ``shift`` in Angstrom, through the map's grid steps (right for non-orthogonal axes). :vartype distance_A: float .. py:attribute:: ref :type: tuple .. py:attribute:: refined :type: tuple .. py:attribute:: ref_val :type: float .. py:attribute:: refined_val :type: float .. py:attribute:: shift :type: tuple .. py:attribute:: distance_A :type: float .. py:property:: distance_px Length of ``shift`` in grid steps. .. py:function:: find_atom_peaks(result, threshold_rel=0.5, min_distance=5, search_radius=5) Peaks of the reference map, each paired with the refined maximum nearby. Works on 2D and 3D maps; the grid is periodic. :param result: The maps. :type result: MapResult :param threshold_rel: Keep reference maxima above this fraction of the reference map's maximum. :type threshold_rel: float :param min_distance: Size of the local-maximum filter, in grid steps. :type min_distance: int :param search_radius: Half-width of the window searched in the refined map, in grid steps. :type search_radius: int :returns: list of PeakShift .. py:function:: _laplacian_spectral(volume, steps) Laplacian of a periodic map on a (possibly oblique) uniform grid. .. py:function:: charge_density(volume, steps=None, spacings=None) ``-laplacian(volume)``: the charge density, up to a constant, of a potential. :param volume: Periodic potential map. :type volume: np.ndarray :param steps: (ndim, 3) Cartesian grid steps (`MapResult.steps`). Uses an exact spectral Laplacian, right for oblique axes; result in map units per Angstrom^2. :type steps: np.ndarray, optional :param spacings: Per-axis spacing for the original 3-point finite-difference Laplacian, which assumes orthogonal axes. Used when ``steps`` is None (all 1.0 if both are None). :type spacings: tuple, optional :returns: Same shape as ``volume``. :rtype: np.ndarray .. py:function:: charge_from_potential(result, method='spectral', spacings=None) Converts a potential `MapResult` into charge density by Poisson's equation. :param result: Potential maps. :type result: MapResult :param method: 'spectral' (exact, uses the grid geometry) or 'finite_difference' (the original 3-point stencil with ``spacings``, default 1.0 per axis). :type method: str :param spacings: For 'finite_difference'. :type spacings: tuple, optional :returns: ``kind='charge'``, the maps replaced by ``-laplacian``. :rtype: MapResult .. py:function:: _periodic_interpolator(volume) .. py:function:: line_profile(volume, start, end, num_points=100) Values of a 3D periodic map along a straight line. :param volume: 3D map on a fractional grid. :type volume: np.ndarray :param start: End points in fractional coordinates (any image; wrapped into the cell). :type start: array-like :param end: End points in fractional coordinates (any image; wrapped into the cell). :type end: array-like :param num_points: Samples along the line. :type num_points: int :returns: ``(distance, values)``, the distance in fractional units. :rtype: tuple .. py:function:: integrated_profile(volume, start, end, radius, num_points=100, grid_points=21, lattice=None) A 3D map integrated over discs perpendicular to a line, along that line. :param volume: 3D map on a fractional grid. :type volume: np.ndarray :param start: End points in fractional coordinates. :type start: array-like :param end: End points in fractional coordinates. :type end: array-like :param radius: Disc radius: fractional units, or Angstrom when ``lattice`` is given. :type radius: float :param num_points: Steps along the line. :type num_points: int :param grid_points: Samples across each disc diameter. :type grid_points: int :param lattice: (3, 3) Cartesian lattice vectors. With it the discs are perpendicular, and round, in real space -- needed for a non-cubic cell. Without it they are built in fractional coordinates (the original behaviour). :type lattice: np.ndarray, optional :returns: ``(distance, profile, points)``. ``distance`` along the line (as the radius), ``points`` the fractional sampling positions before wrapping, shape ``(num_points, grid_points, grid_points, 3)``. :rtype: tuple