Vertex

class Vertex(id, position)[source]

Bases: object

An abstract base class for TopologyGraph vertices.

Notes

You might notice that some of the public methods of this abstract base class are implemented. This is purely for convenience when implementing subclasses. The implemented public methods are simply default implementations, which can be safely ignored or overridden, when implementing subclasses. Any private methods are implementation details of these default implementations.

Methods

clone()

Return a clone.

get_cell()

Get the cell of the lattice in which the vertex is found.

get_id()

Get the id.

get_position()

Get the position.

map_functional_groups_to_edges(...)

Map functional groups to edges.

place_building_block(building_block, edges)

Place building_block on the Vertex.

with_position(position)

Get a clone at a certain position.

with_scale(scale)

Get a clone with a scaled position.

__init__(id, position)[source]

Initialize a Vertex.

Parameters
clone()[source]

Return a clone.

Return type

Vertex

Returns

The clone.

get_cell()[source]

Get the cell of the lattice in which the vertex is found.

Return type

ndarray

Returns

The cell of the lattice in which the vertex is found.

get_id()[source]

Get the id.

Return type

int

Returns

The id.

get_position()[source]

Get the position.

Return type

ndarray

Returns

The position of the Vertex.

map_functional_groups_to_edges(building_block, edges)[source]

Map functional groups to edges.

Each functional group in building_block needs to be assigned to an edge in edges.

Parameters
  • building_block (BuildingBlock) – BuildingBlock The building block which is needs to have functional groups assigned to edges.

  • edges (tuple[Edge, ...]) – The edges to which the vertex is attached.

Return type

dict[int, int]

Returns

A mapping from the id of a functional group in building_block to the id of the edge in edges it is assigned to.

place_building_block(building_block, edges)[source]

Place building_block on the Vertex.

Parameters
  • building_block (BuildingBlock) – The building block molecule which is to be placed on the vertex.

  • edges (tuple[Edge, ...]) – The edges to which the vertex is attached.

Return type

ndarray

Returns

The position matrix of building_block after being placed.

with_position(position)[source]

Get a clone at a certain position.

Parameters

position (ndarray) – The desired position of the clone.

Return type

Vertex

Returns

The clone.

with_scale(scale)[source]

Get a clone with a scaled position.

Parameters

scale (Union[float, tuple[float, float, float]]) – The value by which the position of the Vertex is scaled. Can be a single number if all axes are scaled by the same amount or a tuple of three numbers if each axis is scaled by a different value.

Return type

Vertex

Returns

The clone.