sphractal.utils
Module Contents
Functions
|
Return time taken to run a function. |
|
Return the minimum and maximum values of each dimension of a set of coordinates. |
|
Parse an xyz or a lmp file. |
Return a list of vectors corresponding to the standard 26 directions from a point. |
|
|
Compute the nearest neighbour list and average bond length for each atom. |
|
Return tetrahedrons with their circumsphere radii smaller than a specified alpha value. |
|
Remove triangles that occur twice (internal triangles). |
|
Return points that form the surface using alpha shape algorithm. |
|
Return the indices of surface atoms. |
|
Divide a list of atomic neighbours into two based on whether they lie on the surface. |
|
Return Euclidean distance between two points. |
|
Compute ID pairs of a set of neighbouring atoms, ordered by distance from a given point. |
|
Return two closest surface atom pairs from a given point, that are neighbour of each other. |
|
Return whether a point lies opposite of the average coordinates of neighbouring inner atoms of a given atom. |
- sphractal.utils.getMinMaxXYZ(atomsXYZ)[source]
Return the minimum and maximum values of each dimension of a set of coordinates.
- sphractal.utils.allDirVecs()[source]
Return a list of vectors corresponding to the standard 26 directions from a point.
- sphractal.utils.findNN(atomsRad, atomsXYZ, minXYZ, maxXYZ, maxAtomRad, radMult=1.2, calcBL=False)[source]
Compute the nearest neighbour list and average bond length for each atom.
- Parameters:
atomsRad (1D ndarray of floats) – Radius of each atom.
atomsXYZ (2D ndarray of floats) – Cartesian coordinates of each atom.
minXYZ (1D ndarray of floats) – Minimum values of each dimension in the Cartesian space.
maxXYZ (1D ndarray of floats) – Maximum values of each dimension in the Cartesian space.
maxAtomRad (Union[int,float]) – Maximum value of atomic radius.
radMult (Union[int,float]) – Multiplier to the atomic radii.
calcBL (bool, optional) – Whether to compute the average bond length for each atom.
- Returns:
atomsNeighIdxsPadded (2D ndarray of ints) – Neighbour atoms indices of each atom, padded with -1 for fixed number of columns.
atomsAvgBondLen (1D ndarray of floats) – Average bond lengths for each each.
- sphractal.utils.findTetras(tetraVtxsIdxs, r, alpha)[source]
Return tetrahedrons with their circumsphere radii smaller than a specified alpha value.
- sphractal.utils.alphaShape(atomsXYZ, tetraVtxsIdxs, alpha)[source]
Return points that form the surface using alpha shape algorithm.
Algorithm modified from https://stackoverflow.com/questions/26303878/alpha-shapes-in-3d Radius of the sphere fitting inside the tetrahedral < alpha (http://mathworld.wolfram.com/Circumsphere.html)
- sphractal.utils.findSurf(atomsXYZ, atomsNeighIdxs, option='alphaShape', alpha=3.0, bulkCN=12)[source]
Return the indices of surface atoms.
- Parameters:
atomsXYZ (2D ndarray of floats) – Cartesian coordinates of each atom.
atomsNeighIdxs (2D ndarray of ints) – Neighbour atoms indices of each atom.
option ({'alphaShape', 'convexHull', 'numNeigh'}, optional) – Algorithm to identify the spheres on the surface. ‘convexHull’ tends to identify less surface atoms; ‘numNeigh’ tends to identify more surface atoms. ‘alphaShape’ is a generalisation of ‘convexHull’.
alpha (Union[int, float], optional) – ‘alpha’ for the alpha shape algorithm, only used if ‘option’ is ‘alphaShape’.
bulkCN (int, optional) – Minimum number of neighbouring atoms for a non-surface atom.
- Returns:
atomsSurfIdxs – Indices of surface atoms.
- Return type:
1D ndarray of ints
Notes
Other alternatives include: - https://dl.acm.org/doi/abs/10.1145/2073304.2073339 - https://onlinelibrary.wiley.com/doi/pdf/10.1002/jcc.25384 - https://www.jstage.jst.go.jp/article/tmrsj/45/4/45_115/_article
- sphractal.utils.findAtomNeighs(neighIdxs, atomsSurfIdxs)[source]
Divide a list of atomic neighbours into two based on whether they lie on the surface.
- sphractal.utils.getOrdSurfNeighCombs(surfNeighDists, surfNeighIdxs)[source]
Compute ID pairs of a set of neighbouring atoms, ordered by distance from a given point.