objects: Manage objects

objects: Manage objects in selection

The objects module keeps track of collections of objects. The most common use is for parsing atom specifiers and tracking what atoms and bonds match.

class AllObjects(session)

Bases: object

Represent all objects in a session. This is a more efficent than Objects, is read-only, and only assembles atoms, bonds, pseudobonds, … when those attributes are used.

class Objects(atoms=None, bonds=None, pseudobonds=None, models=None)

Bases: object

Objects is a collection of models and subparts of models such as atoms. They are produced by evaluating command specifiers.

Objects also can include model instances. Currently models and model instances are independent parts of the collection. Probably models and model instances should always contain exactly the same models. But the current semantics are unclear. Models with atoms appear in the models set even if not all the atoms are in the Objects collection. This needs more thought.

Parameters:
add_atoms(atoms, bonds=False)

Experimental API . Add atoms to collection. If bonds is true also add bonds between specified atoms.

add_bonds(bonds)

Experimental API . Add bonds to collection.

add_model(m)

Experimental API . Add model to collection.

add_model_instances(m, imask)

Experimental API . Add model instances to collection.

add_pseudobonds(pbonds)

Experimental API . Add pseudobonds to collection.

bounds()

Experimental API . Bounds of objects including undisplayed ones in scene coordinates.

displayed()

Experimental API . Return Objects containing only displayed atoms, bonds, pseudobonds and models.

set_bonds(bonds)

Experimental API . Set the bonds to just the given bonds

set_pseudobonds(pbonds)

Experimental API . Set the pseudobonds to just the given pseudobonds