Technical Documentation
ATOM VECTOR: New

An Atom Vector (AV) is created using the AtomVector() function. This function creates what is called an Entire AV. See the [Subscript] page for the Extract variant. The Extract variant can also be created using the Extract() function; see the [Functions] page.

Function Name
Argument Keywords
Return Value
AtomVector
"template", "numatom", "numdimen", "value", "spread", "copy", "sample", "seed"
The new Atom Vector
Keyword
Argument
Value
Preset Value
template
exactly one required
The root node of an Atom Map
-
numatom
Number of Atoms
-
numdimen
optional
Number of Dimensions
3
value
optional: no more than one to be specified
one double precision floating point value
0
spread
an AV with one dimension of the same length as that of the newly created AV and the other dimension is one.
-
copy
an AV of the same shape as the newly created AV
-
sample
"UNIFORM", "GAUSSIAN", "INVERSEMASS" or "CHARGE"
-
seed
optional
seed for the random number generator
0

An AV may be associated with an Atom Map. Such AVs are called Mapped AVs and are created by specifying the root node of an Atom Map as the value for the template keyword. Mapped AVs can be extracted (see Subscript) and the extracts can be manipulated separately. In the following example, Top is the root node of an Atom Map (see this example which will appear in a separate window).

>>> from Yup.Taro.AtomVect import *
>>> R = AtomVector( Top )
>>> R.numatom, R.numdimen, R.type
(16, 3, 'Entire-Mapped')

Note that template is the keyword for the first argument and therefore we can leave it out as we have done in the example. After creating the new AV we print out three data attributes. The number of atoms is equal to the number of atoms in the Atom Map Top. The number of dimensions is three, which is the preset value, that we did not override. We also print out the type: R is an Entire AV that is mapped.

In the following example, we create an Anonymous AV, i.e., an AV that is not associated with an Atom Map.

>>> M = AtomVector( numatom=R.numatom, numdimen=1 )
>>> M.numatom, M.numdimen, M.type
(16, 1, 'Entire-Anonymous')

An anonymous AV is created by not specifying an Atom Map in which case we have to specify the number of atoms that we make equal to the number of atoms in R and which we created in the first example. We also specify the number of dimensions to be one. When we print out the type attribute we can see that M is still an Entire AV but it is Anonymous. An Extract of this Atom Vector can be created using the Extract() function, see the Functions page for the procedure.

The last arguments are optional. See the fill() method in the Methods page for details. Only one out of the last four arguments can be specified or none of these arguments is to be specified. If none is specified, value=0 is assumed. This fills the newly created AV with zeros.

In the third line of the last example (below), we create a new AV with the same number of atoms as in R (created in the first example) and we fill the new AV with numbers from the Normal distribution. The new AV is then combined with another AV called SD which has the same number of atoms as the new AV but has only one dimension. See the Operators page for an explanation of the | operator.

>>> SD.numatom, SD.numdimen, SD.type
(16, 1, 'Entire-Anonymous')
>>> V = AtomVector( numatom=R.numatom, sample='GAUSSIAN' ) | SD
>>> V.numatom, V.numdimen, V.type
(16, 3, 'Entire-Anonymous')

The AV created by the AtomVector() function is not saved but is used in an operation (and discarded after use) and the result of the operation is saved in the variable V. Thus, AtomVector() is still responsible for the creation of a new AV, although indirectly.

The last argument is optional. If a non-zero number is specified, the random number generator is seeded with this value.

Intro
New
Print
Compare
Operators
Data
Methods
Functions
Subscript
Files

Technical
Introduction
Directory
Vectors
Energy
Model
Assembly
Methods
FPF
FFF
AVF
TaroScript
YammpScript
Python
Utilities

Home
Information
News
User
Technical
Programmer
iYup
Download
Showcase
ETC