Previous topic

movies module

Next topic

plot module

This Page

pbc_utilities module

Code author: Niklaus Johner <niklaus.johner@a3.epfl.ch>

This module contains some functions to work with periodic boundary conditions.

ProjectVectorOnUnitCellVectors(v, ucell_vecs)[source]

This function project the vector v on the unit cell vectors ucell_vecs, of which the first vector is assumed to be along x and the second in the xy plane.

GetUCellVectorSizeAndAngles(ucell_vecs)[source]

Returns the length of the unit cell vectors and the angles alpha, beta and gamma The first vector has to be along x and the second in the xy plane. First angle is between v1 and v2, the second one between v1 and v3 and the third one between v2 and v3.

FindWithinWithPBC(eh, pos, radius, cell_center, cell_size)[source]

Returns a view containing all the atoms within radius of a point pos (Vec3), using periodic boundary conditions (orthogonal unit cell).

FindWithinWithNonOrthogonalPBC(eh, pos, radius, ucell_vecs, vecs_to_neighbor_ucells=None)[source]

Returns a view containing all the atoms within radius of a point pos (Vec3), using periodic boundary conditions (orthogonal and non-orthogonal unit cell). By default it searches in all neighboring unit cells (first shell of neighboring unit cells), except if a list of vectors to the neighboring unit cells in which to search is passed.

ExtendEntityToNeighboringUnitCells(eh, vecs_to_neighbor_ucells)[source]

Extends an Entity to surrounding unit cells by replicating it and translating it for each vector in vecs_to_neighbor_ucells. For each replica the chains will have the same name as in the original Entity followed by a number corresponding to the index of the vector used for the translation (starting at 1). The translations can be obtained for example from the function VectorsToNeighboringUnitCells().

Parameters:
  • eh (EntityView) – The Entity or EntityView to be extended
  • vecs_to_neighbor_ucells (Vec3List) – List of translations used to extend the entity.
ExtendEntityWithPBC(eh, cell_center, ucell_vecs, extension_size=10)[source]

This function extends an entity to its neighboring unit cell vectors, by a size given by the extension_size in each direction. It’s slower than ExtendEntityToNeighboringUnitCells but allows to extend to small parts of the surrounding unit cells.

BuildUnitCellVectors(a, b, c, alpha, beta, gamma)[source]

Returns the unit cell vectors from their length and angles

VectorsToNeighboringUnitCells(ucell_vecs, level=1)[source]

Returns the vectors to all the neighboring unit cells. level=1 will the vectors to the 26 cells surrounding the central cell, level=2 all the vectors to the first and second shell (124 vectors), etc.

GenerateSearchVectors(v1, v2, v3, level=4, dist_cutoff=None, delta=0.0001)[source]

Returns all the vectors to unit cells within a certain distance of the central cell. The distance is the minimal distance between the neighboring cell and the central cell.