The MoleculeRep class, defined in the Molecule module, is designed to make it easy to keep track of the reps in a molecule and to update reps in many molecules simultaneously. The way it works is to create a MoleculeRep instance, then add it to as many molecules as you want using the Molecule.addRep() method. The only operations on MoleculeRep objects is to change their properties; when this occurs, all molecules to which the rep has been added will be updated. Deleting a MoleculeRep instance has no effect. A list of MoleculeRep instances for a given molecule can be gotten from the Molecule.reps() method.
The MoleculeRep class provides the following methods:
In the following example, we load a molecule, add a new transparent VDW rep to the molecule, then change the atom selection for the rep to "name CA":
>>> from VMD import * >>> from Molecule import * >>> bR=Molecule() >>> bR.load('../proteins/brH.pdb') <snip> >>> reps=bR.reps() >>> reps[0].style 'Lines' >>> vdw=MoleculeRep(style='VDW', material='Transparent') >>> bR.addRep(vdw) >>> vdw.changeSelection('name CA')