Releases: bjmorgan/hofmann
Release list
v0.9.0
v0.8.0
v0.7.1
What's new
-
Performance — Fix quadratic array growth in
_merge_expansionsduring periodic boundary expansion, matching the O(1) deduplication pattern already used by_expand_neighbour_shells. -
Construction-time validation —
BondSpec,AtomStyle,PolyhedronSpec, andViewStatenow validate their numeric fields at construction time, raisingValueErrorfor out-of-range values (e.g. negative radii,min_length > max_length,alphaoutside[0, 1], non-positivezoomorview_distance).StructureScenevalidates that every frame has the same number of atoms as thespecieslist. -
Descriptive index errors —
render_mpl,render_mpl_interactive,centre_on, andfrom_pymatgennow raiseValueErrorwith the parameter name and valid range for out-of-range index arguments, instead of leaking bareIndexErrorexceptions. -
API improvements —
ViewState.look_alongreturnsselffor chaining. PassingNonefor a style kwarg inrender_mplnow resets that field to theRenderStyleclass default instead of being silently ignored.
See the changelog for full details.
v0.7.0
What's new
-
Construction-time style kwargs —
from_pymatgennow acceptsatom_styles,title,view, andatom_datakeyword arguments, allowing styles to be configured at construction time rather than requiring post-hoc mutation. -
JSON style persistence — All style classes gain
to_dict()/from_dict()methods for serialisation. Module-levelsave_styles()/load_styles()functions write and read style files containing any combination ofatom_styles,bond_specs,polyhedra, andrender_stylesections.StructureScene.save_styles()andload_styles()provide convenience methods on the scene itself. -
StyleSet — New dataclass returned by
load_styles()with optional fields for each section.
See the changelog for full details.
v0.6.0
What's new
- BondSpec defaults —
BondSpecnow only requiresspeciesandmax_length.min_lengthdefaults to0.0;radiusandcolourdefault to class-level values (BondSpec.default_radiusandBondSpec.default_colour) which can be changed to set project-wide defaults. Thereprdistinguishes unset values (radius=<default 0.1>) from explicit ones (radius=0.15).
See the changelog for full details.
v0.5.0
render_mpl()andStructureScene.render_mpl()now accept anaxparameter to render into an existing matplotlib axes, enabling multi-panel figures and composition with other plots.- Scene titles are rendered inside the viewport with a white stroke halo, replacing
ax.set_title(). - The viewport expands symmetrically when the axes orientation widget is enabled, preventing overlap with corner atoms.
- Widget font and line width scale relative to per-axes width rather than full figure width, giving correct proportions in subplots.
- Default
AxesStyle.arrow_lengthincreased from 0.08 to 0.12 for better visibility.
v0.4.0
Default bond detection now uses VESTA bond length cutoffs (bundled as JSON, sourced from pymatgen) instead of the covalent-radii-sum heuristic. Self-bonds (e.g. C-C, Si-Si) are included automatically when present in the VESTA data.
Breaking changes:
- The
toleranceandself_bondsparameters ondefault_bond_specs()have been removed.
v0.3.0
Bond completion and recursive search across periodic boundaries, atom visibility control, and simplified polyhedra vertex ordering.
Bond completion across boundaries
BondSpec gains a complete parameter for single-pass bond completion across periodic boundaries. Pass a species name to add missing neighbours around visible atoms of that species, or "*" for both directions:
BondSpec(species=("S", "Zr"), min_length=0.0, max_length=2.9,
radius=0.1, colour=0.5, complete="Zr")Recursive bond search
BondSpec.recursive iteratively searches for bonded atoms across boundaries, following chains until convergence or max_recursive_depth is reached. Handles molecules that span periodic boundaries (e.g. N2H6):
BondSpec(species=("N", "N"), min_length=0.0, max_length=1.9,
radius=0.1, colour=0.5, recursive=True)When both complete and recursive are set on the same spec, complete is skipped to avoid an extra expansion shell.
Atom visibility
AtomStyle.visible (default True) hides atoms of a species and suppresses their bonds without removing them from the scene data:
scene.atom_styles["H"].visible = FalseBreaking changes
- Removed
PolyhedraVertexModeenum andpolyhedra_vertex_modefield onRenderStyle. Vertex atoms are now always drawn in front of their connected polyhedral faces (the previous default behaviour).
Documentation: https://hofmann.readthedocs.io
v0.2.2
hofmann 0.2.1
Per-axis viewport cropping and helix hero image for the colouring documentation.
Per-axis viewport extents
The static renderer now computes separate x and y extents centred on the data midpoint, producing tightly cropped output for non-square scenes. Previously all renders used a square bounding box sized to the largest axis, wasting space for elongated structures.
The axes orientation widget has been updated to position correctly within asymmetric viewports. The interactive viewer is unaffected — it continues to use a fixed square viewport for stable rotation.
Documentation
New hero image on the colouring page: a helix of corner-sharing tetrahedra coloured by position along the helix using viridis.
Documentation: https://hofmann.readthedocs.io