VMD-L Mailing List
From: Vermaas, Josh (vermaasj_at_msu.edu)
Date: Thu Jul 18 2024 - 15:56:01 CDT
- Next message: Chris Taylor: "Compiling CUDAMarchingCubes.cu build error"
- Previous message: Roni Saiba: "Re: Working with trajectory and updating frames dependents on current frame"
- In reply to: Roni Saiba: "Re: Working with trajectory and updating frames dependents on current frame"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
What Roni said, but can I ask what happens if you happen to have more than one atom selected by patom_index? Measure bond is only supposed to take one pair at a time according to the docs. You can also move the initial atomselections out of the loop like this:
set numframes [molinfo top get numframes]
set solvent_molecues_num 15
set sel_probe [atomselect top "resname ACE NME and name N"]
set sel_solv [atomselect top "resname WAT and name O and within 6.0 of resname ACE NME and name N"]
for { set f 0 } { $f < $numframes } { incr f 1} {
$sel_probe frame $f
#This selection can't change.
# $sel_probe update
$sel_solv frame $f
$sel_solv update
set satom_index_list [$sel_solv get index]
set patom_index [$sel_probe get index]
foreach s_atom $satom_index_list {
### Why is there no loop over patom_index? measure bond I thought only took single indices as arguments... What happens if the length of patom_index is > 1?
set d [measure bond "$s_atom $patom_index"]
lappend l1 [list $s_atom $d]
}
#puts "l1: $l1"
for { set i 0 } { $i < $solvent_molecues_num } { incr i 1} {
lappend l2 "[lindex [lsort -index 1 $l1] $i 0]"
}
#puts "l2: $l2"
set sel_write [atomselect top "resname ACE NME or same residue as index $l2" frame $f]
$sel_write writepdb nma_h2o_within_$f.pdb
$sel_write delete
unset l1 l2 d satom_index_list patom_index s_atom
}
On 7/18/24, 4:36 PM, "owner-vmd-l_at_ks.uiuc.edu <mailto:owner-vmd-l_at_ks.uiuc.edu> on behalf of Roni Saiba" <owner-vmd-l_at_ks.uiuc.edu <mailto:owner-vmd-l_at_ks.uiuc.edu> on behalf of ronis_at_imsc.res.in <mailto:ronis_at_imsc.res.in>> wrote:
In the second for loop the atomselect command should be [atomselect
top "same residue as index $l2" frame $i]. The "frame $i" segment
ensures all frames are selected in order.
Regards,
Roni
Quoting Laura X Sepulveda <lsepcl1_at_lsu.edu <mailto:lsepcl1_at_lsu.edu>>:
> Dear all,
>
> I have this script that is selects the closest 15 water molecules
> closer to residue named ACE NME(from the O distance to the N of ACE
> NME) and writes a pdb file per frame with this selection. However,
> I noticed that the molecules written to the pdb file depend on the
> current frame selected in the main window of VMD. Aren't they
> supposed to be in the order of the for loop? I am updating all
> selections and unsetting all variables, but still the pdb for frame
> n is different if the selected frame on the main window is not the
> same always.
>
> Thanks, in advance!
>
>
>
>
> set numframes [molinfo top get numframes]
> set solvent_molecues_num 15
>
> for { set f 0 } { $f < $numframes } { incr f 1} {
>
> set sel_probe [atomselect top "resname ACE NME and name N"]
> set sel_solv [atomselect top "resname WAT and name O and within 6.0
> of resname ACE NME and name N"]
>
> $sel_probe frame $f
> $sel_probe update
> $sel_solv frame $f
> $sel_solv update
>
> set satom_index_list [$sel_solv get index]
> set patom_index [$sel_probe get index]
>
> foreach s_atom $satom_index_list {
> set d [measure bond "$s_atom $patom_index"]
> lappend l1 [list $s_atom $d]
> }
> #puts "l1: $l1"
>
> for { set i 0 } { $i < $solvent_molecues_num } { incr i 1} {
> lappend l2 "[lindex [lsort -index 1 $l1] $i 0]"
> }
> #puts "l2: $l2"
>
> set sel_write [atomselect top "resname ACE NME or same
> residue as index $l2"]
> $sel_write frame $f
> $sel_write update
> $sel_write writepdb nma_h2o_within_$f.pdb
>
> unset l1 l2 d satom_index_list patom_index s_atom
> sel_probe sel_solv
> }
- Next message: Chris Taylor: "Compiling CUDAMarchingCubes.cu build error"
- Previous message: Roni Saiba: "Re: Working with trajectory and updating frames dependents on current frame"
- In reply to: Roni Saiba: "Re: Working with trajectory and updating frames dependents on current frame"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]