Covalent Organic Framework

For usage examples see COF.

  1. Honeycomb

  2. Hexagonal

  3. Square

  4. Kagome

  5. LinkerlessHoneycomb

class COF(lattice_size, periodic=False, vertex_alignments=None, num_processes=1)

Bases: stk.molecular.topology_graphs.topology_graph.TopologyGraph

Represents a COF topology graph.

COF topologies are added by creating a subclass which defines the vertices and edges of the topology as class attributes.

vertex_data

A class attribute. Holds the data of the vertices which make up the topology graph.

Type

tuple of VertexData

edge_data

A class attribute. Holds the data of the edges which make up the topology graph.

Type

tuple of EdgeData

vertices

The vertices which make up the topology graph.

Type

tuple of Vertex

edges

The edges which make up the topology graph.

Type

tuple of Edge

Examples

COF instances can be made by supplying only the lattice size (using Honeycomb as an example)

import stk

bb1 = stk.BuildingBlock('NCCN', ['amine'])
bb2 = stk.BuildingBlock('O=CC(C=O)C=O', ['aldehyde'])
cof1 = stk.ConstructedMolecule(
    building_blocks=[bb1, bb2],
    topology_graph=stk.cof.Honeycomb((2, 2, 1))
)

Different structural isomers of COFs can be made by using the vertex_alignments optional parameter

lattice = stk.cof.Honeycomb(
    lattice_size=(2, 2, 1),
    vertex_alignments={0: 1, 2: 2}
)
cof2 = stk.ConstructedMolecule(
    building_blocks=[bb1, bb2],
    topology_graph=lattice
)

The parameter maps the id of a vertex to a number between 0 (inclusive) and the number of edges the vertex is connected to (exclusive). So a vertex connected to three edges can be mapped to 0, 1 or 2.

You can also build COFs with multiple building blocks, but you have to assign each building block to a vertex with building_block_vertices.

lattice = stk.cof.Honeycomb(
    lattice_size=(2, 2, 1),
    vertex_alignments={0: 1, 2: 2}
)
bb3 = stk.BuildingBlock('NCOCN', ['amine'])
cof2 = stk.ConstructedMolecule(
    building_blocks=[bb1, bb2, bb3],
    topology_graph=lattice
    building_block_vertices={
        bb1: lattice.verices[:2],
        bb2: lattice.verices[4:],
        bb3: lattice.verices[2:4]
    }
)

Methods

assign_building_blocks_to_vertices(self, …)

Assign building_blocks to vertices.

construct(self, mol)

Construct a ConstructedMolecule.

__init__(self, lattice_size, periodic=False, vertex_alignments=None, num_processes=1)

Initialize a COF.

Parameters
  • lattice_size (tuple of int) – The number of unit cells which should be placed along the x, y and z dimensions, respectively.

  • periodic (bool, optional) – If periodic bonds are to be made across the lattice, this should be True. If False the functional groups on the ends of the lattice will be unreacted.

  • vertex_alignments (dict, optional) – A mapping from the Vertex.id of a Vertex vertices to an Edge connected to it. The Edge is used to align the first FunctionalGroup of a BuildingBlock placed on that vertex. Only vertices which need to have their default edge changed need to be present in the dict. If None then the default edge is used for each vertex. Changing which Edge is used will mean that the topology graph represents different structural isomers. The edge is refered to by a number between 0 (inclusive) and the number of edges the vertex is connected to (exclusive).

  • num_processes (int, optional) – The number of parallel processes to create during construct().

assign_building_blocks_to_vertices(self, building_blocks)

Assign building_blocks to vertices.

Parameters

building_blocks (list of Molecule) – The BuildingBlock and ConstructedMolecule instances which represent the building block molecules used for construction. Only one instance is present per building block molecule, even if multiples of that building block join up to form the ConstructedMolecule.

Returns

Maps the building_blocks, to the Vertex objects in vertices they are placed on during construction. The dict has the form

