|
seams-core v2.14.2
libyodaLib, the C++ engine of d-SEAMS
|
Periodic unwrapping, molecular dipoles, and streaming time correlations. More...
Functions | |
| SEAMS_API seams_status | seams_mols (const seams_system *sys, int *mols, size_t len) |
| Copy the stored molecule ids out. | |
| SEAMS_API seams_status | seams_set_mols (seams_system *sys, const int *mols, size_t len) |
| Replace the stored molecule ids on a loaded frame. | |
| SEAMS_API seams_status | seams_molecule_centres (const seams_system *sys, const int *mols, size_t mols_len, const double *masses, size_t masses_len, int *mol_ids_out, double *centres_out, size_t cap, size_t *n_mols) |
| Intact periodic centres of mass or geometry for molecules in a frame. | |
| SEAMS_API seams_status | seams_traj_unwrap_positions (const double *xyz, size_t nframes, size_t natoms, const double *boxes, size_t nboxes, double *unwrapped, size_t unwrapped_len) |
| Unwrap periodic coordinates across consecutive frames. | |
| SEAMS_API seams_status | seams_traj_unwrap_centres (const double *xyz, size_t nframes, size_t natoms, const double *boxes, size_t nboxes, const int *mols, size_t mols_len, const double *masses, size_t masses_len, int *mol_ids_out, size_t mol_ids_cap, double *centres_out, size_t centres_len, size_t *n_mols) |
| Assemble per-molecule centres and unwrap them across frames. | |
| SEAMS_API seams_status | seams_water_vectors (const seams_system *sys, int oxygen_type, int hydrogen_type, int *mol_ids, double *oh_mid, double *bisector, double *hh, double *hh_unit, size_t cap, size_t *n_waters) |
| Water orientation vectors: O to H-midpoint and H-to-H under PBC. | |
| SEAMS_API seams_status | seams_molecule_dipoles (const seams_system *sys, const int *mols, size_t mols_len, const double *charges, size_t charges_len, int *mol_ids_out, double *dipoles, double *unit_vectors, size_t cap, size_t *n_mols) |
| Generic per-molecule dipole or geometric orientation vectors. | |
| SEAMS_API seams_status | seams_orientation_order (const double *vectors, size_t n_vectors, const double axis[3], double *cos_theta, double *p2, size_t cap, double *mean_p1, double *mean_p2) |
| Project molecular vectors onto an axis for P1 and P2 order parameters. | |
| SEAMS_API seams_status | seams_msd_create (size_t natoms, size_t max_lag, size_t origin_stride, double dt, const double axis[3], seams_msd **out) |
| Create a streaming multi-origin MSD accumulator with axial/lateral split. | |
| SEAMS_API void | seams_msd_destroy (seams_msd *msd) |
| Free an MSD accumulator. | |
| SEAMS_API seams_status | seams_msd_push (seams_msd *msd, const double *xyz, size_t natoms, const double *box9, size_t box_len) |
| Push one frame into a streaming MSD accumulator. | |
| SEAMS_API seams_status | seams_msd_curve (const seams_msd *msd, double *lag_time, double *total, double *axial, double *lateral, size_t *n_origins, size_t cap, size_t *n_lags) |
| Read accumulated lag times and total, axial, and lateral MSD curves. | |
| SEAMS_API seams_status | seams_msd_fit (const seams_msd *msd, double t_start, double t_end, double *d_total, double *d_axial, double *d_lateral, double *alpha) |
| Linear Einstein diffusion fit on an MSD accumulator. | |
| SEAMS_API seams_status | seams_hbond_tcf_create (size_t max_lag, size_t origin_stride, double dt, int directed, seams_hbond_tcf **out) |
| Create a streaming H-bond lifetime accumulator from per-frame edges. | |
| SEAMS_API void | seams_hbond_tcf_destroy (seams_hbond_tcf *tcf) |
| Free an H-bond lifetime accumulator. | |
| SEAMS_API seams_status | seams_hbond_tcf_push (seams_hbond_tcf *tcf, const int *donors, const int *acceptors, size_t n_edges) |
| Push one frame's hydrogen-bond edge set into the lifetime accumulator. | |
| SEAMS_API seams_status | seams_hbond_tcf_curve (const seams_hbond_tcf *tcf, double *lag_time, double *c_intermittent, double *s_continuous, size_t *n_origins, size_t cap, size_t *n_lags) |
| Read intermittent C_HB(t) and continuous S_HB(t) lifetime curves. | |
| SEAMS_API seams_status | seams_hbond_tcf_fit (const seams_hbond_tcf *tcf, double t_start, double t_end, double *tau_c_int, double *tau_c_exp, double *tau_s_int, double *tau_s_exp) |
| Integrated and single-exponential lifetimes for C_HB and S_HB. | |
| SEAMS_API seams_status | seams_reorient_create (size_t n_vectors, size_t max_lag, size_t origin_stride, double dt, seams_reorient **out) |
| Create a streaming orientational correlation accumulator for C1 and C2. | |
| SEAMS_API void | seams_reorient_destroy (seams_reorient *reorient) |
| Free a reorientation accumulator. | |
| SEAMS_API seams_status | seams_reorient_push (seams_reorient *reorient, const double *vectors, size_t n_vectors) |
| Push one frame of molecular 3-vectors into a reorientation accumulator. | |
| SEAMS_API seams_status | seams_reorient_curve (const seams_reorient *reorient, double *lag_time, double *c1, double *c2, size_t *n_origins, size_t cap, size_t *n_lags) |
| Read accumulated C1(t) = <P1(u(0).u(t))> and C2(t) = <P2(u(0).u(t))>. | |
| SEAMS_API seams_status | seams_reorient_fit (const seams_reorient *reorient, double t_start, double t_end, double *tau1_int, double *tau1_exp, double *tau2_int, double *tau2_exp) |
| Integrated and single-exponential reorientation times tau_1 and tau_2. | |
Periodic unwrapping, molecular dipoles, and streaming time correlations.
| SEAMS_API seams_status seams_hbond_tcf_create | ( | size_t | max_lag, |
| size_t | origin_stride, | ||
| double | dt, | ||
| int | directed, | ||
| seams_hbond_tcf ** | out ) |
Create a streaming H-bond lifetime accumulator from per-frame edges.
| max_lag | Maximum lag in frames, or 0 to retain all lags. Above PTRDIFF_MAX / sizeof(double) - 1 the lag bins cannot be allocated, which is SEAMS_ERR_RANGE. |
| origin_stride | Frame stride between time origins, at least 1. |
| dt | Positive finite frame spacing. |
| directed | Non-zero treats (donor, acceptor) as directed; zero canonicalizes pairs. |
| out | Receives the new handle; set to NULL on failure. |
| SEAMS_API seams_status seams_hbond_tcf_curve | ( | const seams_hbond_tcf * | tcf, |
| double * | lag_time, | ||
| double * | c_intermittent, | ||
| double * | s_continuous, | ||
| size_t * | n_origins, | ||
| size_t | cap, | ||
| size_t * | n_lags ) |
Read intermittent C_HB(t) and continuous S_HB(t) lifetime curves.
| tcf | H-bond TCF handle. |
| lag_time | Receives lag times k * dt, or NULL. |
| c_intermittent | Receives intermittent autocorrelation C_HB, or NULL. |
| s_continuous | Receives unbroken survival probability S_HB, or NULL. |
| n_origins | Receives origin counts per lag, or NULL. |
| cap | Capacity of non-NULL output arrays. |
| n_lags | Receives the available lag count. |
| SEAMS_API void seams_hbond_tcf_destroy | ( | seams_hbond_tcf * | tcf | ) |
Free an H-bond lifetime accumulator.
| tcf | Handle from seams_hbond_tcf_create(), or NULL. |
| SEAMS_API seams_status seams_hbond_tcf_fit | ( | const seams_hbond_tcf * | tcf, |
| double | t_start, | ||
| double | t_end, | ||
| double * | tau_c_int, | ||
| double * | tau_c_exp, | ||
| double * | tau_s_int, | ||
| double * | tau_s_exp ) |
Integrated and single-exponential lifetimes for C_HB and S_HB.
Pass t_start = 0 and t_end = 0 to fit across the full positive decay range.
| tcf | H-bond TCF handle with at least 2 lag points. |
| t_start | Fit window start time, >= 0. |
| t_end | Fit window end time, > t_start (or both 0 for full range). |
| tau_c_int | Receives trapezoidal integral of C_HB, or NULL. |
| tau_c_exp | Receives exponential decay time of C_HB, or NULL. |
| tau_s_int | Receives trapezoidal integral of S_HB, or NULL. |
| tau_s_exp | Receives exponential decay time of S_HB, or NULL. |
| SEAMS_API seams_status seams_hbond_tcf_push | ( | seams_hbond_tcf * | tcf, |
| const int * | donors, | ||
| const int * | acceptors, | ||
| size_t | n_edges ) |
Push one frame's hydrogen-bond edge set into the lifetime accumulator.
Duplicate edges within the same frame are deduplicated before updating intermittent C_HB(t) and continuous survival S_HB(t).
| tcf | H-bond TCF handle. |
| donors | Donor ids of length n_edges (may be NULL when n_edges is 0). |
| acceptors | Acceptor ids of length n_edges (may be NULL when n_edges is 0). |
| n_edges | Number of edges in this frame. |
| SEAMS_API seams_status seams_molecule_centres | ( | const seams_system * | sys, |
| const int * | mols, | ||
| size_t | mols_len, | ||
| const double * | masses, | ||
| size_t | masses_len, | ||
| int * | mol_ids_out, | ||
| double * | centres_out, | ||
| size_t | cap, | ||
| size_t * | n_mols ) |
Intact periodic centres of mass or geometry for molecules in a frame.
Atoms sharing a molecule id are assembled onto the first atom of that molecule through the minimum image of the stored orthorhombic or triclinic cell before averaging. Pass NULL for both mol_ids_out and centres_out to query the molecule count in n_mols.
| sys | Frame handle. |
| mols | Optional molecule id per atom, or NULL to use stored molecule ids. |
| mols_len | Length of mols when mols is non-NULL; must equal n, or 0 when NULL. |
| masses | Optional positive weight per atom, or NULL for equal weights. |
| masses_len | Length of masses when masses is non-NULL; must equal n, or 0 when NULL. |
| mol_ids_out | Receives one molecule id per molecule, or NULL. |
| centres_out | Receives 3 * n_mols coordinates in Angstrom, or NULL. |
| cap | Molecule capacity of non-NULL output buffers. |
| n_mols | Receives the molecule count. |
| SEAMS_API seams_status seams_molecule_dipoles | ( | const seams_system * | sys, |
| const int * | mols, | ||
| size_t | mols_len, | ||
| const double * | charges, | ||
| size_t | charges_len, | ||
| int * | mol_ids_out, | ||
| double * | dipoles, | ||
| double * | unit_vectors, | ||
| size_t | cap, | ||
| size_t * | n_mols ) |
Generic per-molecule dipole or geometric orientation vectors.
With charges, computes sum_a q_a (r_a - r_centre) in elementary-charge Angstrom on each PBC-assembled molecule. Without charges, computes the mean minimum-image vector from each molecule's first atom to its remaining atoms.
| sys | Frame handle. |
| mols | Optional molecule id per atom, or NULL to use stored molecule ids. |
| mols_len | Length of mols when non-NULL, or 0 when NULL. |
| charges | Optional partial charge per atom, or NULL for geometric mode. |
| charges_len | Length of charges when non-NULL, or 0 when NULL. |
| mol_ids_out | Receives molecule ids, length cap, or NULL. |
| dipoles | Receives 3 * cap raw dipole vectors, or NULL. |
| unit_vectors | Receives 3 * cap normalized orientation vectors, or NULL. |
| cap | Molecule capacity of non-NULL output arrays. |
| n_mols | Receives the molecule count. |
| SEAMS_API seams_status seams_mols | ( | const seams_system * | sys, |
| int * | mols, | ||
| size_t | len ) |
Copy the stored molecule ids out.
| sys | Frame handle. |
| mols | Caller buffer for n ints, in stored order. |
| len | Length of mols. Must be at least n. |
| SEAMS_API seams_status seams_msd_create | ( | size_t | natoms, |
| size_t | max_lag, | ||
| size_t | origin_stride, | ||
| double | dt, | ||
| const double | axis[3], | ||
| seams_msd ** | out ) |
Create a streaming multi-origin MSD accumulator with axial/lateral split.
| natoms | Particle or molecule count per frame, at least 1. Above PTRDIFF_MAX / (3 * sizeof(double)) the coordinates cannot be allocated, which is SEAMS_ERR_RANGE. |
| max_lag | Maximum lag in frames, or 0 to retain all lags. Above PTRDIFF_MAX / sizeof(double) - 1 the lag bins cannot be allocated, which is SEAMS_ERR_RANGE. |
| origin_stride | Frame stride between time origins, at least 1. |
| dt | Positive finite frame spacing in physical time units. |
| axis | Non-zero 3-vector defining the axial direction. |
| out | Receives the new handle; set to NULL on failure. |
| SEAMS_API seams_status seams_msd_curve | ( | const seams_msd * | msd, |
| double * | lag_time, | ||
| double * | total, | ||
| double * | axial, | ||
| double * | lateral, | ||
| size_t * | n_origins, | ||
| size_t | cap, | ||
| size_t * | n_lags ) |
Read accumulated lag times and total, axial, and lateral MSD curves.
Any of lag_time, total, axial, lateral, and n_origins may be NULL to skip that column; pass all five as NULL to query n_lags.
| msd | MSD handle. |
| lag_time | Receives lag times k * dt, or NULL. |
| total | Receives 3D total MSD, or NULL. |
| axial | Receives 1D axial MSD along axis, or NULL. |
| lateral | Receives 2D lateral MSD perpendicular to axis, or NULL. |
| n_origins | Receives time-origin counts per lag, or NULL. |
| cap | Capacity of non-NULL output arrays. |
| n_lags | Receives the available lag count. |
Free an MSD accumulator.
| msd | Handle from seams_msd_create(), or NULL. |
| SEAMS_API seams_status seams_msd_fit | ( | const seams_msd * | msd, |
| double | t_start, | ||
| double | t_end, | ||
| double * | d_total, | ||
| double * | d_axial, | ||
| double * | d_lateral, | ||
| double * | alpha ) |
Linear Einstein diffusion fit on an MSD accumulator.
Fits MSD_total = 6 D_total t + c, MSD_axial = 2 D_axial t + c, and MSD_lateral = 4 D_lateral t + c over [t_start, t_end]. Pass t_start = 0 and t_end = 0 for the default [0.1 t_max, 0.5 t_max] window.
| msd | MSD handle with at least 2 lag points. |
| t_start | Window start time, >= 0. |
| t_end | Window end time, > t_start (or both 0 for default window). |
| d_total | Receives 3D diffusion coefficient, or NULL. |
| d_axial | Receives 1D axial diffusion coefficient, or NULL. |
| d_lateral | Receives 2D lateral diffusion coefficient, or NULL. |
| alpha | Receives the log-log anomalous exponent, or NULL. Receives NaN when the window holds fewer than two lags with t > 0 and MSD_total > 1e-20, so the log-log fit was skipped; test it with isnan(). The diffusion coefficients are still the linear fit. |
| SEAMS_API seams_status seams_msd_push | ( | seams_msd * | msd, |
| const double * | xyz, | ||
| size_t | natoms, | ||
| const double * | box9, | ||
| size_t | box_len ) |
Push one frame into a streaming MSD accumulator.
Pass box9 as NULL (with box_len 0) when xyz is already unwrapped, or pass a nine-number cell (with box_len 9) to unwrap incrementally across frames.
| msd | MSD handle. |
| xyz | Coordinates of 3 * natoms doubles in Angstrom. |
| natoms | Particle count; must match the count passed to seams_msd_create(). |
| box9 | Optional 9-number periodic cell, or NULL for unwrapped input. |
| box_len | Must be 9 when box9 is non-NULL, or 0 when box9 is NULL. |
| SEAMS_API seams_status seams_orientation_order | ( | const double * | vectors, |
| size_t | n_vectors, | ||
| const double | axis[3], | ||
| double * | cos_theta, | ||
| double * | p2, | ||
| size_t | cap, | ||
| double * | mean_p1, | ||
| double * | mean_p2 ) |
Project molecular vectors onto an axis for P1 and P2 order parameters.
Computes cos_theta = u . e and P2 = 0.5 * (3 cos_theta^2 - 1) for each non-zero vector, where e is the normalized axis. Zero-length vectors receive NaN in per-molecule outputs and are omitted from mean_p1 and mean_p2.
| vectors | Input 3-vectors, 3 * n_vectors doubles (or NULL when n_vectors is 0). |
| n_vectors | Number of 3-vectors. |
| axis | Non-zero reference axis of 3 finite doubles. |
| cos_theta | Optional output buffer of cap doubles for cos(theta), or NULL. |
| p2 | Optional output buffer of cap doubles for P2(cos(theta)), or NULL. |
| cap | Capacity of non-NULL per-vector buffers; must be at least n_vectors. |
| mean_p1 | Receives ensemble mean of cos(theta), or NULL. |
| mean_p2 | Receives ensemble mean of P2(cos(theta)), or NULL. |
| SEAMS_API seams_status seams_reorient_create | ( | size_t | n_vectors, |
| size_t | max_lag, | ||
| size_t | origin_stride, | ||
| double | dt, | ||
| seams_reorient ** | out ) |
Create a streaming orientational correlation accumulator for C1 and C2.
| n_vectors | Number of molecular vectors per frame, at least 1. Above PTRDIFF_MAX / (3 * sizeof(double)) the vectors cannot be allocated, which is SEAMS_ERR_RANGE. |
| max_lag | Maximum lag in frames, or 0 to retain all lags. Above PTRDIFF_MAX / sizeof(double) - 1 the lag bins cannot be allocated, which is SEAMS_ERR_RANGE. |
| origin_stride | Frame stride between time origins, at least 1. |
| dt | Positive finite frame spacing. |
| out | Receives the new handle; set to NULL on failure. |
| SEAMS_API seams_status seams_reorient_curve | ( | const seams_reorient * | reorient, |
| double * | lag_time, | ||
| double * | c1, | ||
| double * | c2, | ||
| size_t * | n_origins, | ||
| size_t | cap, | ||
| size_t * | n_lags ) |
Read accumulated C1(t) = <P1(u(0).u(t))> and C2(t) = <P2(u(0).u(t))>.
| reorient | Reorientation handle. |
| lag_time | Receives lag times k * dt, or NULL. |
| c1 | Receives first Legendre correlation C1, or NULL. |
| c2 | Receives second Legendre correlation C2, or NULL. |
| n_origins | Receives origin counts per lag, or NULL. |
| cap | Capacity of non-NULL output arrays. |
| n_lags | Receives the available lag count. |
| SEAMS_API void seams_reorient_destroy | ( | seams_reorient * | reorient | ) |
Free a reorientation accumulator.
| reorient | Handle from seams_reorient_create(), or NULL. |
| SEAMS_API seams_status seams_reorient_fit | ( | const seams_reorient * | reorient, |
| double | t_start, | ||
| double | t_end, | ||
| double * | tau1_int, | ||
| double * | tau1_exp, | ||
| double * | tau2_int, | ||
| double * | tau2_exp ) |
Integrated and single-exponential reorientation times tau_1 and tau_2.
| reorient | Reorientation handle with at least 2 lag points. |
| t_start | Fit window start time, >= 0. |
| t_end | Fit window end time, > t_start (or both 0 for full range). |
| tau1_int | Receives trapezoidal integral of C1, or NULL. |
| tau1_exp | Receives exponential decay time of C1, or NULL. |
| tau2_int | Receives trapezoidal integral of C2, or NULL. |
| tau2_exp | Receives exponential decay time of C2, or NULL. |
| SEAMS_API seams_status seams_reorient_push | ( | seams_reorient * | reorient, |
| const double * | vectors, | ||
| size_t | n_vectors ) |
Push one frame of molecular 3-vectors into a reorientation accumulator.
Non-zero vectors are normalized per molecule; zero-norm vectors are skipped in correlation pairs.
| reorient | Reorientation handle. |
| vectors | Array of 3 * n_vectors finite doubles. |
| n_vectors | Vector count; must match seams_reorient_create(). |
| SEAMS_API seams_status seams_set_mols | ( | seams_system * | sys, |
| const int * | mols, | ||
| size_t | len ) |
Replace the stored molecule ids on a loaded frame.
| sys | Frame handle. |
| mols | Caller buffer of n molecule ids. |
| len | Length of mols. Must equal the stored atom count. |
| SEAMS_API seams_status seams_traj_unwrap_centres | ( | const double * | xyz, |
| size_t | nframes, | ||
| size_t | natoms, | ||
| const double * | boxes, | ||
| size_t | nboxes, | ||
| const int * | mols, | ||
| size_t | mols_len, | ||
| const double * | masses, | ||
| size_t | masses_len, | ||
| int * | mol_ids_out, | ||
| size_t | mol_ids_cap, | ||
| double * | centres_out, | ||
| size_t | centres_len, | ||
| size_t * | n_mols ) |
Assemble per-molecule centres and unwrap them across frames.
Pass NULL for both mol_ids_out and centres_out to query n_mols first.
| xyz | Wrapped atom coordinates, nframes * 3 * natoms doubles. |
| nframes | Number of frames, at least 1. |
| natoms | Number of atoms per frame, at least 1. |
| boxes | Cell array of 9 * nboxes doubles. |
| nboxes | Cell count, either 1 or nframes. |
| mols | Molecule id per atom, length mols_len. |
| mols_len | Must equal natoms. |
| masses | Optional positive mass per atom, or NULL for equal weights. |
| masses_len | Must equal natoms when masses is non-NULL, or 0 when NULL. |
| mol_ids_out | Receives unique molecule ids, or NULL. |
| mol_ids_cap | Capacity of mol_ids_out in ints when non-NULL. |
| centres_out | Receives nframes * 3 * n_mols unwrapped coordinates, or NULL. |
| centres_len | Capacity of centres_out in doubles when non-NULL. |
| n_mols | Receives the molecule count. |
| SEAMS_API seams_status seams_traj_unwrap_positions | ( | const double * | xyz, |
| size_t | nframes, | ||
| size_t | natoms, | ||
| const double * | boxes, | ||
| size_t | nboxes, | ||
| double * | unwrapped, | ||
| size_t | unwrapped_len ) |
Unwrap periodic coordinates across consecutive frames.
Each step adds the minimum-image displacement under an orthorhombic or triclinic nine-number cell (ox, oy, oz, lx, ly, lz, xy, xz, yz). Pass nboxes equal to 1 for a constant cell or nframes for a deforming cell.
| xyz | Wrapped coordinates, nframes * 3 * natoms doubles in Angstrom. |
| nframes | Number of frames, at least 1. |
| natoms | Number of atoms per frame, at least 1. |
| boxes | Cell array of 9 * nboxes doubles. |
| nboxes | Cell count, either 1 or nframes. |
| unwrapped | Output buffer of unwrapped_len doubles. |
| unwrapped_len | Capacity in doubles, at least nframes * 3 * natoms. |
| SEAMS_API seams_status seams_water_vectors | ( | const seams_system * | sys, |
| int | oxygen_type, | ||
| int | hydrogen_type, | ||
| int * | mol_ids, | ||
| double * | oh_mid, | ||
| double * | bisector, | ||
| double * | hh, | ||
| double * | hh_unit, | ||
| size_t | cap, | ||
| size_t * | n_waters ) |
Water orientation vectors: O to H-midpoint and H-to-H under PBC.
Each water pairs one oxygen_type atom with two hydrogen_type atoms via shared molecule ids when available, or via minimum-image covalent distance otherwise. Pass NULL for all five output arrays to query n_waters.
| sys | Frame handle. |
| oxygen_type | Species integer of water oxygen. |
| hydrogen_type | Species integer of water hydrogen, distinct from oxygen_type. |
| mol_ids | Receives molecule ids, length cap, or NULL. |
| oh_mid | Receives O-to-H-midpoint vectors in Angstrom, 3 * cap doubles, or NULL. |
| bisector | Receives unit bisector vectors, 3 * cap doubles, or NULL. |
| hh | Receives H1-to-H2 vectors in Angstrom, 3 * cap doubles, or NULL. |
| hh_unit | Receives unit H1-to-H2 vectors, 3 * cap doubles, or NULL. |
| cap | Molecule capacity of every non-NULL output array. |
| n_waters | Receives the water count. |