Previous Thread
Next Thread
Print Thread
How to get the distance between two atoms ?
#37459 04/07/19 04:10 PM
Joined: Jul 2009
Posts: 8
S
small_z Offline OP
Forum Member
OP Offline
Forum Member
S
Joined: Jul 2009
Posts: 8
For example:
I have 2 special atoms in my protein, one is O, the other is N, and I want to calculate the distance (get the value) between O and N, so what kind of command or keyword should I use in my script ?

Thank you very much !

Re: How to get the distance between two atoms ?
small_z #37460 04/07/19 04:21 PM
Joined: Sep 2003
Posts: 8,470
rmv Online Content
Forum Member
Online Content
Forum Member
Joined: Sep 2003
Posts: 8,470
For a single coordinate set, either COOR DIST (corman.doc) or the QUICK command (miscom.doc) would work.

For a time series of the distance from a simulation, the DISTance time series (correl.doc) is probably the best choice.

The key is often figuring how to identify the atoms, i.e. what is the syntax implied by atom-spec


Rick Venable
computational chemist

Re: How to get the distance between two atoms ?
small_z #37461 04/07/19 04:28 PM
Joined: Jul 2009
Posts: 8
S
small_z Offline OP
Forum Member
OP Offline
Forum Member
S
Joined: Jul 2009
Posts: 8
I write the script as the following, but it does not work.
----------------------------------------------------
coor dist sele resid @Sresi .and. type @Stype end -
sele resid @ires .and. type HN end
set ROHN ?dist

coor dist sele ires @Sires .and. type OH2 end -
sele resid @ires .and. type HN end
set RO2HN ?dist

if @RO2HN .LT. @ROHN then

-----------------------------------------------
Can you tell me what is wrong ?

Last edited by small_z; 04/07/19 04:29 PM.
Re: How to get the distance between two atoms ?
small_z #37462 04/07/19 04:32 PM
Joined: Jul 2009
Posts: 8
S
small_z Offline OP
Forum Member
OP Offline
Forum Member
S
Joined: Jul 2009
Posts: 8
How can I get the value of 'dist' ?

Re: How to get the distance between two atoms ?
small_z #37463 04/07/19 05:08 PM
Joined: Sep 2003
Posts: 4,778
Likes: 2
Forum Member
Online Content
Forum Member
Joined: Sep 2003
Posts: 4,778
Likes: 2
Not really; we don't even know what you mean when you say "it does not work". How about posting the output so that we can see what the error is, and when it occurs?
It is also a good idea to avoid using variables (@Sresi etc) when submitting questions since it is very difficult to know what the variable contains.

You may also want to consult doc/subst.doc to find out about "?dist"


Lennart Nilsson
Karolinska Institutet
Stockholm, Sweden
Re: How to get the distance between two atoms ?
small_z #37464 04/07/19 05:35 PM
Joined: Sep 2003
Posts: 8,470
rmv Online Content
Forum Member
Online Content
Forum Member
Joined: Sep 2003
Posts: 8,470
Since COOR DIST can return a long list of distances depending on the atom selections, there is no provision to store the result as a scalar ? variable.

When given two atoms, the QUICK command does set the ?DIST variable, as noted in subst.doc


Rick Venable
computational chemist

Re: How to get the distance between two atoms ?
small_z #37465 04/07/19 11:02 PM
Joined: Jul 2009
Posts: 8
S
small_z Offline OP
Forum Member
OP Offline
Forum Member
S
Joined: Jul 2009
Posts: 8
Thank you. I got it.


Moderated by  lennart, rmv 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 5.6.33-0+deb8u1 Page Time: 0.011s Queries: 28 (0.004s) Memory: 0.9411 MB (Peak: 1.0479 MB) Data Comp: Off Server Time: 2020-07-11 04:05:51 UTC
Valid HTML 5 and Valid CSS