stk.GraphState
- class stk.GraphState(building_block_vertices, edges, lattice_constants)[source]
Bases:
objectThe topology graph of a molecule under construction.
Initialize a
_GraphStateinstance.- Parameters:
building_block_vertices (
dict) – Maps eachBuildingBlockto be placed, to atupleofVertexinstances, on which it should be placed.edges (
tupleofEdge) – The edges which make up the topology graph.lattice_constants (
tupleofnumpy.ndarray) – Anumpy.ndarrayfor each lattice constant. Can be an emptytupleif the topology graph is not periodic.
Methods
Get a clone.
Get the building block to be placed on a given vertex.
Yield the building blocks.
Get an edge.
Get the edges connect to a vertex.
Get the lattice constants of the state.
Get the number of times building_block is present.
Get the number of edges in the topology graph.
Get the number of vertices in the topology graph.
Yield the topology graph vertices.
Return a clone holding the lattice_constants.
Returns a clone holding vertices.
- clone()[source]
Get a clone.
- Returns:
The clone. Has the same type as the original instance.
- Return type:
_GraphState
- get_building_block(vertex_id)[source]
Get the building block to be placed on a given vertex.
- Parameters:
vertex_id (
int) – The id of the vertex, on which the building block is to be placed.- Returns:
The building block.
- Return type:
- get_building_blocks()[source]
Yield the building blocks.
Building blocks are yielded in an order based on their position in the topology graph. For two equivalent topology graphs, but with different building blocks, equivalently positioned building blocks will be yielded at the same time.
- Yields:
BuildingBlock– A building block of the topology graph.
- get_lattice_constants()[source]
Get the lattice constants of the state.
- Returns:
The lattice constants.
- Return type:
- get_num_building_block(building_block)[source]
Get the number of times building_block is present.
- Parameters:
building_block (
BuildingBlock) – The building block whose frequency in the topology graph is desired.- Returns:
The number of times building_block is present in the topology graph.
- Return type:
- get_num_edges()[source]
Get the number of edges in the topology graph.
- Returns:
The number of edges.
- Return type:
- get_num_vertices()[source]
Get the number of vertices in the topology graph.
- Returns:
The number of vertices in the topology graph.
- Return type:
- with_lattice_constants(lattice_constants)[source]
Return a clone holding the lattice_constants.
- Parameters:
lattice_constants (
tupleofnumpy.ndarray) – The lattice constants of the clone. Requires 3 arrays of size``(3, )``.- Returns:
The clone holding the new lattice constants. Has the same type as the original instance.
- Return type:
_GraphState