amep.utils.sq_from_sf2d#

amep.utils.sq_from_sf2d(S: ndarray, Qx: ndarray, Qy: ndarray) tuple[ndarray, ndarray]#

Calculates the isotropic static structure factor from the two-dimensional static structure factor by making a spherical average/radial mean.

Parameters:
  • S (np.ndarray) – 2D static structure factor.

  • Qx (np.ndarray) – x-components of the k vectors (same shape as S; meshgrid).

  • Qy (np.ndarray) – y-components of the k vectors (same shape as S; meshgrid).

Returns:

  • sq (np.ndarray) – Isotropic static structure factor.

  • q (np.ndarray) – Wave numbers.

Examples

>>> import amep
>>> traj = amep.load.traj("../examples/data/lammps.h5amep")
>>> frame = traj[-1]
>>> S, Kx, Ky = amep.spatialcor.sf2d(frame.coords(), frame.box)
>>> Sq, q = amep.utils.sq_from_sf2d(S, Kx, Ky)
>>> fig, axs = amep.plot.new()
>>> axs.plot(q, Sq)
>>> axs.axhline(0.0, ls='--', c='k')
>>> axs.set_xlabel(r'$q$')
>>> axs.set_ylabel(r'$S(q)$')
>>> axs.set_ylim(-1, 10)
>>> fig.savefig('./figures/utils/utils-sq_from_sf2d.png')
>>>
../_images/utils-sq_from_sf2d.png