nanotools.geometry module

Created on Mon Sep 7 14:07:51 2015

@author: Vincent

nanotools.geometry.cartesian(arrays, out=None)[source]

Generates a cartesian product of input arrays.

Source

Parameters:
  • arrays (list of array-like) – 1-D arrays to form the cartesian product of.

  • out (ndarray) – Arrays to place the cartesian product in.

Returns:

2-D array of shape (M, len(arrays)) containing cartesian products formed of input arrays.

Return type:

out (ndarray)

nanotools.geometry.cell_in_range(point, rad, avec, issym=False)[source]

Computes the indices of the unit cells that are overlapping with the circumscribed polyhedron.

Parameters:
  • point (1D array) – Sphere center coordinates.

  • rad (float) – Sphere radius.

  • avec (2D array) – Lattice vectors.

Returns:

poly (2D array)

Interacting unit cell bounds.

nanotools.geometry.circum_poly(rad, avec)[source]

Computes the polyhedron defined by avec circumscribing the sphere (point, rad).

Row-vectors are given in avec. The circumscribing polyhedron is centred at the same point as the sphere and extends +- bvec*avec

Parameters:
  • rad (float) – Sphere radius.

  • avec (2D array) – Lattice vectors.

Returns:

Translation factors.

Return type:

bvec (1D array)

nanotools.geometry.circum_sphere(avec)[source]

Computes the sphere circumscribing the polyhedron defined by avec.

Row-vectors are given in avec. The circumscribing sphere is centred at the same point as the polyhedron.

Parameters:

avec (2D array) – Lattice vectors.

Returns:

Sphere radius.

Return type:

rad (float)

nanotools.geometry.distmat(a, b, bc=[0, 0, 0])[source]

Computes the distance matrix between two sets of points.

If boundary conditions are not trivial, the domain is assumed to be periodic and the function returns the distance to the closest image.

Parameters:
  • a (2D array) – Stack of row-vectors.

  • b (2D array) – Stack of row-vectors.

  • bc (1D array) – Domain length, if zero the domain is assumed to be infinite.

Returns:

Distance matrix.

Return type:

dist (2D array)

nanotools.geometry.distmatmetric(a, b, m)[source]

Computes the difference vectors between two sets of points.

Parameters:
  • a (2D array) – Stack of row-vectors.

  • b (2D array) – Stack of row-vectors.

  • m (2D array) – Metric.

Returns:

dist (3D array)

Difference vectors (along last dimension).

nanotools.geometry.grid(nvec, avec)[source]

Computes the grid point coordinates.

Parameters:
  • nvec (1D array) – Grid count.

  • avec (2D array) – Lattice vectors.

Returns:

gd (2D array)

Grid points.

nanotools.geometry.phase(nvec, avec, k)[source]

Computes the k-vector phase on a real space grid.

Parameters:
  • nvec (1D array) – Grid count.

  • avec (2D array) – Lattice vectors.

  • k (1D array) – K-point.

Returns:

ph (1D array)

Real space phase on a grid.

nanotools.geometry.vectmat(a, b)[source]

Computes the difference vectors between two sets of points.

Parameters:
  • a (2D array) – Stack of row-vectors.

  • b (2D array) – Stack of row-vectors.

Returns:

dist (3D array)

Difference vectors (along last dimension).