rgpycrumbs.eon.pimd_centroid

Centroid and ring-polymer spread from a PIMD bead trajectory.

Added in version 1.12.0.

A path-integral molecular dynamics run carries P replicas (beads) of every atom. This collapses them to one con frame per sampled step: the positions are the centroid over the beads, and the readcon spreads section holds each atom’s root-mean-square displacement from that centroid along x, y and z in Angstrom.

Inputs, either of which may be CPMD TRAJECTORY text (step index, x, y, z, vx, vy, vz per atom, positions in bohr, velocities ignored) or extended xyz (positions in Angstrom); the format is read from the first line:

  • several files, one per replica, with the same number of frames and atoms;

  • one file whose frames hold P x N atoms, replica-major, with --replicas P.

The trajectory carries no cell, masses or fixed flags. --reference (a con file, first frame) supplies symbols, masses, cell and fixed flags; otherwise --symbols (a whitespace-separated list, or xyz symbols) and --cell supply what the frames need.

--time-average averages the centroid over the sampled frames and writes one frame. Its spread combines the imaginary-time spread (rms over frames of the bead spread) and the thermal spread (rms of the centroid about its average) in quadrature, which equals the rms of all beads in all frames about the time-averaged centroid. Both parts are in the frame metadata as spread_imaginary_time_rms and spread_thermal_rms, rms over atoms and components in Angstrom.

Attributes

Functions

_is_xyz(→ bool)

read_xyz(→ tuple[numpy.ndarray, list[str]])

Frames (n_frames, n_atoms, 3) in Angstrom and the symbols.

read_cpmd_trajectory(→ numpy.ndarray)

Frames (n_frames, n_atoms, 3) in Angstrom from a TRAJECTORY.

read_trajectory(→ tuple[numpy.ndarray, list[str] | None])

Positions (n_frames, n_atoms, 3) in Angstrom, plus xyz symbols.

load_replicas(→ tuple[numpy.ndarray, list[str] | None])

Bead positions (P, n_frames, n_atoms, 3) in Angstrom and symbols.

centroid_spread(→ tuple[numpy.ndarray, numpy.ndarray])

Centroid and per-component rms spread, both (n_frames, n_atoms, 3).

time_average(→ tuple[numpy.ndarray, numpy.ndarray, ...)

Average over frames.

_rms(→ float)

_template(reference, symbols, cell, n_atoms)

Per-atom symbol, mass, fixed flags plus cell and angles.

build_frames(positions, spreads, metadata, *[, ...])

readcon frames, one per row of positions (F, N, 3).

collapse(→ tuple[numpy.ndarray, numpy.ndarray, list[dict]])

Positions, spreads and per-frame metadata from bead positions.

main(trajectories, replicas, every, reference, ...)

Write the bead centroid and spread of TRAJECTORIES as a con file.

Module Contents

rgpycrumbs.eon.pimd_centroid.log[source]
rgpycrumbs.eon.pimd_centroid.BOHR_TO_ANGSTROM = 0.529177210544[source]
rgpycrumbs.eon.pimd_centroid._is_xyz(path: pathlib.Path) → bool[source]
rgpycrumbs.eon.pimd_centroid.read_xyz(path: pathlib.Path) → tuple[numpy.ndarray, list[str]][source]

Frames (n_frames, n_atoms, 3) in Angstrom and the symbols.

rgpycrumbs.eon.pimd_centroid.read_cpmd_trajectory(path: pathlib.Path) → numpy.ndarray[source]

Frames (n_frames, n_atoms, 3) in Angstrom from a TRAJECTORY.

A frame is a run of consecutive rows with one step index.

rgpycrumbs.eon.pimd_centroid.read_trajectory(path: pathlib.Path) → tuple[numpy.ndarray, list[str] | None][source]

Positions (n_frames, n_atoms, 3) in Angstrom, plus xyz symbols.

rgpycrumbs.eon.pimd_centroid.load_replicas(paths: list[pathlib.Path], replicas: int | None = None) → tuple[numpy.ndarray, list[str] | None][source]

Bead positions (P, n_frames, n_atoms, 3) in Angstrom and symbols.

One path splits its frames replica-major into replicas beads; several paths are one replica each.

rgpycrumbs.eon.pimd_centroid.centroid_spread(beads: numpy.ndarray) → tuple[numpy.ndarray, numpy.ndarray][source]

Centroid and per-component rms spread, both (n_frames, n_atoms, 3).

rgpycrumbs.eon.pimd_centroid.time_average(centroid: numpy.ndarray, spread: numpy.ndarray) → tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray][source]

Average over frames.

Returns the mean centroid, the total spread, and its imaginary-time and thermal parts, each (n_atoms, 3).

rgpycrumbs.eon.pimd_centroid._rms(a: numpy.ndarray) → float[source]
rgpycrumbs.eon.pimd_centroid._template(reference, symbols, cell, n_atoms)[source]

Per-atom symbol, mass, fixed flags plus cell and angles.

rgpycrumbs.eon.pimd_centroid.build_frames(positions: numpy.ndarray, spreads: numpy.ndarray, metadata: list[dict], *, reference=None, symbols=None, cell=None)[source]

readcon frames, one per row of positions (F, N, 3).

rgpycrumbs.eon.pimd_centroid.collapse(beads: numpy.ndarray, *, every: int = 1, average: bool = False) → tuple[numpy.ndarray, numpy.ndarray, list[dict]][source]

Positions, spreads and per-frame metadata from bead positions.

rgpycrumbs.eon.pimd_centroid.main(trajectories, replicas, every, reference, symbols_file, cell, average, out)[source]

Write the bead centroid and spread of TRAJECTORIES as a con file.