From: Jérôme Hénin (
Date: Thu Jun 01 2017 - 14:45:52 CDT

Hi Jacob,

there is no simple ways to swap the identity of atoms, but you can swap
their coordinates, provided they have exactly the same number of atoms:

proc swapcoords {selA selB} {
  set A [atomselect top "$selA"]
  set B [atomselect top "$selB"]

  set tmp_coords [$A get {x y z}]
  $A set {x y z} [$B get {x y z}]
  $B set {x y z} $tmp_coords

swapcoords "chain A" "chain B"


On 31 May 2017 at 17:37, John Stone <> wrote:

> Hi Jacob,
> This isn't a built-in feature of VMD. You'd either need to write new
> C/C++ code
> to do this, or do it in a script of some sort. None of the obvious options
> for implementing this are very elegant unfortunately.
> Cheers,
> John Stone
> On Sun, May 14, 2017 at 12:28:32AM +0000, Jacob D Durrant wrote:
> > Is it possible to reorder the atoms of a selection prior to output?
> Let me
> > explain my scenario.
> > I have simulated a protein that is a trimer. Let's say it has chain
> IDs A,
> > B, and C. There's a pocket at the interface of each monomer. So
> pocket AB,
> > BC, and CA. I saved the timer trajectory as three different
> trajectories
> > containing the alpha carbons of all protein atoms, as well as all the
> > atoms of the binding-pocket residues. My hope is to concatenate these
> > three trajectories and align them by the alpha carbons. I'll then
> cluster
> > based on the binding-pocket atoms.
> > But to align the concatenated trajectory in VMD, I need to reorder the
> > chains so they line up across the three monomeric trajectories. For
> > pockets AB and CA to line up, for example, I need to align the alpha
> > carbons of chain A to those of chain C, and the alpha carbons of
> chain B
> > to chain A. But that would require me to reverse the order of chain C
> and
> > A in the second trajectory.
> > I hope this makes sense. Thanks for your help!Â
> > --
> >
> > Sent from my mobile.
> --
> NIH Center for Macromolecular Modeling and Bioinformatics
> Beckman Institute for Advanced Science and Technology
> University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
> Phone: 217-244-3349