Generator Module¶
Generators¶
- class czone.generator.generator.AmorphousGenerator(origin=None, min_dist=1.4, density=0.1103075, species=6)¶
Bases:
czone.generator.generator.BaseGenerator
Generator object for non-crystal systems.
Generator objects are additive components in Construction Zone. When designing nanostructures, Generators contain information about the arrangement of atoms in space and can supply atoms at least where they should exist.
The AmorphousGenerator object handles non-crystalline systems. Currently supports only monatomic, periodically uniformly disrtributed blocks. Default parameters are set for the purpose of generating amorphous carbon blocks.
- origin¶
Local origin of generator in Cartesian coordinates.
- Type
np.ndarray
- species¶
Atomic number of element used in monatomic generation.
- Type
int
- density¶
Average density of material.
- Type
float
- min_dist¶
Minimum bond distance between atoms.
- Type
float
- old_result¶
Coordinates of atoms in previous generation.
- Type
np.ndarray
- use_old_result¶
Whether or not to re-use previous generation, or to run generation routine again.
- Type
bool
- property density¶
Density of atoms in material.
- property min_dist¶
Minimum bond distance between atoms in material.
- property old_result¶
Atomic coordinates of previous generation, if supply atoms has been called.
- property origin¶
Local origin of Generator in Cartesian coordinates.
- property species¶
Atomic species used in monatomic generation.
- supply_atoms(bbox)¶
Given a bounding region, supply enough atoms to complete fill the region.
- Parameters
bbox (np.ndarray) – Nx3 array defining vertices of convex region
- Returns
Coordinates and species of atoms that fill convex region. Returned as Nx3 and Nx1 arrays.
- class czone.generator.generator.BaseGenerator¶
Bases:
abc.ABC
Base abstract class for Generator objects.
Generator objects are additive components in Construction Zone. When designing nanostructures, Generators contain information about the arrangement of atoms in space and can supply atoms at least where they should exist.
BaseGenerators are typically not created directly. Use the Generator class for crystalline systems, and the AmorphousGenerator class for non-crystalline systems.
- from_generator(**kwargs)¶
Constructor for new Generators based on existing Generator object.
- Parameters
**kwargs – “transformation”=List[BaseTransformation] to apply a series of transformations to the copied generator.
- abstract supply_atoms(bbox: numpy.ndarray)¶
Given a bounding region, supply enough atoms to complete fill the region.
- Parameters
bbox (np.ndarray) – Nx3 array defining vertices of convex region
- Returns
Coordinates and species of atoms that fill convex region. Returned as Nx3 and Nx1 arrays.
- class czone.generator.generator.Generator(origin: Optional[numpy.ndarray] = None, structure: Optional[pymatgen.core.structure.Structure] = None, strain_field: Optional[czone.transform.strain.BaseStrain] = None)¶
Bases:
czone.generator.generator.BaseGenerator
Generator object for crystal systems.
Generator objects are additive components in Construction Zone. When designing nanostructures, Generators contain information about the arrangement of atoms in space and can supply atoms at least where they should exist.
The Generator class handles crystalline systems, primarily by utilizing Structure and Lattice objects from pymatgen, along with an internal Voxel class that maintains the state of the Generator if transformed.
- structure¶
pymatgen Structure object encoding crystallographic details.
- Type
Structure
- lattice¶
Convenience property to grab lattice information from Structure.
- Type
Lattice
- species¶
Atomic numbers for atoms in unit cell.
- Type
np.ndarray
- coords¶
Fractional coordinates of atoms in unit cell.
- Type
np.ndarray
- orientation¶
Orientation of generator. Not used currently.
- Type
np.ndarray
- origin¶
Local origin of generator in Cartesian coordinates.
- Type
np.ndarray
- strain_field¶
Strain field applied to atoms supplied by Generator.
- Type
- property coords¶
Ordered list of fractional coordinates of atoms in unit cell.
- classmethod from_spacegroup(Z: List[int], coords: numpy.ndarray, cellDims: numpy.ndarray, cellAngs: numpy.ndarray, sgn: Optional[int] = None, sym: Optional[str] = None, **kwargs)¶
Convenience constructor for creating Generator with symmetric unit cell from spacegroup.
- Parameters
Z (List[int]) – List of atomic numbers in symmetric sites of unit cell.
coords (np.ndarray) – Nx3 array of fractional coordinates of atoms at symmetric sites in unit cell.
cellDims (List[float]) – Length 3 list with lattice parameters a,b,c of unit cell.
cellAngs (List[float]) – Length 3 list with lattice parameters alpha, beta, gamma of unit cell.
sgn (int) – Space group number of desired space group.
sym (str) – Space group symbol of desired space group as Full International or Hermann-Mauguin symbol. Overriden by sgn, if both supplied.
**kwargs – Any of **kwargs accepted in standard Generator construction.
- Returns
Generator object with structure and symmetry defined by input space group.
- Return type
- classmethod from_unit_cell(Z: List[int], coords: numpy.ndarray, cellDims: numpy.ndarray, cellAngs: numpy.ndarray, **kwargs)¶
Convenience constructor for creating Generators directly from unit cell data.
- Parameters
Z (List[int]) – List of atomic numbers in symmetric sites of unit cell.
coords (np.ndarray) – Nx3 array of fractional coordinates of atoms at symmetric sites in unit cell.
cellDims (List[float]) – Length 3 list with lattice parameters a,b,c of unit cell.
cellAngs (List[float]) – Length 3 list with lattice parameters alpha, beta, gamma of unit cell.
**kwargs – Any of **kwargs accepted in standard Generator construction.
- Returns
Generator object with given unit cell.
- Return type
- property lattice¶
Crystallographic lattice and unit cell information.
- property orientation¶
Orientation of unit cell in space. Not used.
- property origin¶
Local origin of Generator in Cartesian coordinates.
- property post_transform¶
Strain field applied to atoms post-generation.
- property species¶
Ordered list of species in unit cell.
- property strain_field¶
Strain field applied to atoms post-generation.
- property structure¶
pymatgen Structure object encoding crystallographic details.
- supply_atoms(bbox: numpy.ndarray)¶
Given a bounding region, supply enough atoms to complete fill the region.
- Parameters
bbox (np.ndarray) – Nx3 array defining vertices of convex region
- Returns
Coordinates and species of atoms that fill convex region. Returned as Nx3 and Nx1 arrays.
- transform(transformation: czone.transform.transform.BaseTransform)¶
Transform Generator object with transformation described by Transformation object.
- Parameters
transformation (BaseTransform) – Transformation object from transforms module.
- property voxel¶
Voxel object used to span space and keep transformed bases for Generator.
- class czone.generator.generator.NullGenerator¶
Bases:
czone.generator.generator.BaseGenerator
Generator object for empty space.
Generator objects are additive components in Construction Zone. When designing nanostructures, Generators contain information about the arrangement of atoms in space and can supply atoms at least where they should exist.
The NulLGenerator object handles empty space.
- supply_atoms(bbox)¶
Given a bounding region, supply enough atoms to complete fill the region.
- Parameters
bbox (np.ndarray) – Nx3 array defining vertices of convex region
- Returns
Coordinates and species of atoms that fill convex region. Returned as Nx3 and Nx1 arrays.
Amorphous Algorithms¶
- czone.generator.amorphous_algorithms.gen_p_substrate(dims: List[float], min_dist: float = 1.4, density=0.1103075, print_progress=False)¶
Generate a uniformly random distributed collection of atoms with PBC.
Given the size of a rectangular prism, a minimum bond distance, and a target density, generate a uniformly random collection of atoms obeying periodic boundary conditions in X and Y. Dimensions, minimum distance, and density should all be in units of angstroms but can be input in any consistent unit scheme. Default values are for amorphous carbon.
- Generation algorithm loosely follows
Get total number of atoms N to generate.
While substrate contains < N atoms
Generate uniformly random coordinate
Check distance against nearest neighbor atoms to for violation
of bond distance
If not too close to other atoms, add to substrate; else, regenerate
Generation utilizes voxel grid in 3D space for linear scaling of distance calculations and therefore generation time should loosely scale linearly with the volume of the substrate.
- Parameters
dims (List[float]) – Size of rectangular prism substrate in [x,y,z]
min_dist (float) – Minimum seperation between atoms.
density (float) – Density of substrate.
- Returns
coordinates of atoms in periodic substrate
- Return type
np.ndarray
- czone.generator.amorphous_algorithms.get_p_dist(coords, new_coord, dims)¶
Calculate squared periodic distance between a coordinate and all other coordinates in a set.
- czone.generator.amorphous_algorithms.get_tuples(tx, ty, tz)¶
- czone.generator.amorphous_algorithms.get_voxels(min_dist, dims)¶
Get voxel and neighbor list.