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_energy()
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(coords=None, epoch=3, _Nk=None, Nk=None, unit=None, **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
Methods
__call__([index, coords])Call self as a function.
ascoords(coords)Return argument as a Cartesian object.
copy()Return deep copy of itself
flat()Return flat version of paths
get_acceleration([coords, epoch, index])Return acceleration at each step Get Dx N ndarray, Returns 3xNxP - 1 array, use three point to get acceleration
get_displacements([coords, epoch, index])Return displacements of each steps.
get_velocity([coords, epoch, index])Return velocity at each step Get coords and return DxN or 3xAxN array, two point moving average.
new([coords])Create new Cartesian
- property A¶
Number of individual atoms or components
- property D¶
Total dimension of coords.
- property N¶
Number of steps; coords.shape[-1]
- classmethod ascoords(coords)¶
Return argument as a Cartesian object.
A new Cartesian object is created if necessary.
- copy()¶
Return deep copy of itself
- flat()¶
Return flat version of paths
- get_acceleration(coords=None, epoch=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.
- get_displacements(coords=None, epoch=None, index=slice(None, None, None))¶
Return displacements of each steps. Get coords(array) and return length N array. Useful for plotting E/dist
- Parameters
coords (array) – size of DxN or 3xAxN
epoch (float) – total time spend during transition
index (slice obj; Default np.s_[:]) – Choose the steps want it to be returned. Default is all steps.
- get_velocity(coords=None, epoch=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.
- classmethod new(coords=None)¶
Create new Cartesian