porems.dice.
Dice
(mol, size, is_pbc)¶This class splits the molecule into smaller sub boxes and provides parallelized functions for pair-search.
The aim is reducing the workload on search algorithms for atom pairs. Normally the computational effort would be
with the number of atoms \(n\), because each atom has to be compared with all other atoms.
Since a bond distance is fixed, the idea is reducing the search space by dividing the molecule box into cubes and only performing the pair-search within these smaller boxes and their 26 immediate neighbors. Assuming that the grid structure is ideal in a geometrical sense, that all bond length and angles are constant, the number of atoms in each cube are a constant \(b\). The computational effort for each atom is thus a constant
Therefore, the computational effort for an entire search scales linear with the number of cubes. For example, doubling the cristobalite block size only increases the effort eightfold.
Furthermore, the search is easily parallelizable, since no communication is needed between the subprocesses that each cover a set of cubes. The effort therefore has an ideal speedup.
Note that the cube size must be strictly greater than the intended bond length searches.
Parameters: |
|
---|
Management
_fill (self) |
Based on their coordinates, the atom ids, as defined in the molecule object, are filled into the cubes. |
_pos_to_index (self, position) |
Calculate the cube index for a given position. |
_split (self) |
Here the number of cubes is calculated for each dimension for the defined cube size and molecule dimension. |
Iterator
_right (self, index) |
Step one cube to the right considering the x-axis. |
_left (self, index) |
Step one cube to the left considering the x-axis. |
_top (self, index) |
Step one cube to the top considering the y-axis. |
_bot (self, index) |
Step one cube to the bottom considering the y-axis. |
_front (self, index) |
Step one cube to the front considering the z-axis. |
_back (self, index) |
Step one cube to the back considering the z-axis. |
_step (self, dim, step, index) |
Helper function for iterating through the cubes. |
neighbor (self, cube_id[, is_self]) |
Get the ids of the cubes surrounding the given one. |
Search
find_bond (self, cube_list, atom_type, distance) |
Search for a bond in the given cubes. |
find_parallel (self, cube_list, atom_type, …) |
Parallelized bond search of function find_bond() . |
Setter Methods
set_pbc (self, pbc) |
Turn the periodic boundary conditions on or off. |
Getter Methods
get_count (self) |
Return the number of cubes in each dimension. |
get_mol (self) |
Return the molecule. |
get_origin (self) |
Return the origin positions of the cubes. |
get_pointer (self) |
Return the list of atoms in each cube. |
get_size (self) |
Return the cubes size. |