Macrocycle¶
Script: examples/topology/03_ring.py
A ring bond closes the path: {[#EO]1[#EO][#EO][#EO][#EO][#EO]1} bonds the last unit back to the first.
import molpy as mp
from eo_kit import library
sites = mp.io.cgsmiles.CgSmilesIr("{[#EO]1[#EO][#EO][#EO][#EO][#EO]1}").to_coarsegrain()
ring = mp.builder.Assembler(library(), mp.builder.GrowthPlacer()).assemble(sites, mp.Atomistic)
The growth placer lays the ring out as an open chain, so the closing bond starts at whatever distance its two ends grew apart; minimise before use.
Check: 6 units, 42 atoms, 42 bonds (one ring), no open port.