From: Roman Petrenko (rpetrenko_at_gmail.com)
Date: Tue Jul 29 2008 - 15:26:13 CDT

i can offer you definitely not the most elegant solution, but it does
the job done!

-------------------------------------------------------------------------------------------------------
#align the first peptide bond of di-NMA.pdb (should be loaded first)
#with the first peptide bond of NMA.pdb
  set sel1 [atomselect 0 all]
  set sel2 [atomselect 1 all]
  set selC1 [atomselect 0 "resid 1 and name C"]
  set selC2 [atomselect 1 "resid 0 and name C"]
  set coorC1 [lindex [$selC1 get {x y z}] 0]
  set coorC2 [lindex [$selC2 get {x y z}] 0]
  #put C1 in the origin
  $sel1 moveby [vecscale -1.0 $coorC1]
  #put C2 in the origin
  $sel2 moveby [vecscale -1.0 $coorC2]

  #align along CO bond
  set ali1o [lindex [[atomselect 0 "(residue 0 and name O)"] get {x y z}] 0]
  set ali2o [lindex [[atomselect 1 "(residue 0 and name O)"] get {x y z}] 0]
  set v1 [vecnorm $ali1o]
  set v2 [vecnorm $ali2o]
  set vdir [vecnorm [veccross $v1 $v2]]
  set angle [expr -1.0*acos([vecdot $v1 $v2])]
  $sel2 move [trans bond {0.0 0.0 0.0} $vdir $angle rad]

  #align along CN bond
  set ali1n [lindex [[atomselect 0 "(residue 1 and name N) "] get {x y z}] 0]
  set ali2n [lindex [[atomselect 1 "(residue 1 and name N)"] get {x y z}] 0]
  set vdir [vecsub $coorC1 $ali1o]
  set v1 [vecnorm [veccros $ali1n $vdir]]
  set v2 [vecnorm [veccros $ali2n $vdir]]
  set angle [expr -1.0*acos([vecdot $v1 $v2])]
  $sel2 move [trans bond {0.0 0.0 0.0} $vdir $angle rad]
----------------------------------------------------------------------------------------------------