building_block_vertices = {
    BuildingBlock(...): [Vertex(...), Vertex(...)],
    BuildingBlock(...): [
        Vertex(...),
        Vertex(...),
        Vertex(...),
    ]
    ConstructedMolecule(...): [Vertex(...)]
}

Return type

dict

Raises

ValueError – If there is more than one building with a given number of functional groups.

construct(self, mol)

Construct a ConstructedMolecule.

Parameters

mol (ConstructedMolecule) – The ConstructedMolecule instance which needs to be constructed.

Returns

None

Return type

NoneType

class Hexagonal(lattice_size, periodic=False, vertex_alignments=None, num_processes=1)

Bases: stk.molecular.topology_graphs.cof.COF

Represents a hexagonal COF topology graph.

Building blocks with six and two functional groups are required for this topology graph.

See COF for more details and examples.

vertex_data

A class attribute. Holds the data of the vertices which make up the topology graph.

Type

tuple of VertexData

edge_data

A class attribute. Holds the data of the edges which make up the topology graph.

Type

tuple of EdgeData

vertices

The vertices which make up the topology graph.

Type

tuple of Vertex

edges

The edges which make up the topology graph.

Type

tuple of Edge

Methods

assign_building_blocks_to_vertices(self, …)

Assign building_blocks to vertices.

construct(self, mol)

Construct a ConstructedMolecule.

__init__(self, lattice_size, periodic=False, vertex_alignments=None, num_processes=1)

Initialize a COF.

Parameters
  • lattice_size (tuple of int) – The number of unit cells which should be placed along the x, y and z dimensions, respectively.

  • periodic (bool, optional) – If periodic bonds are to be made across the lattice, this should be True. If False the functional groups on the ends of the lattice will be unreacted.

  • vertex_alignments (dict, optional) – A mapping from the Vertex.id of a Vertex vertices to an Edge connected to it. The Edge is used to align the first FunctionalGroup of a BuildingBlock placed on that vertex. Only vertices which need to have their default edge changed need to be present in the dict. If None then the default edge is used for each vertex. Changing which Edge is used will mean that the topology graph represents different structural isomers. The edge is refered to by a number between 0 (inclusive) and the number of edges the vertex is connected to (exclusive).

  • num_processes (int, optional) – The number of parallel processes to create during construct().

assign_building_blocks_to_vertices(self, building_blocks)

Assign building_blocks to vertices.

Parameters

building_blocks (list of Molecule) – The BuildingBlock and ConstructedMolecule instances which represent the building block molecules used for construction. Only one instance is present per building block molecule, even if multiples of that building block join up to form the ConstructedMolecule.

Returns

Maps the building_blocks, to the Vertex objects in vertices they are placed on during construction. The dict has the form

building_block_vertices = {
    BuildingBlock(...): [Vertex(...), Vertex(...)],
    BuildingBlock(...): [
        Vertex(...),
        Vertex(...),
        Vertex(...),
    ]
    ConstructedMolecule(...): [Vertex(...)]
}

Return type

dict

Raises

ValueError – If there is more than one building with a given number of functional groups.

construct(self, mol)

Construct a ConstructedMolecule.

Parameters

mol (ConstructedMolecule) – The ConstructedMolecule instance which needs to be constructed.

Returns

None

Return type

NoneType

