Skip to content

M4L4 — Extended Assembly Enumeration

In the basic enumeration example, M4L4 is used directly as the template, so the enumerated assemblies are limited to subgraphs of M4L4. If you also want to include longer chain intermediates (M5L6, M6L7, ...), use a larger template such as M10L11.

Setup (Optional)

import logging
logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s')

Template

from nasap_net import Assembly, Bond, Component

M = Component(kind='M', sites=[0, 1])
L = Component(kind='L', sites=[0, 1])
X = Component(kind='X', sites=[0])

M10L11 = Assembly(
    components={
        'M0': M, 'M1': M, 'M2': M, 'M3': M, 'M4': M,
        'M5': M, 'M6': M, 'M7': M, 'M8': M, 'M9': M,
        'L0': L, 'L1': L, 'L2': L, 'L3': L, 'L4': L,
        'L5': L, 'L6': L, 'L7': L, 'L8': L, 'L9': L, 'L10': L,
    },
    bonds=[
        Bond('L0', 1, 'M0', 0), Bond('M0', 1, 'L1', 0),
        Bond('L1', 1, 'M1', 0), Bond('M1', 1, 'L2', 0),
        Bond('L2', 1, 'M2', 0), Bond('M2', 1, 'L3', 0),
        Bond('L3', 1, 'M3', 0), Bond('M3', 1, 'L4', 0),
        Bond('L4', 1, 'M4', 0), Bond('M4', 1, 'L5', 0),
        Bond('L5', 1, 'M5', 0), Bond('M5', 1, 'L6', 0),
        Bond('L6', 1, 'M6', 0), Bond('M6', 1, 'L7', 0),
        Bond('L7', 1, 'M7', 0), Bond('M7', 1, 'L8', 0),
        Bond('L8', 1, 'M8', 0), Bond('M8', 1, 'L9', 0),
        Bond('L9', 1, 'M9', 0), Bond('M9', 1, 'L10', 0),
    ],
)

Subassembly enumeration

from nasap_net import enumerate_assemblies

assemblies = list(enumerate_assemblies(
    template=M10L11,
    leaving_ligand=X,
    metal_kinds='M',
))

32 assemblies are enumerated.

Manual addition

M10L11 is a linear chain and contains no rings. Here we manually add M3L3 (triangular ring) and M4L4 (square ring). Larger rings can be added in the same way if needed.

M3L3 = Assembly(
    components={
        'M0': M, 'M1': M, 'M2': M,
        'L0': L, 'L1': L, 'L2': L,
    },
    bonds=[
        Bond('M0', 1, 'L0', 0), Bond('L0', 1, 'M1', 0),
        Bond('M1', 1, 'L1', 0), Bond('L1', 1, 'M2', 0),
        Bond('M2', 1, 'L2', 0), Bond('L2', 1, 'M0', 0),
    ],
)

M4L4 = Assembly(
    components={
        'M0': M, 'M1': M, 'M2': M, 'M3': M,
        'L0': L, 'L1': L, 'L2': L, 'L3': L,
    },
    bonds=[
        Bond('M0', 1, 'L0', 0), Bond('L0', 1, 'M1', 0),
        Bond('M1', 1, 'L1', 0), Bond('L1', 1, 'M2', 0),
        Bond('M2', 1, 'L2', 0), Bond('L2', 1, 'M3', 0),
        Bond('M3', 1, 'L3', 0), Bond('L3', 1, 'M0', 0),
    ],
)

assemblies.extend([M3L3, M4L4])

The total number of assemblies is now 34.

Saving

import os
from nasap_net import assign_composition_formula_ids, save_assemblies

assemblies = assign_composition_formula_ids(assemblies, order=['M', 'L', 'X'])

os.makedirs('output', exist_ok=True)
save_assemblies(assemblies, 'output/assemblies.yaml', overwrite=True)

The expected output can be found in examples/M4L4/expected/assemblies.yaml (34 assemblies).


Next: M4L4 — Classification