| |
- angle(ar1, ar2, ar3, base=1)
- Calculate the angle between three points.
Positional arguments :
ar1 -- first point (ndarray)
ar2 -- second point (ndarray)
ar3 -- third point (ndarray)
their base is given by the keyword argument of the same name
Keyword arguments :
base -- base index (default 1)
Return the angle in grad.
- angle_vectors(ar1, ar2, base=1)
- Calculate the angle between two vectors.
Positional arguments :
ar1 -- first vector (ndarray)
br2 -- second vector (ndarray)
their base is given by the keyword argument of the same name
Keyword arguments :
base -- base index (default 1)
Return the angle in grad.
- boltzmann_distr(energies, energy_units=0, temperature=298.14999999999998)
- Calculate the Boltzmann energy distribution of molecules.
Positional arguments :
energies -- array with the energies of the molecules (null-based)
units of the energies are given by the energy_units
keyword argument
Keyword arguments :
energy_units -- units of the energies (default 0, i.e. hartree)
possible values :
0 -- hartree
1 -- kJ/mol
temperature -- temperature in Kelvin (default 298.15)
Return a null-based ndarray with the percentages of the molecules
(values between 0 to 1).
- boltzmann_factor(wavnu)
- Boltzmann correction.
The correction takes into account the thermal population of vibrational
states. It is applied to the Raman/ROA scattering cross-sections, since they
depend on the temperature at which a sample is measured.
KBoltz = 1 / [1 - exp(- 100 * H * c * wavnu / KB * T)]
Positional arguments :
wavnu -- wavenumber in cm**(-1)
- calc_dcm(frame_ref1, frame_ref2)
- Calculate the direction cosine matrix between two coordinates systems.
Positional arguments :
frame_ref1 -- first frame of reference (null-based ndarray)
shape : (3, 3)
frame_ref2 -- second frame of reference (null-based ndarray)
shape : (3, 3)
The result matrix is an one-based two-dimensional ndarray.
- contract(ar1, ar2)
- Double contract two arrays and return the result as a scalar.
The arrays can be e.g. vectors, matrices, tensors, provided that they are of
the same dimension.
Positional argument :
ar1 -- first array (ndarray)
ar2 -- first array (ndarray)
- contract_t(tens)
- Double contract a second-rank tensor with itself and decompose the result.
The function calls the contract() function for each dinuclear term of the
tensor. The latter can be e.g. a hessian or a V-tensor.
Positional arguments :
tens -- second-rank tensor to be double contracted (one-based ndarray)
shape : (1 + N, 4, 1 + N, 4) with N being the number of atoms
Return a tuple with the total, isotropic, anisotropic and antisymmetric parts
of the double contracted tensor. Their shape : (1 + N, 1 + N).
- cosine(tens1, tens2)
- Calculate the cosinus between two arrays.
Teh cosine is considered to be the result of the double contraction of the
arrays divided by the product of their norms.
Positional arguments :
tens1 -- first array (ndarray)
tens2 -- second array (ndarray)
- crossproduct(ar1, ar2, base=1)
- Calculate the cross-product of two vectors.
Positional arguments :
ar1 -- first vector (ndarray)
ar2 -- second vector (ndarray)
their base is given by the keyword argument of the same name
Keyword arguments :
base -- base index (default 1)
- decompose(mat_)
- Decompose a matrix into the isotropic, anisotropic & antisymmetric parts.
M = M_is + M_anis + M_a
tr = trace(M) / 3
M_is(i,j) = tr * kronecker(i,j)
M_anis(i,j) = [M(i,j) + M(j,i)] / 2 - M_is(i,j)
M_a(i,j) = [M(i,j) - M(j,i)] / 2
Positional arguments :
mat_ -- matrix to be decomposed (one-based ndarray)
shape : (4, 4)
Return a tuple with the isotropic, anisotropic and antisymmetric parts.
- decompose_t(tens)
- Decompose the dinuclear terms of a tensor.
The decompose() function is called for each dinuclear term of the tensor.
Positional arguments :
tens -- second-rank tensor to be decomposed (one-based ndarray)
shape : (1 + N, 4, 1 + N, 4) with N being the number of atoms
Return a tuple with the isotropic, anisotropic and antisymmetric parts of T.
- dihedral(ar1, ar2, ar3, ar4, base=1)
- Calculate the dihedral angle between four points.
Positional arguments :
ar1 -- first point (ndarray)
ar2 -- second point (ndarray)
ar3 -- third point (ndarray)
ar4 -- fourth point (ndarray)
their base is given by the keyword argument of the same name
Keyword arguments :
base -- base index (default 1)
Return the dihedral angle in grad.
- distance(ar1, ar2, base=1)
- Calculate the distance between two points.
Positional arguments :
ar1 -- first point (ndarray)
ar2 -- second point (ndarray)
their base is given by the keyword argument of the same name
Keyword arguments :
base -- base index (default 1)
- fitgauss_params(n_gauss=6)
- Parameters of a least square fitting Gauss functions to the shape of
a Lorentz function with a full width at half-maximum (FWHM) of 1.
For details refer to W. Hug and J. Haesler. Int. J. Quant. Chem. 104:695-715,
2005
Keyword arguments :
n_gauss -- number of Gauss functions (default 6)
Currently the supported range of values is between 3 and 8
Return a ndarray of the dimension (2, n_gauss), each column of which
corresponds to the pair (c_i, a_i).
- inertia_tensor(coords, masses, atom_list=None, move2mass_center=True)
- Calculate the inertia tensor.
Positional arguments :
coords -- coordinates (one-based ndarray)
shape : (1 + N, 4) with N being the number of atoms
masses -- masses (one-based ndarray)
shape : (1 + N,)
Keyword arguments :
atom_list -- list of atoms involved (list, default None)
if None, use all the atoms
move2mass_center -- whether to move to the center of gravity of the atoms
(default True)
Return the inertia tensor as a null-based two-dimensional ndarray.
- is_even_permutation(perm)
- Determine whether a permutation is even.
An even permutation is a permutation that can be produced by an even number
of exchanges.
Positional arguments :
perm -- permutation (tuple)
- kronecker(i, j)
- Kronecker symbol.
/- 1 if i = j
delta(i,j) = |
\- 0 otherwise
Positional arguments :
i -- first index
j -- second index
- levi_civita()
- Return the antisymmetric unit tensor of Levi-Civita.
/-
| +1 if (i,j,k) is an even permutation of (1,2,3)
eps(i,j,k) =| -1 if (i,j,k) is an odd permutation of (1,2,3)
| 0 if at lease two indices are equal
\-
The result tensor is an one-based two-dimensional ndarray.
- make_gcm(mat, groups)
- Generate a group coupling matrix (GCM).
The GCM is obtained by separately adding up intra-group mono- and di-nuclear
terms, and inter-group di-nuclear terms.
For details refer to W. Hug. Chem. Phys., 264(1):53-69, 2001.
Positional arguments :
mat -- matrix (one-based two-dimensional ndarray)
groups -- groups (list)
atom indices are one-based
example : [ [1, 2], [4, 5], [6, 3] ]
Return the GCM. Shape : (1 + N_gr, 1 + N_gr) with N_gr being the number of
groups.
- make_gcp(acp, groups)
- Generate group contribution patterns (GCPs).
The GCPs are obtained by adding the contributions of atoms comprising the
groups.
For details refer to W. Hug. Chem. Phys., 264(1):53-69, 2001.
Positional arguments :
acp -- atomic contribution patterns (one-based ndarray)
it can be generated e.g. with pyviblib.calc.spectra.make_acp()
groups -- groups (list)
atom indices are one-based
example : [ [1, 2], [4, 5], [6, 3] ]
Return the GCP of the length 1 + N_gr with N_gr being the number of groups.
- mass_center(coords, masses, atom_list=None)
- Calculate the center of gravity.
Positional arguments :
coords -- coordinates (one-based ndarray)
shape : (1 + N, 4) with N being the number of atoms
masses -- masses (one-based ndarray)
shape : (1 + N,)
Keyword arguments :
atom_list -- list of atoms involved (list, default None)
if None, use all the atoms
- norm(ar_)
- Calculate the norm of an array.
The norm is considered to be the square root of the double contraction of the
array with itself. The array can be multi-dimensional such as e.g. tensors.
Positional arguments :
ar_ -- array (ndarray)
- normalize_set(set_in, set_out=None, base=1)
- Normalize a set of vectors.
Positional arguments :
set_in -- vectors to be normalized (threes-dimensional ndarray)
their base is given by the keyword argument of the same name
Keyword arguments :
set_out -- where the result is to be placed (default None)
unless given, use set_in
the caller is responsible for memory allocation
base -- base index (default 1)
- orthogonalize_set(set_in, make_orthonormal=True, set_out=None, base=1)
- Orthogonalize a set of vectors using the Gram-Schmidt algorithm.
Positional arguments :
set_in -- vectors to be orthogonalized (threes-dimensional ndarray)
their base is given by the keyword argument of the same name
Keyword arguments :
set_out -- where the result is to be placed (default None)
unless given, use set_in
the caller is responsible for memory allocation
make_orthonormal -- whether the result set is to be normalized
base -- base index (default 1)
- quat2matrix(quat)
- Generate a left rotation matrix from a normalized quaternion.
Positional arguments :
quat -- normalized quaternion (null-based array of the length 4)
The result matrix is an one-based two-dimensional ndarray.
- rotate_t(tens, rotm)
- Rotate the dinuclear terms of a tensor.
Positional arguments :
tens -- second-rank tensor to be rotated (one-based ndarray)
shape : (1 + N, 4, 1 + N, 4) with N being the number of atoms
rotm -- left rotation matrix (one-based ndarray)
shape : (4, 4)
- rotmatrix_axis(axis, phi)
- Generate a matrix of rotation about an arbitrary axis.
Positional arguments :
axis -- axis about which the rotation is being done (null-based ndarray)
phi -- angle in grad
The result rotation matrix is an one-based two-dimensional ndarray.
- savitzky_golay(data, order=2, nl=2, nr=2)
- Smooth data with the Savitzky-Golay algorithm.
The returned smoothed data array has the same dimension as the original one.
Positional arguments :
data -- y data
Keyword arguments :
order -- order of the polynomial (default 2)
nl -- number leftward data points (default 2)
nr -- number leftward data points (default 2)
- signum(num)
- Signum of a number.
/- 1 if x > 0
signum(x) = | 0 if x = 0
\- -1 otherwise
- spatproduct(ar1, ar2, ar3, base=1)
- Calculate the scalar triple product of three vectors.
Positional arguments :
ar1 -- first vector (ndarray)
ar2 -- second vector (ndarray)
ar3 -- third vector (ndarray)
their base is given by the keyword argument of the same name
Keyword arguments :
base -- base index (default 1)
- voigt_norm(arx, n_gauss, fitparams, param_k, param_b)
- Normalized approximate Voigt profile as a combination of Gauss functions.
For details refer to W. Hug and J. Haesler. Int. J. Quant. Chem. 104:695-715,
2005
Positional arguments :
arx -- value (number or an array)
n_gauss -- number of Gauss functions
fitparams -- fit coeffitiens (c_i, a_i)
returned by fitgauss_params()
param_k -- FWHM of the Lorentz curve = 2k
param_b -- Gaussian instrument profile
|