edge_data = (EdgeData(4, 0, id=0), EdgeData(4, 1, id=1), EdgeData(5, 0, id=2), EdgeData(5, 2, id=3), EdgeData(6, 1, id=4), EdgeData(6, 2, id=5), EdgeData(7, 1, id=6), EdgeData(7, 3, id=7), EdgeData(8, 2, id=8), EdgeData(8, 3, id=9), EdgeData(9, 0, id=10), EdgeData(9, 2, id=11, periodicity=(-1, 0, 0)), EdgeData(10, 0, id=12), EdgeData(10, 1, id=13, periodicity=(0, -1, 0)), EdgeData(11, 0, id=14), EdgeData(11, 3, id=15, periodicity=(0, -1, 0)), EdgeData(12, 2, id=16), EdgeData(12, 1, id=17, periodicity=(1, -1, 0)), EdgeData(13, 2, id=18), EdgeData(13, 3, id=19, periodicity=(0, -1, 0)), EdgeData(14, 1, id=20), EdgeData(14, 3, id=21, periodicity=(-1, 0, 0)), EdgeData(15, 3, id=22), EdgeData(15, 0, id=23, periodicity=(1, 0, 0)))
vertex_data = (VertexData(id=0, position=[0.375, 0.2165, 1.4433346804457017]), VertexData(id=1, position=[0.625, 0.6495, 1.4433346804457017]), VertexData(id=2, position=[0.875, 0.2165, 1.4433346804457017]), VertexData(id=3, position=[1.125, 0.6495, 1.4433346804457017]), VertexData(id=4, position=[0.5, 0.433, 1.4433346804457017]), VertexData(id=5, position=[0.625, 0.2165, 1.4433346804457017]), VertexData(id=6, position=[0.75, 0.433, 1.4433346804457017]), VertexData(id=7, position=[0.875, 0.6495, 1.4433346804457017]), VertexData(id=8, position=[1.0, 0.433, 1.4433346804457017]), VertexData(id=9, position=[0.125, 0.2165, 1.4433346804457017]), VertexData(id=10, position=[0.25, -1.3877787807814457e-17, 1.4433346804457017]), VertexData(id=11, position=[0.5, -1.3877787807814457e-17, 1.4433346804457017]), VertexData(id=12, position=[1.0, -1.3877787807814457e-17, 1.4433346804457017]), VertexData(id=13, position=[0.75, -1.3877787807814457e-17, 1.4433346804457017]), VertexData(id=14, position=[0.375, 0.6495, 1.4433346804457017]), VertexData(id=15, position=[1.25, 0.433, 1.4433346804457017]))
class Honeycomb(lattice_size, periodic=False, vertex_alignments=None, num_processes=1)

Bases: stk.molecular.topology_graphs.cof.COF

Represents a honeycomb COF topology graph.

Building blocks with three and two functional groups are required for this topology graph.

See COF for more details and examples.

vertex_data

A class attribute. Holds the data of the vertices which make up the topology graph.

Type

tuple of VertexData

edge_data

A class attribute. Holds the data of the edges which make up the topology graph.

Type

tuple of EdgeData

vertices

The vertices which make up the topology graph.

Type

tuple of Vertex

edges

The edges which make up the topology graph.

Type

tuple of Edge

Methods

assign_building_blocks_to_vertices(self, …)

Assign building_blocks to vertices.

construct(self, mol)

Construct a ConstructedMolecule.

__init__(self, lattice_size, periodic=False, vertex_alignments=None, num_processes=1)

Initialize a COF.

Parameters
  • lattice_size (tuple of int) – The number of unit cells which should be placed along the x, y and z dimensions, respectively.

  • periodic (bool, optional) – If periodic bonds are to be made across the lattice, this should be True. If False the functional groups on the ends of the lattice will be unreacted.

  • vertex_alignments (dict, optional) – A mapping from the Vertex.id of a Vertex vertices to an Edge connected to it. The Edge is used to align the first FunctionalGroup of a BuildingBlock placed on that vertex. Only vertices which need to have their default edge changed need to be present in the dict. If None then the default edge is used for each vertex. Changing which Edge is used will mean that the topology graph represents different structural isomers. The edge is refered to by a number between 0 (inclusive) and the number of edges the vertex is connected to (exclusive).

  • num_processes (int, optional) – The number of parallel processes to create during construct().

assign_building_blocks_to_vertices(self, building_blocks)

Assign building_blocks to vertices.

Parameters

building_blocks (list of Molecule) – The BuildingBlock and ConstructedMolecule instances which represent the building block molecules used for construction. Only one instance is present per building block molecule, even if multiples of that building block join up to form the ConstructedMolecule.

