stk icon indicating copy to clipboard operation
stk copied to clipboard

Add a MolecularGraph TopologyGraph subclass.

Open lukasturcani opened this issue 4 years ago • 1 comments

lukasturcani avatar Jul 04 '20 13:07 lukasturcani

API example from discussion with @lukasturcani

# React the amine functional groups during construction.
bb1 = stk.BuildingBlock('NCCN', [stk.PrimaryAminoFactory()])
# React the aldehyde functional groups during construction.
bb2 = stk.BuildingBlock('O=CCCC=O', [stk.AldehydeFactory()])

# Perform reaction.
# No node positions, but edges need to be defined.
bb1_plus_bb2 = stk.ConstructedMolecule(
    topology_graph=stk.graph.MolecularGraph(
        nodes={
            0: stk.graph.Node(bb1, position=[0, 0, 0]), 
            1: stk.graph.Node(bb2, position=[0, 0, 0]),
        },
        edges=(
            stk.graph.Edge(
                FG1=stk.graph.FGRef(bb_id=0, fg_id=0),
                FG2=stk.graph.FGRef(bb_id=1, fg_id=0),
            ), 
        reaction_factory=stk.reaction_factory.CoolShit(),
        ),
    ),
    reaction=??
)

andrewtarzia avatar Aug 04 '20 16:08 andrewtarzia