On Tue, Jul 29, 2008 at 10:16 AM, Loison Claire
<cloison_at_lasim.univ-lyon1.fr> wrote:
> Hi VMD users!
>
> There are several messages on alignement in the mailing-list already,
> but to my knwoledge my question was not answered yet.
>
> *) Just to set the background :
> I would like to use vmd to align the peptide bond of a small model amide
> molecule (NMA = CH3-CONH-CH3)
> on a given peptide bond of a protein (here, i have just chosen a di-NMA
> molecule,
> with 2 peptide bonds, for testing : CH3-CONH-CH2-CONH-CH3).
> My idea is to select the CNO atoms of the NMA and align them with the one of
> the CNO bonds of di-NMA
>
> *) Now to the tcl-script problem:
> If the di-NMA.pdb molecule is numbered 0 and the NMA.pdb molecule is
> numbered 1, my tcl script look like :
>
> set selatoms [atomselect 1 " (residue 0 and name C) or (residue 0 and name
> O) or (residue 1 and name N)"]
> puts "NMA selection = [$selatoms get {name residue index}] "
>
> set refatoms [atomselect 0 "(residue 0 and name C) or (residue 0 and name O)
> or (residue 1 and name N) "]
> puts "di-NMA selection = [$refatoms get {name residue index}]"
>
> set tm [measure fit $selatoms $refatoms order {0 1 2 }]
> set all [atomselect 1 "all"]
> $all move $tm
>
> The problem appears because of the atomselect command : it seems to
> reorder the atoms
> with increasing index, which is *NOT* the order of my selection text.
> So the order of the two selection is more or less random, depending on how
> the indexes are in two pdb files.
> Then the measure fit does not complain, but of course the molecule are not
> aligned as expected.
>
> Is there any option for atomselect to impose the order of the atoms ?
> If not, how can I get the right order for the fit procedure ?
>
> Thanks in advance for your help,
> Claire
>
> ps : here are the two (faked) pdb files
> NMA.pdb :
> ATOM 1 CA ALA 0 1.125 1.534 0.000 0.00 0.00 0
> C
> ATOM 2 C ALA 0 0.000 0.514 0.000 0.00 0.00 0
> C
> ATOM 3 O ALA 0 -1.173 0.853 0.000 0.00 0.00 0
> O
> ATOM 4 N ALA 1 0.394 -0.796 0.000 0.00 0.00 0
> N
> ATOM 5 CA ALA 1 -0.546 -1.905 0.000 0.00 0.00 0
> C
> ATOM 6 H1 ALA 1 1.017 2.171 0.880 0.00 0.00 0
> H
> ATOM 7 H2 ALA 1 1.017 2.171 -0.880 0.00 0.00 0
> H
> ATOM 8 H3 ALA 1 1.381 -0.999 0.000 0.00 0.00 0
> H
> ATOM 9 H4 ALA 1 -1.551 -1.486 0.000 0.00 0.00 0
> H
> ATOM 10 H5 ALA 1 -0.420 -2.528 -0.890 0.00 0.00 0
> H
> ATOM 11 H6 ALA 1 2.123 1.091 0.000 0.00 0.00 0
> H
> ATOM 12 H7 ALA 1 -0.420 -2.528 0.890 0.00 0.00 0
> H
>
> di-NMA.pdb
> ATOM 1 HA1 GLY X 1 4.097 2.626 -0.889 1.00300.00
> H
> ATOM 2 O GLY X 1 1.492 4.135 0.000 1.00300.00
> O
> ATOM 3 H GLY X 1 4.097 4.166 0.000 1.00300.00
> H
> ATOM 4 C GLY X 1 2.211 3.139 0.000 1.00300.00
> C
> ATOM 5 CA GLY X 1 3.733 3.139 0.000 1.00300.00
> C
> ATOM 6 HA2 GLY X 1 4.097 2.626 0.889 1.00300.00
> H
> ATOM 7 N GLY X 2 1.680 1.769 0.000 1.00300.00
> N
> ATOM 8 CA GLY X 2 0.256 1.500 0.000 1.00300.00
> C
> ATOM 9 H GLY X 2 2.315 0.984 0.000 1.00300.00
> H
> ATOM 10 C GLY X 2 0.000 0.000 0.000 1.00300.00
> C
> ATOM 11 O GLY X 2 0.860 -0.877 -0.000 1.00300.00
> O
> ATOM 12 HA2 GLY X 2 -0.183 1.932 -0.889 1.00300.00
> H
> ATOM 13 HA1 GLY X 2 -0.183 1.932 0.889 1.00300.00
> H
> ATOM 14 HA1 GLY X 3 -1.591 -2.170 -0.889 1.00300.00
> H
> ATOM 15 H GLY X 3 -3.036 -1.633 0.000 1.00300.00
> H
> ATOM 16 H GLY X 3 -2.107 0.465 0.000 1.00300.00
> H
> ATOM 17 N GLY X 3 -1.441 -0.293 0.000 1.00300.00
> N
> ATOM 18 CA GLY X 3 -1.946 -1.651 0.000 1.00300.00
> C
> ATOM 19 HA2 GLY X 3 -1.591 -2.170 0.889 1.00300.00
> H
>
>
>
>
> --
> ----------------------------------------------------
> Claire LOISON
> Theoretical Physical-Chemistry Group in LASIM
> tel : 00 33 4 72 43 12 57
> cellular : 00 33 6 31 30 11 72
> ----------------------------------------------------
> Laboratoire de Spectrométrie Ionique et Moléculaire UMR 5579
> Domaine Scientifique de la Doua
> Université Claude Bernard Lyon 1 Bâtiment Alfred Kastler
> 43, bd du 11 Novembre 1918
> 69622 Villeurbanne cedex
> ----------------------------------------------------
>
>
>

-- 
Roman Petrenko.
Physics Department
University of Cincinnati