Returns

Maps the building_blocks, to the Vertex objects in vertices they are placed on during construction. The dict has the form

building_block_vertices = {
    BuildingBlock(...): [Vertex(...), Vertex(...)],
    BuildingBlock(...): [
        Vertex(...),
        Vertex(...),
        Vertex(...),
    ]
    ConstructedMolecule(...): [Vertex(...)]
}

Return type

dict

Raises

ValueError – If there is more than one building with a given number of functional groups.

construct(self, mol)

Construct a ConstructedMolecule.

Parameters

mol (ConstructedMolecule) – The ConstructedMolecule instance which needs to be constructed.

Returns

None

Return type

NoneType

edge_data = (EdgeData(2, 0, id=0), EdgeData(2, 1, id=1), EdgeData(3, 0, id=2), EdgeData(3, 1, id=3, periodicity=(0, -1, 0)), EdgeData(4, 0, id=4), EdgeData(4, 1, id=5, periodicity=(-1, 0, 0)))
vertex_data = (VertexData(id=0, position=[0.5, 0.2886666666666666, 1.4433346804457017]), VertexData(id=1, position=[1.0, 0.5773333333333333, 1.4433346804457017]), VertexData(id=2, position=[0.75, 0.43299999999999994, 1.4433346804457017]), VertexData(id=3, position=[0.5, -5.551115123125783e-17, 1.4433346804457017]), VertexData(id=4, position=[0.25, 0.43299999999999994, 1.4433346804457017]))
class Kagome(lattice_size, periodic=False, vertex_alignments=None, num_processes=1)

Bases: stk.molecular.topology_graphs.cof.COF

Represents a kagome COF topology graph.

Building blocks with four and two functional groups are required for this topology graph.

See COF for more details and examples.

vertex_data

A class attribute. Holds the data of the vertices which make up the topology graph.

Type

tuple of VertexData

edge_data

A class attribute. Holds the data of the edges which make up the topology graph.

Type

tuple of EdgeData

vertices

The vertices which make up the topology graph.

Type

tuple of Vertex

edges

The edges which make up the topology graph.

Type

tuple of Edge

Methods

assign_building_blocks_to_vertices(self, …)

Assign building_blocks to vertices.

construct(self, mol)

Construct a ConstructedMolecule.

__init__(self, lattice_size, periodic=False, vertex_alignments=None, num_processes=1)

Initialize a COF.

Parameters
  • lattice_size (tuple of int) – The number of unit cells which should be placed along the x, y and z dimensions, respectively.

  • periodic (bool, optional) – If periodic bonds are to be made across the lattice, this should be True. If False the functional groups on the ends of the lattice will be unreacted.

  • vertex_alignments (dict, optional) – A mapping from the Vertex.id of a Vertex vertices to an Edge connected to it. The Edge is used to align the first FunctionalGroup of a BuildingBlock placed on that vertex. Only vertices which need to have their default edge changed need to be present in the dict. If None then the default edge is used for each vertex. Changing which Edge is used will mean that the topology graph represents different structural isomers. The edge is refered to by a number between 0 (inclusive) and the number of edges the vertex is connected to (exclusive).

  • num_processes (int, optional) – The number of parallel processes to create during construct().

assign_building_blocks_to_vertices(self, building_blocks)

Assign building_blocks to vertices.

Parameters

building_blocks (list of Molecule) – The BuildingBlock and ConstructedMolecule instances which represent the building block molecules used for construction. Only one instance is present per building block molecule, even if multiples of that building block join up to form the ConstructedMolecule.

Returns

Maps the building_blocks, to the Vertex objects in vertices they are placed on during construction. The dict has the form

building_block_vertices = {
    BuildingBlock(...): [Vertex(...), Vertex(...)],
    BuildingBlock(...): [
        Vertex(...),
        Vertex(...),
        Vertex(...),
    ]
    ConstructedMolecule(...): [Vertex(...)]
}

Return type

dict

Raises

