qcelemental.molutil.B787(cgeom, rgeom, cuniq, runiq, do_plot=False, verbose=1, atoms_map=False, run_resorting=False, mols_align=False, run_to_completion=False, algorithm='hungarian_uno', uno_cutoff=0.001, run_mirror=False)[source]

Use Kabsch algorithm to find best alignment of geometry cgeom onto rgeom while sampling atom mappings restricted by runiq and cuniq.

  • rgeom (ndarray) – (nat, 3) array of reference/target/unchanged geometry. Assumed [a0] for RMSD purposes.

  • cgeom (ndarray) – (nat, 3) array of concern/changeable geometry. Assumed [a0] for RMSD purposes. Must have same nat, units, and atom content as rgeom.

  • runiq (ndarray) – (nat,) array of str indicating which rows (atoms) in rgeom are shuffleable without changing the molecule. Generally hashes of element symbol and mass are used, but could be as simple as [‘C’, ‘H’, ‘H’, ‘D’, ‘H’] for monodeuterated methane.

  • cuniq (ndarray) – (nat,) array of str indicating which rows (atoms) in cgeom are shuffleable. See runiq for more details. Strings and count in cuniq must match runiq. That is, sorted(cuniq) == sorted(runiq).

  • do_plot (bool) – Pops up a mpl plot showing before, after, and ref geometries.

  • verbose (int) – Quantity of printing. 0 to silence.

  • atoms_map (bool) – Whether atom1 of rgeom already corresponds to atom1 of cgeom and so on. If True, no resorting will be run, parameters runiq and cuniq may be passed as None, and much time will be saved.

  • run_resorting (bool) – Run the resorting machinery even if unnecessary because atoms_map=True.

  • mols_align (Union[bool, float]) – Whether ref_mol and concern_mol have identical geometries by eye (barring orientation or atom mapping) and expected final RMSD = 0. If True, procedure is truncated when RMSD condition met, saving time. If float, convcrit at which search for minimium truncates.

  • run_to_completion (bool) – Run reorderings to completion (past RMSD = 0) even if unnecessary because mols_align=True. Used to test worst-case timings.

  • algorithm (str) – {‘hungarian_uno’, ‘permutative’} When atoms_map=False, screening algorithm for plausible atom mappings. permutative suitable only for small systems.

  • uno_cutoff (float) – TODO

  • run_mirror (bool) – Run alternate geometries potentially allowing best match to rgeom from mirror image of cgeom. Only run if system confirmed to be nonsuperimposable upon mirror reflection.


First item is RMSD [A] between rgeom and the optimally aligned geometry computed. Second item is a AlignmentMill with fields (shift, rotation, atommap, mirror) that prescribe the transformation from cgeom and the optimally aligned geometry.

Return type

float, AlignmentMill