select a subset of atoms
An atom selection consists of selection string and list of
corresponding atoms. The object emulates a Python sequence, so that
the selected atom.Atoms, or a subset thereof, can be accessed
through the Python  operator. The selection language is defined in
the atomSelLang module. Note that the outer parentheses are not
necessary in AtomSel contruction.
AtomSel(string, simulation, ordered=False)
string is a selection string in the XPLOR selection language.
simulation is an optional simulation.Simulation specification;
it defaults to the current Simulation. Normally AtomSels are use PSF
order, i.e. the atoms are indexed in order of their index values. If
the optional argument ordered is set to True, then the atoms will instead
reflect the order specified by ``or'' statements in the selection
string. See the atomSelLang module documentation to read a description
of how order is preserved with overlapping selections.
Alternatively the string argument can be replaced with a sequence of
atom indices to manually generate an atom selection. In this case
the ordered argument cannot be specified.
If there is an error in the selection string, an exception is raised.
string() return the selection string associated with this AtomSel.
simulation() return the simulation associated with the selection
indices() return list of atom indices associated with the selection
manually set the list of atom indices.
invoke apply_instance's run() function on
each atom in the selection. apply_instance is either
an instance of a class defined in the atomSelAction
module, or a user-defined class which derives from the
atomSelAction.PyAtomSelAction class. Please see
the documentation for the atomSelAction module for
reevaluate() some selections depend on mutable properties
like coordinates. This member reevaluates such a
returns true if the selection includes the atom with the
return True if the selection includes the specified atom.
allValid() return False if any atoms are invalid. Otherwise, return
ordered() whether or not the atoms use OR ordered. If this value is
changed, reevaluate() must be called to update the
Evaluate whether the two AtomSels select one or more of the same atoms.
Evaluate whether the two AtomSels select atoms with the same resid,
resname, and atom names, ignoring any difference in segid.
Return minimum number of residues between atoms in the two AtomSels.
intersection(AtomSel1, ..., createString=True)
Return an AtomSel whose indices() consists of the intersection of
the of the selection arguments. By default, the returned AtomSel can
be reevaluated because a selection string is generated from the input
AtomSels. The computational expense of this can be removed by specifying
createString=False, but then the returned AtomSel cannot be
Return an AtomSel with indices() of AtomSel1 that are not in AtomSel2.
Return an AtomSel whose indices() consists of the union of
all the arguments, which should be AtomSel objects or strings. An
arbitrary number of arguments can be specified. The returned AtomSel cannot be
Return an AtomSel whose indices() consists of all those argument sel's
Simulation but, not in its indices().
Return an AtomSel object from a raw SWIG pointer string. This object
is not managed by Python (i.e. its thisown==False).
Print out positions of alpha carbons in residues 40-43, inclusive.
sel = AtomSel("name CA and resid 40:43")
for atom in sel:
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 4.0.2
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.