ValueError – If there is more than one building with a given number of functional groups.

construct(self, mol)

Construct a ConstructedMolecule.

Parameters

mol (ConstructedMolecule) – The ConstructedMolecule instance which needs to be constructed.

Returns

None

Return type

NoneType

edge_data = (EdgeData(3, 0, id=0), EdgeData(3, 1, id=1), EdgeData(4, 0, id=2), EdgeData(4, 2, id=3), EdgeData(5, 1, id=4), EdgeData(5, 2, id=5), EdgeData(6, 0, id=6), EdgeData(6, 1, id=7, periodicity=(-1, 0, 0)), EdgeData(7, 0, id=8), EdgeData(7, 2, id=9, periodicity=(-1, 1, 0)), EdgeData(8, 1, id=10), EdgeData(8, 2, id=11, periodicity=(0, 1, 0)))
vertex_data = (VertexData(id=0, position=[0.625, 0.6495, 1.4433346804457017]), VertexData(id=1, position=[1.125, 0.6495, 1.4433346804457017]), VertexData(id=2, position=[0.875, 0.2165, 1.4433346804457017]), VertexData(id=3, position=[0.875, 0.6495, 1.4433346804457017]), VertexData(id=4, position=[0.75, 0.433, 1.4433346804457017]), VertexData(id=5, position=[1.0, 0.433, 1.4433346804457017]), VertexData(id=6, position=[0.375, 0.6495, 1.4433346804457017]), VertexData(id=7, position=[0.5, 0.866, 1.4433346804457017]), VertexData(id=8, position=[1.25, 0.866, 1.4433346804457017]))
class LinkerlessHoneycomb(lattice_size, periodic=False, vertex_alignments=None, num_processes=1)

Bases: stk.molecular.topology_graphs.cof.COF

Represents a honeycomb COF topology graph.

Building blocks with three functional groups are required for this topology graph.

See COF for more details and examples.

vertex_data

A class attribute. Holds the data of the vertices which make up the topology graph.

Type

tuple of VertexData

edge_data

A class attribute. Holds the data of the edges which make up the topology graph.

Type

tuple of EdgeData

vertices

The vertices which make up the topology graph.

Type

tuple of Vertex

edges

The edges which make up the topology graph.

Type

tuple of Edge

Methods

assign_building_blocks_to_vertices(self, …)

Assign building_blocks to vertices.

construct(self, mol)

Construct a ConstructedMolecule.

__init__(self, lattice_size, periodic=False, vertex_alignments=None, num_processes=1)

Initialize a COF.

Parameters
  • lattice_size (tuple of int) – The number of unit cells which should be placed along the x, y and z dimensions, respectively.

  • periodic (bool, optional) – If periodic bonds are to be made across the lattice, this should be True. If False the functional groups on the ends of the lattice will be unreacted.

  • vertex_alignments (dict, optional) – A mapping from the Vertex.id of a Vertex vertices to an Edge connected to it. The Edge is used to align the first FunctionalGroup of a BuildingBlock placed on that vertex. Only vertices which need to have their default edge changed need to be present in the dict. If None then the default edge is used for each vertex. Changing which Edge is used will mean that the topology graph represents different structural isomers. The edge is refered to by a number between 0 (inclusive) and the number of edges the vertex is connected to (exclusive).

  • num_processes (int, optional) – The number of parallel processes to create during construct().

assign_building_blocks_to_vertices(self, building_blocks)

Assign building_blocks to vertices.

Parameters

building_blocks (list of Molecule) – The BuildingBlock and ConstructedMolecule instances which represent the building block molecules used for construction. Only one instance is present per building block molecule, even if multiples of that building block join up to form the ConstructedMolecule.

Returns

Maps the building_blocks, to the Vertex objects in vertices they are placed on during construction. The dict has the form

building_block_vertices = {
    BuildingBlock(...): [Vertex(...), Vertex(...)],
    BuildingBlock(...): [
        Vertex(...),
        Vertex(...),
        Vertex(...),
    ]
    ConstructedMolecule(...): [Vertex(...)]
}

