amep.evaluate.Psi6dist#

class amep.evaluate.Psi6dist(traj, skip=0.0, nav=10, nbins=None, ptype=None, other=None, **kwargs)#

Bases: BaseEvaluation

Distribution of the hexagonal order parameter.

__init__(traj, skip=0.0, nav=10, nbins=None, ptype=None, other=None, **kwargs) None#

Calculate the distribution of the \(\Psi_6\).

\(\Psi_6\) is the magnitude of the hexagonal order parameter. Average over several frames (= time average).

Notes

The hexagonal order parameter is defined by

\[\Psi_6(\vec{r}_j) = \frac{1}{6} \sum_{n=1}^6\exp(i6\theta_{jn}),\]

where the sum goes of the six nearest neighbors of the particle at position \(\vec{r}_j\). The value of \(\theta_{jn}\) is equal to the angle between the connection line from \(\vec{r}_j\) to \(\vec{r}_n\) and the x axis. See also Refs. [1] [2] [3] for further information.

References:

Parameters:
  • traj (Traj) – Trajectory object.

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

  • nav (int, optional) – Number of frames to use for the average. The default is 10.

  • nbins (int, optional) – Number of bins. The default is None.

  • ptype (float, optional) – Particle type. If None, all particles are used. The default is None.

  • other (float, optional) – Other particles. These are the ones which are counted as neighbors. If None, ptypes is used. The default is None.

  • **kwargs – Other keyword arguments are forwarded to amep.order.psi_k().

Return type:

None.

Examples

>>> import amep
>>> traj = amep.load.traj("../examples/data/lammps.h5amep")
>>> p6d = amep.evaluate.Psi6dist(
...     traj, skip=0.9, nav=2, pbc=True
... )
>>> p6d.save("./eval/p6d.h5")
>>> fig, axs = amep.plot.new()
>>> axs.plot(p6d.psi6, p6d.avg)
>>> axs.set_xlabel(r"$\psi_6$")
>>> axs.set_ylabel(r"$p(\psi_6)$")
>>> fig.savefig("./figures/evaluate/evaluate-Psi6dist.png")
../_images/evaluate-Psi6dist.png

Methods

__init__(traj[, skip, nav, nbins, ptype, other])

Calculate the distribution of the \(\Psi_6\).

items()

keys()

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

Stores the evaluation result in an HDF5 file.

values()

Attributes

avg

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

frames

Psi6dist for each frame.

indices

Indices of all frames for which the Psi6dist has been evaluated.

name

psi6

Hexagonal order parameters.

times

Times at which the Psi6dist is evaluated.

property avg#

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

Returns:

Time-averaged Psi6dist.

Return type:

various

property frames#

Psi6dist for each frame.

Returns:

Psi6dist for each frame.

Return type:

np.ndarray

property indices#

Indices of all frames for which the Psi6dist has been evaluated.

Returns:

Frame indices.

Return type:

np.ndarray

property psi6#

Hexagonal order parameters.

Returns:

Hexagonal order parameters.

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.

property times#

Times at which the Psi6dist is evaluated.

Returns:

Times at which the Psi6dist is evaluated.

Return type:

np.ndarray