This is a read-only mirror of pymolwiki.org

Difference between revisions of "Get Model"

From PyMOL Wiki
Jump to navigation Jump to search
m
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
===DESCRIPTION===
 
===DESCRIPTION===
    "get_model" returns a model object.
+
'''get_model''' returns a model object.
+
 
 
===PYMOL API===
 
===PYMOL API===
<source lang="python">
+
<source lang="python">
  cmd.get_model(string "selection" )
+
cmd.get_model(string "selection" )
</source>
+
</source>
+
 
 
===USAGE===
 
===USAGE===
  cmd.get_model("chain A")
+
cmd.get_model("chain A")
  
 
===NOTES===
 
===NOTES===
Line 15: Line 15:
 
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)+" "+at.b+" "+str(at.coords[0])+" "+str(at.coords[1])+" "+str(at.coords[2])  
 
</source>
 
</source>
  
 
===SEE ALSO===
 
===SEE ALSO===
 
 
[[Category:Commands|get_model]]
 
[[Category:Commands|get_model]]

Revision as of 18:39, 26 September 2007

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)+" "+at.b+" "+str(at.coords[0])+" "+str(at.coords[1])+" "+str(at.coords[2])

SEE ALSO