mag4.analysis
Geometric / post-DFT analyses (bridging-angle scans, WIEN2k moment extraction).
- mag4.analysis.find_bridging_angles(structure, site_i, site_j, jimage, ligand_elements, bond_cutoff)[source]
Find every ligand L bridging
site_iandsite_j(atjimage).A ligand L bridges the pair when
dist(site_i, L) < bond_cutoffANDdist(site_j + jimage, L) < bond_cutoff.Returns a list of dicts sorted by angle.
- mag4.analysis.group_into_shells(results, tol=0.01)[source]
Cluster M–M pairs into distance shells (J1, J2, …).
- Parameters:
tol (float)
- mag4.analysis.compress_angles(ang_vals, tol=0.01)[source]
Group similar angles:
[159.07, 159.07, 159.07]→'159.07° (x3)'.
- mag4.analysis.print_header(structure, element, ligand_elements, cutoff, bond_cutoff)[source]
Print a header summarising the structure and the search parameters.
- mag4.analysis.print_angles_for_shell(group, structure, element, ligand_elements, bond_cutoff, lines_out)[source]
Bond-angle table for one J shell. Appends each printed line to
lines_out.
- mag4.analysis.extract_moments_from_scf(scf_path, atom_indices)[source]
Parse a WIEN2k
.scffile and return the converged:MMIxxx:values.Line format:
:MMI009: MAGNETIC MOMENT IN SPHERE 9 = 2.85000
The last occurrence of each tag (i.e. the converged value) is kept.
- mag4.analysis.extract_total_moment(scf_path)[source]
Return the last
:MMTOT:total magnetic moment in cell.
- mag4.analysis.find_cases(base_dir='.', scf_basename=None, code='wien2k')[source]
Auto-detect config subdirectories with results for
code(sorted).code='wien2k'→ directories with a.scffile (or exactly<scf_basename>.scfwhen given);code='vasp'→ directories with anOUTCAR.
- mag4.analysis.build_table(cases, atom_indices, scf_basename=None, target=None, tol=0.5, code='wien2k')[source]
Textual table of moments for each case + statistics + a target check.
codeselects the parser:'wien2k'reads per-sphere:MMI:values from<dir>/<scf_basename>.scf;'vasp'reads the per-iontotcolumn of the lastmagnetization (x)block in<dir>/OUTCAR(needsLORBIT=10/11). For VASP the indices are 1-based POSCAR ion numbers (mag4 writes the magnetic atoms first, so they are1 … n_mag).Returns
(lines, summary)wheresummarycarriesn_data(configs with a readable SCF),n_missing(SCF not found),failures(list of(case, reason)where a site did not reach thetargetmoment withintol, or collapsed to ~0), andtarget.targetis the expected per-site|μ|(e.g.2·S= the generated|MAGMOM|). WhenNonethe check only flags collapsed moments (|μ| < 0.1 μ_B), which usually mean the config fell into a non-magnetic solution rather than the intended spin state.
Modules
Bridging-ligand bond-angle analysis (M – L – M). |
|
Extract converged magnetic moments from WIEN2k |