Hi Pedro 

It does not work, the pymol crashes if I use this selection

Stéphane

----------------------------------------------------------
Stéphane Abel, Ph.D.
CEA Centre de Saclay
DRF/JOLIOT/I2BC-S/SB2SM/LBMS
Bat 528, Office 138C
Gif-sur-Yvette, F-91191 FRANCE
Phone (portable) : +33 6 49 37 70 60
________________________________________
De : Pedro Lacerda [pslace...@gmail.com]
Envoyé : lundi 22 juin 2020 16:26
À : ABEL Stephane
Cc : pymol-users
Objet : Re: [PyMOL] Python script with iterate_state and selection command

Hi,

Not sure if I understood your code but maybe you want change Myselection to:

Myselection="resname SOL within 3.5 of resname CHO"

-- Pedro Lacerda

Em seg, 22 de jun de 2020 10:44, ABEL Stephane 
<stephane.a...@cea.fr<mailto:stephane.a...@cea.fr>> escreveu:
Hello all,

I would like to write a basic python script to select residues for each state 
using the iterate_state and output the results first in pymol console window 
with the following format

frame 1 : resid ...
frame 2 : resid ...
...

### my script ##

from pymol import cmd, stored

mytraj=""
mytraj2=""

## Load PDB
cmd.load("1JNO_GrA_DMPC_NACL_Membrane_TIP3P_SemiIso_rep3_Water_InChannel_0ns.pdb"),
 mytraj

## Load XTC
cmd.load_traj("1JNO_GrA_DMPC_NACL_Membrane_TIP3P_SemiIso_rep3_Water_InChannel_0_50ns_Every_0.5ns_TRANSLATED.xtc"),
 mytraj2

stored.resid = []

Myselection="select water_channel, resname SOL within 3.5 of resname CHO"

nb_states=cmd.count_states(mytraj2)    ---> Contains 102 states
print(mytraj2, nb_states)

state=1
for i in range (nb_states) :
        print(i)
        cmd.iterate_state (i, (Myselection), 'resid.append(resv)')   ----> 
Should to ireate for all the states
        print("frame " + str(i) + ":" + str(stored.residues))   ---> Print the 
results of the Myselection command in the console

###

But the first problem I have is the syntax of the iterate_state. I obtain the  
following error
"Selector-Error: Invalid selection name "select".
( select water_channel, resname SOL within 3.5 of resname CHO )<--"

When I put this selection command directly in Pymol, it works and i can obtain 
the desired waters that was near 3.5 A of the CHO over all the states . So What 
is the correct syntax for the selection with "iterate_state" ? And how to 
output the results again for each state in the screen .

Thanks in advance for your help

Stéphane


_______________________________________________
PyMOL-users mailing list
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
Unsubscribe: 
https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe


_______________________________________________
PyMOL-users mailing list
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
Unsubscribe: 
https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe

Reply via email to