|
Currently,
the AtomVect
module defines ten functions. Two functions are
documented on other pages.
The
AtomVector()
function is used to create a new Atom Vector
(AV). This is documented on the
[New]
page.
The
MapAndVector()
function is used to create a new Atom Map and
Atom Vector from an Atom Vector file (AVF). This
is documented on the [Files]
page.
This
page documents these eight functions:
The
DotProduct()
function takes two AV arguments, and forms the
scalar product of the two vectors and returns the
scalar value.
|
Function
Name
|
Number
of Arguments
|
Return
Type
|
Return
Value
|
|
DotProduct
|
2
|
Python
float
|
the
scalar product
|
|
Keyword
|
Argument
|
Value
|
Preset
Value
|
|
-
|
required
|
the
first AV
|
-
|
|
-
|
required
|
the
second AV
|
-
|
The
AVs must be conformal, but may otherwise be of any
variant. Example:
>>> from Yup.Taro.AtomVect import * >>> A = AtomVector( numatom=2, sample='UNIFORM' ) >>> B = AtomVector( numatom=2, sample='GAUSSIAN' ) >>> A AtomVector[2:3] { -0.0277413 0.648549 0.382733 -0.0690634 -0.89526 0.656545 }
>>> B AtomVector[2:3] { -0.402081 1.03964 1.3343 1.02185 -0.919675 -0.921506 }
>>> DotProduct( A, B ) 1.3438602284342707 >>>
|
Page
Index
The
DotPerAtom()
function takes two AV arguments, and forms the
scalar product for each atom, across the dimension
axis. The result is an AV with one dimension and
the same number of atoms as the AVs in the argument
list. The vector equivalent is the vector product
operator.
|
Function
Name
|
Number
of Arguments
|
Return
Type
|
Return
Value
|
|
DotPerAtom
|
2
|
AtomVector
|
the
scalar product for each
atom
|
|
Keyword
|
Argument
|
Value
|
Preset
Value
|
|
-
|
required
|
the
first AV
|
-
|
|
-
|
required
|
the
second AV
|
-
|
The
AVs must be conformal. The dimension axis may be of
any length. This is quite different from the Vector
product operator where the number of dimensions
must be exactly three. This example is a follow-on
to the previous one:
>>> DotPerAtom( A, B ) AtomVector[2:1] { 1.19609 0.147766 }
>>>
|
Note
that the result is an AV which is printed since it
is not assigned to a variable.
Page
Index
The
Reduction()
function takes the AV specified in the first
argument and returns a new AV which is the
reduction of the first AV in the dimension
specified in the second argument.
|
Function
Name
|
Number
of Arguments
|
Return
Type
|
Return
Value
|
|
Reduction
|
2
|
AtomVector
|
the
reduced AV
|
|
Keyword
|
Argument
|
Value
|
Preset
Value
|
|
-
|
required
|
the
AV to be reduced
|
-
|
|
-
|
required
|
the
dimension to be reduced
|
-
|
The
dimension to be reduced must be 0 (the atoms axis)
or 1 (the dimension axis) only. No other value is
acceptable. The reduction is the sum of the items
of the axis that is to be reduced. Continuing with
the example:
>>> Reduction( A, 0 ) AtomVector[1:3] { -0.0968047 -0.246712 1.03928 }
>>> Reduction( B, 1 ) AtomVector[2:1] { 1.97186 -0.81933 }
>>> Reduction( DotPerAtom( A, B ), 0 ) AtomVector[1:1] { 1.34386 }
>>>
|
Note
the last example, and compare with the last result
in the first example.
Page
Index
The
Extract()
function takes the AV specified in the first
argument and returns an extract (slice) of it. The
source AV must be Entire but can be Anonymous. The
extract is from the atom number specified in the
second argument to the atom number one less than
the number specified in the optional last argument.
If the last argument is not provided, a one-atom
extract will be returned.
The
normal way of obtaining an extract AV is by
subscripting with an atom map as key. This function
provides for the cases when subscripting is not
possible or convenient.
|
Function
Name
|
Number
of Arguments
|
Return
Type
|
Return
Value
|
|
Extract
|
3
|
AtomVector
|
the
extract AV
|
|
Keyword
|
Argument
|
Value
|
Preset
Value
|
|
-
|
required
|
the
source AV
|
-
|
|
-
|
required
|
first
atom number of the extract
|
-
|
|
-
|
optional
|
one
more than the last atom number of the
extract
|
-
|
If
the last argument is not specified, it is assumed
to be one more than the number specified in the
second argument. In other words, Extract( A, i ) is
a one-atom slice of Atom Vector A at atom-i; this
is equivalent to Extract( A, i, i + 1 ).
Whether
the source AV is mapped or anonymous, the resulting
extract is always anonymous.
Page
Index
The
TransMatrix()
function returns a tuple containing the first 12
elements of the transformation matrix that
correspond to the three rotation angles and three
displacements that are supplied. This function uses
the same subroutine as the transform()
method.
|
Function
Name
|
Number
of Arguments
|
Return
Type
|
Return
Value
|
|
TransMatrix
|
2
|
tuple
of doubles
|
the
transformation matrix
|
|
Keyword
|
Argument
|
Value
|
Preset
Value
|
|
-
|
required
|
tuple
of three floating point values
(radians)
|
-
|
|
-
|
optional
|
tuple
of three floating point values
(Angstroms)
|
(
0.0, 0.0, 0.0 )
|
The
values of the first argument are checked. The
values must be between minus and plus
PI.
This
function does not yield the last row of the
transformation matrix which is always [0 0 0
1].
At
this time, the rotation is carried out in a left
handed coordinate frame. First, a rotation about
the Z-axis by the angle specified in the first
argument. Then about the new Y-axis by the angle
supplied in the second argument. The final rotation
is about the twice rotated Z-axis by the angle
supplied in the third argument. The translations
are to be carried last, by the amounts supplied in
the last three arguments. The specifics of the
rotation are not important. If these operations are
changed in the future, the transformation matrix
obtained from this function will still be
correct.
Page
Index
The
Distance()
function takes two AV arguments, and returns the
distance (Angstroms) between the atoms represented
by the AVs.
|
Function
Name
|
Number
of Arguments
|
Return
Type
|
Return
Value
|
|
Distance
|
2
|
Python
float
|
the
distance in Angstroms
|
|
Keyword
|
Argument
|
Value
|
Preset
Value
|
|
-
|
required
|
the
first AtomVector
|
-
|
|
-
|
required
|
the
second AtomVector
|
-
|
The
AVs may be of any dimensions but both AVs must be
of the same dimension. Each AV should be for only
one atom (it may be an Extract for example). The
calculation of the distance will use only the
coordinates of the first atom of each
AV.
Page
Index
The
Angle()
function takes three AV arguments, and the angle
(degrees) formed by the atoms represented by the
AVs will be returned. The second AV is that of the
vertex atom.
|
Function
Name
|
Number
of Arguments
|
Return
Type
|
Return
Value
|
|
Angle
|
3
|
Python
float
|
the
angle in degrees
|
|
Keyword
|
Argument
|
Value
|
Preset
Value
|
|
-
|
required
|
the
first AtomVector
|
-
|
|
-
|
required
|
the
second AtomVector (vertex
atom)
|
-
|
|
-
|
required
|
the
third AtomVector
|
-
|
The
AVs may be of any dimensions but all AVs must be of
the same dimension. Each AV should be for only one
atom (it may be an Extract). The calculation of the
angle will use only the coordinates of the first
atom of each AV.
Page
Index
The
Torsion()
function takes four AV arguments, and the torsion
angle (degrees) formed by the atoms represented by
the AVs will be returned. The torsional angle is
about a line through the atoms represented by the
second and third AVs.
|
Function
Name
|
Number
of Arguments
|
Return
Type
|
Return
Value
|
|
Torsion
|
4
|
Python
float
|
the
torsion angle in degrees
|
|
Keyword
|
Argument
|
Value
|
Preset
Value
|
|
-
|
required
|
the
first AtomVector
|
-
|
|
-
|
required
|
the
second AtomVector
|
-
|
|
-
|
required
|
the
third AtomVector
|
-
|
|
-
|
required
|
the
fourth AtomVector
|
-
|
All
the AVs must have exactly three dimensions. Each AV
should be for only one atom (it may be an Extract).
The calculation of the torsional angle will use
only the coordinates of the first atom of each
AV.
Page
Index
|