EndToEndVector

class mdhelper.analysis.polymer.EndToEndVector(groups: AtomGroup | tuple[AtomGroup], groupings: str | tuple[str] = 'atoms', n_chains: int | tuple[int] = None, n_monomers: int | tuple[int] = None, *, n_blocks: int = 1, dt: float | Quantity | Quantity = None, fft: bool = True, unwrap: bool = False, verbose: bool = True, **kwargs)[source]

Bases: _PolymerAnalysisBase

A serial implementation to calculate the end-to-end vector autocorrelation function (ACF) \(C_\mathrm{ee}(t)\) and estimate the orientational relaxation time \(\tau_\mathrm{r}\) of a polymer.

The end-to-end vector ACF is defined as

\[C_\mathrm{ee}(t)=\frac{\langle\mathbf{R}_\mathrm{ee}(t) \cdot\mathbf{R}_\mathrm{ee}(0)\rangle} {\langle\mathbf{R}_\mathrm{ee}^2\rangle}\]

where \(\mathbf{R}_\mathrm{ee}=\mathbf{r}_N-\mathbf{r}_1\) is the end-to-end vector.

The orientational relaxation time can then be estimated by fitting a stretched exponential function

\[C_\mathrm{ee}=\exp{\left[-(t/\tau)^\beta\right]}\]

to the end-to-end vector ACF and evaluating

\[\tau_\mathrm{r}=\int_0^\infty C_\mathrm{ee}\,dt =\tau\Gamma(\frac{1}{\beta}+1)\]
Parameters:
groupsMDAnalysis.AtomGroup or array_like

Group(s) of polymers to be analyzed. All polymers in each group must have the same chain length.

groupingsstr or array-like, default: "atoms"

Determines whether the centers of mass are used in lieu of individual atom positions. If groupings is a str, the same value is used for all groups.

Note

In a standard trajectory file, segments (or chains) contain residues (or molecules), and residues contain atoms. This heirarchy must be adhered to for this analysis module to function correctly. If your trajectory file does not contain the correct segment or residue information, provide the number of chains and chain lengths in n_chains and n_monomers, respectively.

Valid values:

  • "atoms": Atom positions (for coarse-grained polymer simulations).

  • "residues": Residues’ centers of mass (for atomistic polymer simulations).

n_chainsint or array-like, optional

Number of chains in each polymer group. Must be provided if the trajectory does not adhere to the standard container heirarchy (see Notes).

n_monomersint or array-like, optional

Number of monomers in each chain in each polymer group. Must be provided if the trajectory does not adhere to the standard container heirarchy (see Notes).

n_blocksint, keyword-only, default: 1

Number of blocks to split the trajectory into.

dtfloat or openmm.unit.Quantity, keyword-only, optional

Time between frames \(\Delta t\). While this is normally determined from the trajectory, the trajectory may not have the correct information if the data is in reduced units. For example, if your reduced timestep is \(0.01\) and you output trajectory data every \(10,000\) timesteps, then \(\Delta t=100\).

Reference unit: \(\mathrm{ps}\).

fftbool, keyword-only, default: True

Determines whether fast Fourier transforms (FFT) are used to evaluate the ACFs.

unwrapbool, keyword-only, default: False

Determines whether atom positions are unwrapped.

verbosebool, keyword-only, default: True

Determines whether detailed progress is shown.

**kwargs

Additional keyword arguments to pass to MDAnalysis.analysis.base.AnalysisBase.

Notes

In a standard trajectory file, segments (or chains) contain residues, and residues contain atoms. This heirarchy must be adhered to for this analysis module to function correctly. If your trajectory file does not contain the correct segment or residue information, provide the number of chains and chain lengths in n_chains and n_monomers, respectively.

Attributes:
universeMDAnalysis.Universe

MDAnalysis.core.universe.Universe object containing all information describing the system.

results.unitsdict

Reference units for the results. For example, to get the reference units for results.times, call results.units["results.times"].

results.timesnumpy.ndarray

Changes in time \(t-t_0\).

Shape: \((N_t,)\).

Reference unit: \(\textrm{ps}\).

results.acfnumpy.ndarray

End-to-end vector ACFs for the \(N_\textrm{g}\) groups over \(N_\textrm{b}\) blocks with \(N_t\) trajectory frames each.

Shape: \((N_\textrm{g},\,N_\textrm{b},\,N_t)\).

results.relaxation_timesnumpy.ndarray

Average orientational relaxation times for the \(N_\textrm{g}\) groups over \(N_t\) trajectory frames split into \(N_\textrm{b}\) blocks.

Methods

calculate_relaxation_time

Calculates the orientational relaxation time.

run

Performs the calculation.

save

Saves results to a binary or archive file in NumPy format.

calculate_relaxation_time() None[source]

Calculates the orientational relaxation time.

run(start: int = None, stop: int = None, step: int = None, frames: slice | ndarray[int] = None, verbose: bool = None, **kwargs) SerialAnalysisBase | ParallelAnalysisBase

Performs the calculation.

See also

For parallel-specific keyword arguments, see ParallelAnalysisBase.run().

Parameters:
startint, optional

Starting frame for analysis.

stopint, optional

Ending frame for analysis.

stepint, optional

Number of frames to skip between each analyzed frame.

framesslice or array-like, optional

Index or logical array of the desired trajectory frames.

verbosebool, optional

Determines whether detailed progress is shown.

**kwargs

Additional keyword arguments to pass to MDAnalysis.lib.log.ProgressBar.

Returns:
selfSerialAnalysisBase or ParallelAnalysisBase

Analysis object with results.

save(file: str | TextIO, archive: bool = True, compress: bool = True, **kwargs) None

Saves results to a binary or archive file in NumPy format.

Parameters:
filestr or file

Filename or file-like object where the data will be saved. If file is a str, the .npy or .npz extension will be appended automatically if not already present.

archivebool, default: True

Determines whether the results are saved to a single archive file. If True, the data is stored in a .npz file. Otherwise, the data is saved to multiple .npy files.

compressbool, default: True

Determines whether the .npz file is compressed. Has no effect when archive=False.

**kwargs

Additional keyword arguments to pass to numpy.save(), numpy.savez(), or numpy.savez_compressed(), depending on the values of archive and compress.