coflandscaper.BuildCOF2D¶
- class coflandscaper.BuildCOF2D[source]¶
Construct a single-layer 2D COF from node/linker inputs.
This class wraps preprocessing needed for pormake-based assembly of 2D COFs. It supports topology-driven construction for
hcb,sql,kgm, andhcb_ab. Dummy-atom preprocessing expectsHeconnection markers.The main workflow resolves topology-dependent node/linker inputs, optionally preprocesses input XYZ files into pormake-compatible format, builds one framework, writes an unoptimized CIF into the single-layer output directory, and adjusts the interlayer distance to 15 Å.
Topology requirements:
hcb,sql, andkgmrequire one node and one linker.hcb_abrequires two nodes and no linker. Inputs default to0_node/and0_linker/unless explicit paths are provided.Default output location is
{cof_name}/1_{cof_name}_single_layer, and the default output CIF name is{cof_name}_unopt.cif.Methods
Build one unoptimized single-layer COF CIF from node/linker inputs.
- build(topo, cof_name, input_nodes=None, input_linkers=None, output_folder=None)[source]¶
Build one unoptimized single-layer COF CIF from node/linker inputs.
The method expects node/linker counts defined by the topology after input resolution. Input files are preprocessed to map dummy atoms and inject bond annotations required by pormake. If explicit input files are not provided, default source folders are used.
Default input behavior: - Nodes are read from 0_node/*.xyz. - Linkers are read from 0_linker/*.xyz only when required by topology. - Pass input_linkers=[] to explicitly provide no linkers.
- Default output behavior:
The output CIF is written to {cof_name}/1_{cof_name}_single_layer/{cof_name}_unopt.cif and adjusted to an interlayer distance of 15 Å.
- Parameters:
topo (str) – Topology key used for construction. Allowed values are “hcb”, “sql”, “hcb_ab”, and “kgm”.
cof_name (str) – COF identifier used in output folder and filename patterns.
input_nodes (Sequence[str | PathLike[str]] | None) – Optional explicit node .xyz paths. Defaults to None (reads from 0_node/*.xyz).
input_linkers (Sequence[str | PathLike[str]] | None) – Optional explicit linker .xyz paths. Defaults to None (reads from 0_linker/*.xyz when required). Use an empty list to explicitly pass no linkers.
output_folder (str | None) – Optional output folder override. Defaults to None (uses {cof_name}/1_{cof_name}_single_layer).
- Returns:
List containing one output CIF path.
- Raises:
ValueError – If topo is not one of “hcb”, “sql”, “hcb_ab”, or “kgm”.
ValueError – If input resolution does not match topology input counts.
- Return type: