Matrix Analysis

pytraj.matrix.correl(traj=None, mask='', top=None, dtype='ndarray', mat_type='full', frame_indices=None)

Compute matrix

Parameters:

traj : Trajectory-like

mask : cpptraj mask

top : Topology, optional, default None

mat_type : str, {‘full’, ‘half’, ‘cpptraj’}, default ‘full’

if ‘full’: 2D full matrix if ‘half’: triangular matrix if ‘cpptraj’: 1D array

pytraj.matrix.covar(traj=None, mask='', top=None, dtype='ndarray', mat_type='full', frame_indices=None)

Compute matrix

Parameters:

traj : Trajectory-like

mask : cpptraj mask

top : Topology, optional, default None

mat_type : str, {‘full’, ‘half’, ‘cpptraj’}, default ‘full’

if ‘full’: 2D full matrix if ‘half’: triangular matrix if ‘cpptraj’: 1D array

pytraj.matrix.diagonalize(mat, n_vecs, dtype='tuple')

diagonalize matrix and return (eigenvalues, eigenvectors)

Parameters:

mat : 2D ndarray or DatasetMatrixDouble

n_vecs : number of output vectors

dtype : str, {‘tuple’, ‘dataset’}, default ‘tuple’

if ‘tuple’, return a tuple (eigenvalues, eigenvectors). If ‘dataset’ return CpptrajDataseList

Examples

>>> import pytraj as pt
>>> traj = pt.load_sample_data('tz2')
>>> mat = pt.matrix.dist(traj, '@CA')
>>> x = pt.matrix.diagonalize(mat, 4, dtype='tuple')
>>> x = pt.matrix.diagonalize(mat, 4, dtype='dataset')
>>> # use cpptraj dataset to save memory
>>> mat_cpp = pt.matrix.covar(traj, '@CA', dtype='cpptraj_dataset')[0]
>>> x = pt.matrix.diagonalize(mat_cpp, 4, dtype='tuple')
>>> print(x[0].shape, x[1].shape)
(4,) (4, 36)
pytraj.matrix.dihcovar(traj=None, mask='', top=None, dtype='ndarray', mat_type='full', frame_indices=None)

Compute matrix

Parameters:

traj : Trajectory-like

mask : cpptraj mask

top : Topology, optional, default None

mat_type : str, {‘full’, ‘half’, ‘cpptraj’}, default ‘full’

if ‘full’: 2D full matrix if ‘half’: triangular matrix if ‘cpptraj’: 1D array

pytraj.matrix.dist(traj=None, mask='', top=None, dtype='ndarray', mat_type='full', frame_indices=None)

Compute matrix

Parameters:

traj : Trajectory-like

mask : cpptraj mask

top : Topology, optional, default None

mat_type : str, {‘full’, ‘half’, ‘cpptraj’}, default ‘full’

if ‘full’: 2D full matrix if ‘half’: triangular matrix if ‘cpptraj’: 1D array

pytraj.matrix.distcovar(traj=None, mask='', top=None, dtype='ndarray', mat_type='full', frame_indices=None)

Compute matrix

Parameters:

traj : Trajectory-like

mask : cpptraj mask

top : Topology, optional, default None

mat_type : str, {‘full’, ‘half’, ‘cpptraj’}, default ‘full’

if ‘full’: 2D full matrix if ‘half’: triangular matrix if ‘cpptraj’: 1D array

pytraj.matrix.idea(traj=None, mask='', top=None, dtype='ndarray', mat_type='full', frame_indices=None)

Compute matrix

Parameters:

traj : Trajectory-like

mask : cpptraj mask

top : Topology, optional, default None

mat_type : str, {‘full’, ‘half’, ‘cpptraj’}, default ‘full’

if ‘full’: 2D full matrix if ‘half’: triangular matrix if ‘cpptraj’: 1D array

pytraj.matrix.mwcovar(traj=None, mask='', top=None, dtype='ndarray', mat_type='full', frame_indices=None)

Compute matrix

Parameters:

traj : Trajectory-like

mask : cpptraj mask

top : Topology, optional, default None

mat_type : str, {‘full’, ‘half’, ‘cpptraj’}, default ‘full’

if ‘full’: 2D full matrix if ‘half’: triangular matrix if ‘cpptraj’: 1D array