# Clustering different chains and simulations

**URL:** <https://gromacs.bioexcel.eu/t/clustering-different-chains-and-simulations/1421>\
**Category:** User discussions\
**Created:** [January 12, 2021, 4:23am UTC](https://gromacs.bioexcel.eu/t/clustering-different-chains-and-simulations/1421 "2021-01-12T04:23:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![txuko](https://avatars.discourse-cdn.com/v4/letter/t/9f8e36/32.png) [@txuko](https://gromacs.bioexcel.eu/u/txuko)\
**Post date:** [January 12, 2021, 4:23am UTC](https://gromacs.bioexcel.eu/t/clustering-different-chains-and-simulations/1421/1 "2021-01-12T04:23:09Z")

</div>

GROMACS version: 2018.3  
GROMACS modification: No

I have run 6 simulations of 100 ns with 4 peptides in each water box (all same peptide) and I want to do clustering with all together. I mean, generating clusters for the structures of the 6 simulations and of the 4 chains as if they belong to the same simulation. Do you know how to do that?

What I am able to do is to analyze each chain independently. For this, first I created an index with the independent chains:  
gmx make\_ndx -f md\_0\_1.gro -o chainA.ndx  
4 & ri 1-12 #(Backbone for the rmsd)  
1 & ri 1-12 #(Protein for the output)  
And then I used that index to run the clustering:  
gmx cluster -n chainA.ndx -f md\_0\_1.xtc -s md\_0\_1.tpr -method gromos -cl cluster.pdb -g cluster.log -cutoff 0.1 -b 50000 -dt 50 #(I only analyze the last 50 ns)

If I don’t select each chain, of course, I get clustering of groups of 4 chains.

So the problems for the clustering are two:  
-How to compare structures from different simulations.  
-How to compare structures of different chains in the same simulation.

For the first part I think in something like trjcat to combine simulations but for the second problem I have no clue.

Thanks.

---

<div class="post-metadata">

**Author:** ![alevilla](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/alevilla/32/439_2.png) [@alevilla](https://gromacs.bioexcel.eu/u/alevilla)\
**Post date:** [January 12, 2021, 1:37pm UTC](https://gromacs.bioexcel.eu/t/clustering-different-chains-and-simulations/1421/2 "2021-01-12T13:37:22Z")

</div>

Hi,  
As far as I understood, you have 4 identical peptides in the simulation box and you want to cluster their structural feature (considering them as they were single molecule). From a technical point of view, you can save a traj file containing only 1 peptide each time (using gmx trjconv). Then analyze all the so-obtain trajectories togethers.  
Note that the sampling of each peptide is affected by the presence of the other peptides.  
Best regards  
Alessandra

---

<div class="post-metadata">

**Author:** ![txuko](https://avatars.discourse-cdn.com/v4/letter/t/9f8e36/32.png) [@txuko](https://gromacs.bioexcel.eu/u/txuko)\
**Post date:** [January 12, 2021, 4:14pm UTC](https://gromacs.bioexcel.eu/t/clustering-different-chains-and-simulations/1421/3 "2021-01-12T16:14:42Z")

</div>

Hi,

Thank you. I have advanced a bit but still it is not solved.

I tried what you proposed. First I generated each independent trajectory:  
gmx trjconv -f md\_0\_1.xtc -s md\_0\_1.tpr -n 000cluster.ndx -b 50000 -dt 50 -o 0precluster11.xtc  
gmx trjconv -f md\_0\_1.xtc -s md\_0\_1.tpr -n 000cluster.ndx -b 50000 -dt 50 -o 0precluster12.xtc  
gmx trjconv -f md\_0\_1.xtc -s md\_0\_1.tpr -n 000cluster.ndx -b 50000 -dt 50 -o 0precluster13.xtc  
gmx trjconv -f md\_0\_1.xtc -s md\_0\_1.tpr -n 000cluster.ndx -b 50000 -dt 50 -o 0precluster14.xtc  
(selecting Protein + each chain)

Then I joined the 4 trajectories in a new one:  
gmx trjcat -f 0precluster1\*.xtc -settime -o 0trajall1.xtc

And then I run the clustering:  
gmx cluster -f 0trajall1.trr -s md\_0\_1.tpr -method gromos -cl cluster.pdb -g cluster.log -cutoff 0.1

But the file md\_0\_1.tpr seems not to be accepted. It does not fit with the trajectory file and it is a needed file.

Any solution for this?

Thanks.

---

<div class="post-metadata">

**Author:** ![alevilla](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/alevilla/32/439_2.png) [@alevilla](https://gromacs.bioexcel.eu/u/alevilla)\
**Post date:** [January 12, 2021, 6:12pm UTC](https://gromacs.bioexcel.eu/t/clustering-different-chains-and-simulations/1421/4 "2021-01-12T18:12:49Z")

</div>

Hi,  
you can try to use an gro file containing only one peptide in box (e.i first snapshot of the trajectory) in place of the tpr or use the option -n index.ndx where you have one group with one peptide.

I notice that you generate first 0trajall1.xtc and than you use 0trajall1.trr as input in gmx cluster (I guess it is a typo).

Alessandra

---

<div class="post-metadata">

**Author:** ![txuko](https://avatars.discourse-cdn.com/v4/letter/t/9f8e36/32.png) [@txuko](https://gromacs.bioexcel.eu/u/txuko)\
**Post date:** [January 12, 2021, 7:20pm UTC](https://gromacs.bioexcel.eu/t/clustering-different-chains-and-simulations/1421/5 "2021-01-12T19:20:33Z")

</div>

Hi,

yes, it was a typo. I modified a gro file to have only one peptide and it works now.

Thanks a lot.
