Difference between revisions of "Get Model"

From PyMOLWiki
Jump to: navigation, search
m
m
Line 12: Line 12:
 
===NOTES===
 
===NOTES===
 
It can be useful to loop through all the atoms of a selection (rather than using the iterate command)
 
It can be useful to loop through all the atoms of a selection (rather than using the iterate command)
 
+
<source lang="python">
 
atoms = cmd.get_model("chain A")
 
atoms = cmd.get_model("chain A")
 
for at in atoms.atom:
 
for at in atoms.atom:
 
     print "ATOM DEFINITION: "+at.chain+" "+at.resn+" "+str(at.resi)+" "+at.name+" "+str(at.index)
 
     print "ATOM DEFINITION: "+at.chain+" "+at.resn+" "+str(at.resi)+" "+at.name+" "+str(at.index)
 
+
</source>
  
 
===SEE ALSO===
 
===SEE ALSO===
 
   
 
   
 
[[Category:Commands|get_model]]
 
[[Category:Commands|get_model]]

Revision as of 09:54, 19 May 2005

DESCRIPTION

   "get_model" returns a model object.

PYMOL API

   cmd.get_model(string "selection" )

USAGE

 cmd.get_model("chain A")

NOTES

It can be useful to loop through all the atoms of a selection (rather than using the iterate command)

atoms = cmd.get_model("chain A")
for at in atoms.atom:
    print "ATOM DEFINITION: "+at.chain+" "+at.resn+" "+str(at.resi)+" "+at.name+" "+str(at.index)

SEE ALSO