amep.evaluate.PosOrderCor#

class amep.evaluate.PosOrderCor(traj, grtdata=None, sxydata=None, skip=0.0, nav=10, k0=None, order='hexagonal', dk=4.0, ptype=None, other=None, **kwargs)#

Bases: BaseEvaluation

Positional order correlation function.

__init__(traj, grtdata=None, sxydata=None, skip=0.0, nav=10, k0=None, order='hexagonal', dk=4.0, ptype=None, other=None, **kwargs) None#

Calculate the positional order correlation function.

Based on the pair correlation function g(r,theta).

Notes

The positional order correlation function is defined as

\[C_{\vec{k}_0}(r) = <\exp(i\vec{k}_0\cdot (\vec{r}_j-\vec{r}_l))>\]

with $r=|vec{r}_j-vec{r}_l|$ (see Ref. [1] for further information). As shown in Ref. [2], this can be rewritten as

\[C_{\vec{k}_0}(r) = \int\text{d}\theta\,g(r,\theta) \exp(i\vec{k}_0\cdot\vec{r}) / \int\text{d}\theta\,g(r,\theta).\]

References

Parameters:
  • traj (Traj) – Trajectory object with simulation data.

  • grtdata (pd.DataFrame, optional) – Pair correlation function g(r,theta) as obtained from amep.evaluate.PCFangle. If None, the angular pair correlation function is calculated within this method. The default is None.

  • sxydata (pd.DataFrame, optional) – 2d structure factor as obtained from amep.evaluate.SF2d. If None, the 2d structure factor is calculated within this method. The default is None.

  • skip (float, optional) – Skip this fraction at the beginning of the trajectory. The default is 0.0.

  • nav (int, optional) – Max. number of frames to consider for the time average. The default is 10.

  • k0 (list, optional) – list of k vectors (each has to be a np.ndarray of shape (1,3); the z component is ignored since this version only works for 2D systems). The result will be averaged over these values. The default is None.

  • order (str, optional) – Specifies the order of the system to determine the k vectors if not given by k0. Possible orders: ‘hexagonal’. The default is ‘hexagonal’.

  • dk (float, optional) – Size of the area in k-space around each estimate used for the Gaussian fit to determine the k0 vectors. The default is 4.0.

  • **kwargs – Other keyword arguments are forwarded to amep.evaluate.PCFangle.

Examples

>>> import amep
>>> traj = amep.load.traj("../examples/data/lammps.h5amep")
>>> poscor = amep.evaluate.PosOrderCor(
...     traj, skip=0.9, nav=2
... )
>>> poscor.save("./eval/poscor.h5")
>>> y,x = amep.utils.envelope(poscor.avg, x=poscor.r)
>>> fig, axs = amep.plot.new()
>>> axs.plot(poscor.r, poscor.avg, label="data")
>>> axs.plot(x, y, marker="", ls="--", label="envelope", c="orange")
>>> axs.loglog()
>>> axs.set_xlabel(r"$r$")
>>> axs.set_ylabel(r"$C(r)$")
>>> axs.legend()
>>> fig.savefig("./figures/evaluate/evaluate-PosOrderCor.png")
../_images/evaluate-PosOrderCor.png

Methods

__init__(traj[, grtdata, sxydata, skip, ...])

Calculate the positional order correlation function.

items()

keys()

The keys to the evaluation object.

save(path[, backup, database, name])

Stores the evaluation result in an HDF5 file.

values()

Attributes

avg

Time-averaged PosOrderCor (averaged over the given number of frames).

k0

Reciprocal lattive vectors over which the average has been calculated.

name

r

Distances.

property avg#

Time-averaged PosOrderCor (averaged over the given number of frames).

Returns:

Time-averaged PosOrderCor.

Return type:

np.ndarray

property k0#

Reciprocal lattive vectors over which the average has been calculated.

Returns:

Reciprocal lattices vectors over which to average.

Return type:

list of np.ndarrays of shape (1,3)

keys() list[str]#

The keys to the evaluation object.

Used so Evaluation-objects can be used as dictionaries.

property r#

Distances.

Returns:

Distances.

Return type:

np.ndarray

save(path: str, backup: bool = True, database: bool = False, name: str | None = None) None#

Stores the evaluation result in an HDF5 file.

Parameters:
  • path (str) – Path of the ‘.h5’ file in which the data should be stored. If only a directory is given, the filename is chosen as self.name. Raises an error if the given directory does not exist or if the file extension is not ‘.h5’.

  • backup (bool, optional) – If True, an already existing file is backed up and not overwritten. This keyword is ignored if database=True. The default is True.

  • database (bool, optional) – If True, the results are appended to the given ‘.h5’ file if it already exists. If False, a new file is created and the old is backed up. If False and the given ‘.h5’ file contains multiple evaluation results, an error is raised. In this case, database has to be set to True. The default is False.

  • name (str or None, optional) – Name under which the data should be stored in the HDF5 file. If None, self.name is used. The default is None.

Return type:

None.