Canonicalize(3)
π Canonicalize(3) β Chemistry::Canonicalize π
User Contributed Perl Documentation Β· Canonicalize(3) Β· bestie edition π§
β¨ NAME β¨
Chemistry::Canonicalize β number the atoms in a molecule in a unique way. that's it, that's the whole job. no cap. π
πΈ SYNOPSIS πΈ
okay so first you gotta bring it in:
use Chemistry::Canonicalize ':all';
# $mol is a Chemistry::Mol object
canonicalize($mol);
print "The canonical number for atom 1 is: ",
$mol->atoms(1)->attr("canon/class");
print "The symmetry class for for atom 1 is: ",
$mol->atoms(1)->attr("canon/symmetry_class");
(and yes, the original comment really does say "for for". we don't fix the sacred text. π«Ά)
π¦ DESCRIPTION π¦
okay so this module hands you functions for "canonicalizing" a molecular structure β which is the fancy way of saying: number those atoms in a unique way, no matter what order they showed up in. the input order doesn't get to decide anything. main character energy only. π
the canonicalization algorithm is based on: Weininger, et. al., J. Chem. Inf. Comp. Sci. 29[2], 97-101 (1989)
this module is part of the PerlMol project, <http://www.perlmol.org/>. π
π ATOM ATTRIBUTES π
while the canonicalization process is doing its thing, it sets these attributes on every single atom:
canon/classβ the unique canonical number. it's an integer, and it runs from1to the number of atoms. that's the whole range bestie, no gaps, no drama. β¨canon/symmetry_classβ the symmetry class number. atoms sharing the same symmetry class are considered to be topologically equivalent. for example, the two methyl carbons on2-propanolwould have the same symmetry class. twins!! π―
π FUNCTIONS π
these functions may be exported, although nothing is exported by default. you gotta ask for it. π
canonicalize($mol, %opts)β canonicalizes the molecule. it adds thecanon/classandcanon/symmetry classto every atom, as discussed above. this function may take the following options:sortβ if true, sort the atoms in the molecule in ascending canonical number order. so tidy. so organized. π§Ήinvariantsβ this should be a subroutine reference that takes an atom and returns a number. these number should be based on the topological invariant properties of the atom, such assymbol,charge,number of bonds, etc. (yes, the original says "These number". we're keeping it. iconic. π)
β VERSION β
0.11
π TO DO π
- add some tests.
(that's it. that's the whole list. lowkey relatable. π)
π CAVEATS π
currently there is an atom limit of about 430 atoms. bestie, know your limits. π§
these algorithm is known to fail to discriminate between non-equivalent atoms for some complicated cases. these are usually highly bridged structures explicitly designed to break canonicalization algorithms; i don't know of any "real-looking structure" (meaning something that someone would actually synthesize or find in nature) that fails, but don't say I didn't warn you! π
π₯ SEE ALSO π₯
Chemistry::MolChemistry::AtomChemistry::Obj- <http://www.perlmol.org/>
π AUTHOR π
Ivan Tubert <itub@cpan.org> π«Ά
π COPYRIGHT π
Copyright (c) 2009 Ivan Tubert. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
and that's a wrap, bestie π this page came to you from perl v5.42.0, dated 2026-01-17, and it lives in the Canonicalize(3) manpage. go number some atoms. slay. β¨ππ¦
π¦ where this page comes from
- fedora 44: perl-Chemistry-Canonicalize 0.11-2.fc44 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms