Atomistic structure prediction¶
Given two building blocks:
Let’s predict structures with m=2 and s=2:3.
First (but optional!), use bbprepared to get the lowest energy conformer.
Then we define the system.
import stk
import stko
import cgexplore as cgx
import logging
import pathlib
logger = logging.getLogger(__name__)
# Define a working directory.
wd = pathlib.Path.cwd() / "source"/ "recipes" / "recipe_4_output"
# Currently, this definition is up to the user, but we will make this
# uniform soon.
building_block_library = {
"ditopic": ditopic_building_block,
"tritopic": tritopic_building_block,
}
# Currently, this definition is up to the user, but we will make this
# uniform soon.
systems = {
"s1": {
# Always order with the most functional groups first.
"stoichiometry_map": {"tritopic": 2, "ditopic": 3},
"multipliers": (1, 2),
},
}
Collate iterators as a function of mulipliers, graphs and building block configurations.
syst_d = systems["s1"]
iterators = {}
for multiplier in syst_d["multipliers"]:
# Define the iterator.
iterator = cgx.scram.TopologyIterator(
building_block_counts={
building_block_library[name]: stoich * multiplier
for name, stoich in syst_d["stoichiometry_map"].items()
},
)
logger.info(
"graph iteration has %s graphs", iterator.count_graphs()
)
iterators[multiplier] = iterator
For each iterator, we can build a test molecule and compile them for further analysis. Note that the process from here on is much simplified than one would use for production structure prediction. For example, atomistic structure prediction in my recent work was more complicated.
for multiplier in syst_d["multipliers"]:
iterator = iterators[multiplier]
for topology_code in iterator.yield_graphs():
# Filter graphs for 1-loops.
if topology_code.contains_parallels():
continue
name = f"s1_{multiplier}_{topology_code.idx}"
# Use vertex set regraphing.
constructed_molecule = cgx.scram.get_vertexset_molecule(
layout_type="kamada",
scale=5,
topology_code=topology_code,
iterator=iterator,
configuration=None,
)
# Output to file.
# constructed_molecule.write(wd / f"{name}_unopt.mol")
# Implement optimisation workflows!
# And then do some analysis!
Here are the three generated structures, including (finally) the well known porous organic cage, CC3.
⬇️ Download Python Script