Package lib :: Package structure :: Module pca
[hide private]
[frames] | no frames]

Module pca

source code

Module for performing a principle component analysis (PCA).

Functions [hide private]
numpy rank-2 3Nx3N array, numpy rank-2 MxNx3 array
calc_covariance_matrix(coord=None, weights=None)
Calculate the covariance matrix for the structures.
source code
 
calc_projections(coord=None, num_modes=4)
Calculate the PCA projections.
source code
numpy rank-1 array, numpy rank-3 array, numpy rank2 array
pca_analysis(coord=None, weights=None, algorithm='eigen', num_modes=4)
Perform the PCA analysis.
source code
Variables [hide private]
  __package__ = 'lib.structure'

Imports: array, dot, float64, outer, sqrt, zeros, eigh, svd, RelaxError, calc_mean_structure


Function Details [hide private]

calc_covariance_matrix(coord=None, weights=None)

source code 

Calculate the covariance matrix for the structures.

Parameters:
  • coord (list of numpy rank-2, Nx3 arrays) - The list of coordinates of all models to superimpose. The first index is the models, the second is the atomic positions, and the third is the xyz coordinates.
  • weights (list of float) - The weights for each structure.
Returns: numpy rank-2 3Nx3N array, numpy rank-2 MxNx3 array
The covariance matrix and the deviation matrix.

calc_projections(coord=None, num_modes=4)

source code 

Calculate the PCA projections.

Parameters:
  • num_modes (int) - The number of PCA modes to calculate.

pca_analysis(coord=None, weights=None, algorithm='eigen', num_modes=4)

source code 

Perform the PCA analysis.

Parameters:
  • coord (list of numpy rank-2, Nx3 arrays) - The list of coordinates of all models to superimpose. The first index is the models, the second is the atomic positions, and the third is the xyz coordinates.
  • weights (list of float) - The weights for each structure.
  • algorithm (str) - The PCA algorithm to use (either 'eigen' or 'svd').
  • num_modes (int) - The number of PCA modes to calculate.
Returns: numpy rank-1 array, numpy rank-3 array, numpy rank2 array
The PCA values and vectors, and the per structure projections.