Cartesian
Coordinate representaion of a pathway.
Array Order
Since numpy array uses C like array indexing, we indexed the intermediate image at the last rank. For example, suppose we are creating a pathway on the 2D Múller Brown potential having 15 steps between initial and final state.
>>> import numpy as np
>>> from taps.paths import Paths
>>> paths = Paths()
>>> coords = [np.linspace(-0.558, 0.623, 15), np.linspace(1.44, 0.028, 15)]
>>> paths.coords = coords
>>> print(paths.coords.shape)
(2, 15)
Calculate Kinetic energy
Cartesian contains tools for calculating kinetic property of the pathway. For example,
>>> paths.get_kinetic_energies()
Since the way of calculating kinetic energy entirly depends on the coordinate representation, way of getting kinetic energy is differ with individual coords. Here, we set cartesian coordinate as a default representation.
Cartesian representation
For the atomic system in the cartesian coordinates, we use 3 rank representation where each image is indexed at the last rank. In the atomic representation, ASE can be good tools for building such system. For example, suppose a system having 14 atoms with 300 images between initial and final state, coordinate representation is
>>> import numpy as np
>>> from ase.build import fcc100, add_adsorbate
>>> slab = fcc100('Al', size=(2, 2, 3))
>>> add_adsorbate(slab, 'Au', 1.7, 'hollow')
>>> slab.center(axis=2, vacuum=4.0)
>>> init = slab.positions.T.copy() # shape 3x14
>>> slab[-1].x += slab.get_cell()[0, 0] / 2
>>> fin = slab.positions.T.copy() # shape 3x14
>>> dist = (fin - init) # 3 x 14
>>> N = 300
>>> coords = init[:, np.newaxis] + np.linspace(0, 1, N)[np.newaxis, :] * dist[:, np.newaxis]
>>> print(coords.shape)
(3, 14, 300)
atomic representation is array like object with shape \(3 \times A \times N\) where \(A\) is number of atoms and \(N\) is the number of intermediate images.
Array like
Cartesian is an arraylike object. It would be easier to consider it a numpy array with additional kinetic calculation method. To return only the array,
>>> coords_array = paths.coords[..., :]
If you want to keep the class, but send partial info you can call the coords.
>>> coords_copied = paths.coords(index=np.s_[:])
List of all Methods
- class taps.coords.cartesian.Cartesian(mass=1.0, **kwargs)
Discretized coordinate representaion of a system. In default, system is considered as Cartesian.
- Parameters:
coords (numpy array shape of DxN or 3xAxN) –
epoch (float) – Total transition time of a system
Nk (int) – Number of sine component representation of a system
unit (string) – length unit of a system. Currently it is only for a display purpose. (TODO: automatic unit matching with Model class)
- Attributes:
ANumber of individual atoms or components
DTotal dimension of coords.
NNumber of steps; coords.shape[-1]
- dt
- shap
Methods
__call__([index, coords])Call self as a function.
accelerations(paths[, coords, index])Return acceleration at each step Get Dx N ndarray, Returns 3xNxP - 1 array, use three point to get acceleration
copy()Return deep copy of itself
displacements(paths, **kwargs)Return vector
flat()Return flat version of paths
fluctuate([initialize, cutoff_f, ...])Give random fluctuation
get_kinetics([properties, return_dict])Dumb way of calculate.
simple_coords()Simple line connecting between init and fin
velocities(paths[, coords, index])Return velocity at each step Get coords and return DxN or 3xAxN array, two point moving average.
flatten
get_accelerations
get_displacements
get_distances
get_epoch
get_kinetic_energies
get_kinetic_energy_gradients
get_masses
get_momentums
get_speeds
get_velocities
masses
set_coordinates
similar
- accelerations(paths, coords=None, index=slice(None, None, None))
Return acceleration at each step Get Dx N ndarray, Returns 3xNxP - 1 array, use three point to get acceleration
\(a[i] = (2x[i] - x[i+1] - x[i-1]) / dtdt\)
- Parameters:
coords (array) – size of DxN or 3xAxN
epoch (float) – total time step.
index (slice obj; Default np.s_[:]) – Choose the steps want it to be returned. Default is all steps.
- displacements(paths, **kwargs)
Return vector
- velocities(paths, coords=None, index=slice(None, None, None))
Return velocity at each step Get coords and return DxN or 3xAxN array, two point moving average.
\(v[i] = (x[i+1] - x[i]) / dt\)
- Parameters:
coords (array) – size of DxN or 3xAxN
epoch (float) – total time step.
index (slice obj; Default np.s_[:]) – Choose the steps want it to be returned. Default is all steps.