cemd.build.Splitter#
- class Splitter(system, coordinate=None, axis=2, gap_size=20.0, bonds_dict=None, keep_molecules=False, ionic_dict=None, _solution_blueprint=None, _padding=2.0, _vacuum=0.0, _has_solution=False)[source]#
Bases:
BaseBuilderSplit a system along an axis and optionally add a solution.
A cut can sever real interatomic bonds. Bonds that exist explicitly in the system’s topology are dropped automatically. Contacts that are structure-bearing but carry no explicit bond – the Si-O framework under ClayFF/CSHFF, for instance – are found geometrically instead, from
bonds_dict; usecount_broken_bonds()orscan_broken_bonds()to choose where to cut, andrepair=Trueto cap the dangling atoms left behind.In a disordered solid there is often no plane that cuts no bond at all. With
keep_molecules=Truethe cut follows the molecules instead of a plane: every covalent unit (explicit bonds plus the contacts ofbonds_dict: a silicate chain with its O and H, a water molecule, a hydroxide…) moves as a whole, on the side holding most of its mass, and every isolated cation (Ca, Na…) goes to the side where it keeps most of its coordination shell (ionic_dict). No covalent bond is then broken, whatever the cut position;coordinate=Nonepicks the position that cuts the fewest ionic contacts (best_coordinate()).After
split(),split_reportgives the contacts measured as broken on the actual geometry, before vs. after the split.- Parameters:
- systemAtomicSystem
The system to split.
- coordinatefloat, optional
Position along
axisat which to cut, as a projection on the axis unit vector.Noneusesbest_coordinate().- axisint or str, default=2
Axis along which to split (‘x’/’y’/’z’ or 0/1/2).
- gap_sizefloat, default=20.0
Width of the gap to open, in Å.
- bonds_dictdict, optional
{(type_or_element, type_or_element): cutoff}used to detect severed contacts. Defaults toDEFAULT_BOND_CUTOFFS.- keep_moleculesbool, default=False
Move whole covalent units rather than a half-space (see above).
- ionic_dictdict, optional
{(cation, anion): cutoff}coordination shells, types or elements. Defaults toDEFAULT_IONIC_CUTOFFS.
Examples
>>> # Simple split: cut at z=15, opening a 20 A gap there >>> result = Splitter(system, coordinate=15.0, axis='z', gap_size=20.0).split()
>>> # Split with solution (fluent API) >>> result = (Splitter(system, coordinate=15.0, axis='z', gap_size=30.0) ... .add_solution(blueprint, padding=2.0) ... .split())
>>> # Look for the least damaging cut, then split and cap what breaks >>> splitter = Splitter(system, coordinate=0.0, axis='z', gap_size=20.0) >>> scan = splitter.scan_broken_bonds(step=0.25) >>> best = scan.loc[scan["n_broken"].idxmin(), "coordinate"] >>> result = splitter.with_coordinate(best).split(repair=True)
>>> # Pore in a disordered solid: no covalent bond broken, cut placed >>> # where it costs the fewest ionic contacts, liquid in the pore >>> result = (Splitter(system, axis='z', gap_size=30.0, keep_molecules=True) ... .add_solution(blueprint) ... .split())
- __init__(system, coordinate=None, axis=2, gap_size=20.0, bonds_dict=None, keep_molecules=False, ionic_dict=None, _solution_blueprint=None, _padding=2.0, _vacuum=0.0, _has_solution=False)#
Methods
Add a liquid solution in the gap.
Cut position breaking the fewest bonds, then the fewest ionic contacts.
Alias for
split(), to satisfy theBaseBuilderinterface.Count the bonds a cut at
coordinatewould sever.Count the ionic contacts (
ionic_dict) a cut would sever.Find the bonds a cut would sever, from the current geometry.
Count severed contacts across a range of cut positions.
Atoms moved by the split (by position in
system.atoms).Execute the split and return the resulting AtomicSystem.
Set the cutting position.
Attributes
axisbonds_dictcoordinategap_sizeionic_dictkeep_moleculesrepair_reportsplit_reportsystem