Topic Options
#37459 - 04/07/19 12:10 PM How to get the distance between two atoms ?
small_z Offline
Forum Member

Registered: 07/15/09
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 !

Top
#37460 - 04/07/19 12:21 PM Re: How to get the distance between two atoms ? [Re: small_z]
rmv Offline

Forum Member

Registered: 09/17/03
Posts: 8379
Loc: 39 03 48 N, 77 06 54 W
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


Top
#37461 - 04/07/19 12:28 PM Re: How to get the distance between two atoms ? [Re: small_z]
small_z Offline
Forum Member

Registered: 07/15/09
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 ?


Edited by small_z (04/07/19 12:29 PM)

Top
#37462 - 04/07/19 12:32 PM Re: How to get the distance between two atoms ? [Re: small_z]
small_z Offline
Forum Member

Registered: 07/15/09
Posts: 8
How can I get the value of 'dist' ?

Top
#37463 - 04/07/19 01:08 PM Re: How to get the distance between two atoms ? [Re: small_z]
lennart Offline

Forum Member

Registered: 09/25/03
Posts: 4742
Loc: ~ 59N, 15E
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

Top
#37464 - 04/07/19 01:35 PM Re: How to get the distance between two atoms ? [Re: small_z]
rmv Offline

Forum Member

Registered: 09/17/03
Posts: 8379
Loc: 39 03 48 N, 77 06 54 W
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


Top
#37465 - 04/07/19 07:02 PM Re: How to get the distance between two atoms ? [Re: small_z]
small_z Offline
Forum Member

Registered: 07/15/09
Posts: 8
Thank you. I got it.

Top

Moderator:  John Legato, lennart