Re: Getting the z coordinate

From: Pawel Kedzierski (pawel.kedzierski_at_pwr.edu.pl)
Date: Mon May 17 2021 - 12:17:31 CDT

W dniu 17.05.2021 o 17:59, Isaac Asare Kwaku pisze:
> Hello guys,
>
> This is more of a tcl script problem but I was hoping I could get some
> help. I am measuring the center of mass of two different residues of a
> protein in VMD. Now I want to find the difference between only the z
> coordinates of the center of mass of the residues. The command
> "measure center $sel weight mass" gives me the x,y,z coordinates of
> the center of mass but I am looking for a way to store just the z
> coordinates so I can find the difference between them. I have tried to
> assign the value of "measure center $sel weight mass" to a variable as
> a list so I use "lindex listname 2" to get the z coordinate. However
> the assignment of the output of the "measure" command has proved
> futile. How do I get only the z coordinate of the center of mass?
>
> Regards,
> Isaac.

Dear Isaac,

Likely you have some Tcl syntax mistake. It works for me like this:

vmd > set all [atomselect top all]
atomselect0
vmd > set cent [measure center $all]
29.005212783813477 17.393484115600586 12.841275215148926
vmd > lindex $cent 2
12.841275215148926

Cheers,

Paweł


This archive was generated by hypermail 2.1.6 : Fri Dec 31 2021 - 23:17:11 CST