|
The
group()
method is used to attach a new AtomGroup object of
the Group variety to an existing AtomGroup which
may be the top of the atom hierarchy or an ordinary
Group.
|
Method
Name
|
Applicable
|
Argument
Keywords
|
Return
Value
|
|
group
|
Group
|
"name",
"capacity",
"existing"
|
The
new Group node
|
|
Keyword
|
Argument
|
Purpose
|
Preset
Value
|
|
name
|
required
|
the
name of this Group
|
-
|
|
capacity
|
optional
|
the
capacity of this node
|
1
|
|
existing
|
optional
|
if
0 then this Group does not exist,
otherwise 1 indicates this Group already
exist.
|
0
|
If
the eventual population of the Group is known
beforehand, specify the value for the
capacity
keyword. Otherwise, space is allocated for an
initial population of one and this is expanded one
at a time as needed.
As
with Atoms, the existing
keyword must not contradict the status of the
Group. If the Group already exist, and the value
specified for capacity
is at least as large as the current population,
then the capacity of the Group is adjusted to this
value. This is one way to get rid of excess
capacity.
In
the following example, a single group is attached
to the top of a newly created hierarchy. The first
argument, the name must always be specified so we
did that without the keyword. The value specified
for the second argument is used to allocate space
for 300 descendants. Finally, since we do not save
the return value of the method call, the returned
object, the newly created Group node, is
printed:
>>> from Yup.Taro.AtomMap import * >>> from Yup.Tools.misc import datasource >>> Model = AtomMap( datasource( 'TestTube' ) ) >>> >>> Model.group( "first", capacity = 300 ) +first /0:0\
>>>
|
|