amep.utils.domain_length#

amep.utils.domain_length(s_fac: ndarray, q: ndarray, qmin: float | None = None, qmax: float | None = None) float#

Calculate the domain length from the structure factor. Takes the structure factor as a function of the wave numbers as well as the corresponding wave numbers.

Notes

The domain length is defined as

\[L(t) = 2\pi\frac{\int_{q_{\rm min}}^{q_{\rm max}}{\rm d}q\,S(q,t)}{\int_{q_{\rm min}}^{q_{\rm max}}{\rm d}q\,qS(q,t)}\]

and has been used in Refs. [1] [2] [3] [4] for example.

References

Parameters:
  • s_fac (np.ndarray) – structure factor corresponding to the given q-values

  • q (np.ndarray) – The wave number corresponding to the structure factor

  • qmin (float or None, optional) – Lower integration limit. The default is None.

  • qmax (float or None, optional) – Upper integration limit. The default is None.

Returns:

l – Domain length as inverse expectation value of q.

Return type:

float

Examples

>>> import amep
>>> traj = amep.load.traj("../examples/data/continuum.h5amep")
>>> frame = traj[3]
>>> C = frame.data('c')
>>> X, Y = frame.grid
>>> sq2d, qx, qy = amep.continuum.sf2d(C, X, Y)
>>> fig, axs = amep.plot.new(figsize=(3.6,3))
>>> mp = amep.plot.field(axs, C, X, Y)
>>> cax = amep.plot.add_colorbar(
...     fig, axs, mp, label=r'$c(x,y)$'
... )
>>> axs.set_xlabel(r'$x$')
>>> axs.set_ylabel(r'$y$')
>>> fig.savefig('./figures/utils/utils-domain_length_1.png')
>>>
../_images/utils-domain_length_1.png
>>> sq, q = amep.utils.sq_from_sf2d(sq2d, qx, qy)
>>> fig, axs = amep.plot.new()
>>> axs.plot(q[1:], sq[1:])
>>> axs.set_xlabel(r'$q$')
>>> axs.set_ylabel(r'$S(q)$')
>>> fig.savefig('./figures/utils/utils-domain_length_2.png')
>>>
../_images/utils-domain_length_2.png
>>> L = amep.utils.domain_length(sq, q)
>>> print(L)
10.400560044952304
>>>