Re: [AMBER] PCA eigenvalues

From: Daniel Roe <>
Date: Mon, 20 Nov 2017 10:53:21 -0500

s.dat vHi,

On Sat, Nov 18, 2017 at 10:05 AM, Lizelle Lubbe <> wrote:
> Hi Amber users,
> I have performed PCA analysis on my MD trajectories in cpptraj and would like to plot the fraction of total variance vs eigenvalue as shown in figure s9 of Roe et al 2014 (j phys chem b, 118, 3543-3552).

To do this you'll want to calculate all principal components (i.e.
eigenvectors) from your covariance matrix, so 3 * the number of
selected atoms. Then you run the 'modes' analysis command with the
'eigenval' keyword on the resulting modes data, e.g.

runanalysis diagmatrix myCovar out evececs 246 name myEvecs :1-4&!.H=
runanalysis modes eigenval name myEvecs out evalfrac.dat

> I also want to have a scatter plot of pc1 vs pc2 and pc2 vs pc3 to visualize clusters in this space.
> Could someone please guide me in how this can be accomplished?

For these, just give desired the principal component projection data
set names to the 'hist' command, e.g. for the projection of PC 1 vs 2:

hist Ndom:1 Ndom:2 bins 100 out Ndom_hist.gnu norm name Ndom_1_2

> Also, how should the pca histogram analysis be interpreted?

This is a lot trickier. As you probably know principal components
represent axes that in this case describe variance in the selected
atoms in your system. So PCs can tell you about what the dominant
modes of motion in your system look like, but generally may not tell
you how your system actually moves. Personally I like to visualize the
modes of motion with the 'trajout' keyword of 'modes' (which it
appears you are doing). It can also help to look at the so-called
'porcupine plots' - I use the nmwiz plugin for VMD (it appears you are
doing that as well).

Hope this helps,


> This is my pca script:
> trajin
> rms first :1-720&!.H=
> average crdset Ndom_average
> createcrd Ndom_trajectories
> run
> crdaction Ndom_trajectories rms ref Ndom_average :1-720&!.H=
> crdaction Ndom_trajectories matrix covar name Ndom_covar :1-720&!.H=
> runanalysis diagmatrix Ndom_covar out Ndom_evecs.dat vecs 20 name NdomEvecs nmwiz nmwizvecs 3 nmwizfile Ndom_pca.nmd nmwizmask :1-720&!.H=
> crdaction Ndom_trajectories projection Ndom modes NdomEvecs beg 1 end 3 :1-720&!.H= crdframes 1,3000
> hist Ndom:1 bins 100 out Ndom_hist.agr norm name Ndom_1
> hist Ndom:2 bins 100 out Ndom_hist.agr norm name Ndom_2
> hist Ndom:3 bins 100 out Ndom_hist.agr norm name Ndom_3
> run
> clear all
> readdata Ndom_evecs.dat name Evecs
> parm NDOM_CPLX_rnb_stripped_box.prmtop
> parmstrip !(:1-720&!.H=)
> parmwrite out Ndom_modes.prmtop
> runanalysis modes name Evecs trajout pcmin -100 pcmax 100 tmode 1 trajoutmask :1-720&!.H= trajoutfmt netcdf
> runanalysis modes name Evecs trajout pcmin -100 pcmax 100 tmode 2 trajoutmask :1-720&!.H= trajoutfmt netcdf
> runanalysis modes name Evecs trajout pcmin -100 pcmax 100 tmode 3 trajoutmask :1-720&!.H= trajoutfmt netcdf
> Kind regards
> Lizelle Lubbe
> PhD Chemical Biology candidate
> University of Cape Town
> Disclaimer - University of Cape Town This e-mail is subject to UCT policies and e-mail disclaimer published on our website at or obtainable from +27 21 650 9111. If this e-mail is not related to the business of UCT, it is sent by the sender in an individual capacity. Please report security incidents or abuse via
> _______________________________________________
> AMBER mailing list

Daniel R. Roe
Laboratory of Computational Biology
National Institutes of Health, NHLBI
5635 Fishers Ln, Rm T900
Rockville MD, 20852
AMBER mailing list
Received on Mon Nov 20 2017 - 08:00:02 PST
Custom Search