Re: [AMBER] cpptraj_clucster

From: Thayer, Kelly <>
Date: Wed, 29 Jan 2020 15:13:49 +0000

If you are running cpptraj to perform clustering on an MD trajectory, you will get files called where n is an index beginning at 0 up to the number of clusters you have. These represent the pdb files of the centroids of your clusters.

Below is a snippet of BASH code from my wrapper script that generates the input for multiple cpptraj runs over a range of number of clusters.

I hope you find this helpful!
best regards,
Kelly Thayer

# STEP 1. Generate the input file to cpptraj directing k-means clustering

for NCLUST in $(seq 2 $MAXCLUST); do

    cat <<EOF> ${SAMPLENAME}_kclust$
# cluster analysis with cpptraj

# Load stripped topology file
parm ../${SAMPLENAME}_strip.prmtop

# Reference file for aligning snapshots reference ../${SAMPLENAME}_strip.inpcrd
# Load stripped trajectory file
trajin ../${SAMPLENAME}_1-100_strip.trj

# Align all the snapshots on the reference structure
rms reference $STARTRES-$ENDRES

# Cluster with k-means cluster kmeans :$STARTRES-$ENDRES mass clusters $NCLUST maxit 1000 out cluster_out averagelinkage gracec\
olor summary summary_out info cluster_info repout centroid repfmt pdb clusterout clusterfmt n\

From: Lod King <>
Sent: Tuesday, January 21, 2020 10:16 PM
To: AMBER Mailing List <>
Subject: [AMBER] cpptraj_clucster


Is there any example with command to extract cluster and output with pdb
using cpptraj?
AMBER mailing list
AMBER mailing list
Received on Wed Jan 29 2020 - 07:30:02 PST
Custom Search