Return type

dict

Raises

ValueError – If there is more than one building with a given number of functional groups.

construct(self, mol)

Construct a ConstructedMolecule.

Parameters

mol (ConstructedMolecule) – The ConstructedMolecule instance which needs to be constructed.

Returns

None

Return type

NoneType

edge_data = (EdgeData(0, 1, id=0), EdgeData(0, 1, id=1, periodicity=(-1, 0, 0)), EdgeData(0, 1, id=2, periodicity=(0, -1, 0)))
vertex_data = (VertexData(id=0, position=[0.5, 0.2886666666666666, 1.4433346804457017]), VertexData(id=1, position=[1.0, 0.5773333333333333, 1.4433346804457017]))
class Square(lattice_size, periodic=False, vertex_alignments=None, num_processes=1)

Bases: stk.molecular.topology_graphs.cof.COF

Represents a sqaure COF topology graph.

Building blocks with four and two functional groups are required for this topology graph.

See COF for more details and examples.

vertex_data

A class attribute. Holds the data of the vertices which make up the topology graph.

Type

tuple of VertexData

edge_data

A class attribute. Holds the data of the edges which make up the topology graph.

Type

tuple of EdgeData

vertices

The vertices which make up the topology graph.

Type

tuple of Vertex

edges

The edges which make up the topology graph.

Type

tuple of Edge

Methods

assign_building_blocks_to_vertices(self, …)

Assign building_blocks to vertices.

construct(self, mol)

Construct a ConstructedMolecule.

__init__(self, lattice_size, periodic=False, vertex_alignments=None, num_processes=1)

Initialize a COF.

Parameters
  • lattice_size (tuple of int) – The number of unit cells which should be placed along the x, y and z dimensions, respectively.

  • periodic (bool, optional) – If periodic bonds are to be made across the lattice, this should be True. If False the functional groups on the ends of the lattice will be unreacted.

  • vertex_alignments (dict, optional) – A mapping from the Vertex.id of a Vertex vertices to an Edge connected to it. The Edge is used to align the first FunctionalGroup of a BuildingBlock placed on that vertex. Only vertices which need to have their default edge changed need to be present in the dict. If None then the default edge is used for each vertex. Changing which Edge is used will mean that the topology graph represents different structural isomers. The edge is refered to by a number between 0 (inclusive) and the number of edges the vertex is connected to (exclusive).

  • num_processes (int, optional) – The number of parallel processes to create during construct().

assign_building_blocks_to_vertices(self, building_blocks)

Assign building_blocks to vertices.

Parameters

building_blocks (list of Molecule) – The BuildingBlock and ConstructedMolecule instances which represent the building block molecules used for construction. Only one instance is present per building block molecule, even if multiples of that building block join up to form the ConstructedMolecule.

Returns

Maps the building_blocks, to the Vertex objects in vertices they are placed on during construction. The dict has the form

building_block_vertices = {
    BuildingBlock(...): [Vertex(...), Vertex(...)],
    BuildingBlock(...): [
        Vertex(...),
        Vertex(...),
        Vertex(...),
    ]
    ConstructedMolecule(...): [Vertex(...)]
}

Return type

dict

Raises

ValueError – If there is more than one building with a given number of functional groups.

construct(self, mol)

Construct a ConstructedMolecule.

Parameters

mol (ConstructedMolecule) – The ConstructedMolecule instance which needs to be constructed.

Returns

None

Return type

NoneType

edge_data = (EdgeData(1, 0, id=0), EdgeData(1, 0, id=1, periodicity=(1, 0, 0)), EdgeData(2, 0, id=2), EdgeData(2, 0, id=3, periodicity=(0, 1, 0)))
vertex_data = (VertexData(id=0, position=[0.5, 0.5, 0.5]), VertexData(id=1, position=[1.0, 0.5, 0.5]), VertexData(id=2, position=[0.5, 1.0, 0.5]))