Get Model: Difference between revisions

From PyMOLWiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 4: Line 4:
===PYMOL API===
===PYMOL API===
<source lang="python">
<source lang="python">
cmd.get_model(string "selection" )
cmd.get_model(string "selection", integer "state" )
</source>
</source>



Revision as of 13:58, 28 September 2009

DESCRIPTION

get_model returns a model object.

PYMOL API

cmd.get_model(string "selection", integer "state" )

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

SEE ALSO