Chemistry::Ring(3pm)

πŸ“¦
version 0.21 Β· 2 versions
  • 0.21 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.20 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’ Chemistry::Ring β€” the manual, but make it cute

okay so bestie, welcome to Chemistry::Ring πŸ’– this is the User Contributed Perl Documentation page for it, and we're gonna get you fully acquainted. no cap.


✨ NAME ✨

Chemistry::Ring β€” represent a ring as a substructure of a molecule πŸ¦‹


🌸 SYNOPSIS 🌸

use Chemistry::Ring;

# already have a molecule in $mol...
# create a ring with the first six atoms in $mol
my $ring = Chemistry::Ring->new;
$ring->add_atom($_) for $mol->atoms(1 .. 6);

# find the centroid
my $vector = $ring->centroid;

# find the plane that fits the ring
my ($normal, $distance) = $ring->plane;

# is the ring aromatic?
print "is aromatic!\n" if $ring->is_aromatic;

# "aromatize" a molecule
Chemistry::Ring::aromatize_mol($mol);

# get the rings involving an atom (after aromatizing)
my $rings = $mol->atoms(3)->attr('ring/rings');

like, look at that. it's giving effortless. 🫢


πŸ’… DESCRIPTION πŸ’…

so this module hands you some basic methods for representing a ring. and here's the lil plot twist: a ring is a subclass of molecule, because it literally has atoms and bonds, bestie, it's a whole molecule moment. πŸ‘‘

on top of that it comes with some genuinely useful geometric methods for finding the centroid and the ring plane, plus methods for aromaticity detection. slay.

heads up though: this module does not detect the rings by itself. it is NOT the ring-finder. for that, go look at Chemistry::Ring::Find. okay? okay. πŸ™ˆ

this module is part of the PerlMol project, <http://www.perlmol.org/>. iconic.


πŸŽ€ METHODS πŸŽ€

  • Chemistry::Ring->new(name => value, ...) β€” creates a new Ring object with the attributes you pass in. it's the exact same thing as "Chemistry::Mol->new". πŸ’–
  • $ring->centroid β€” returns a vector with the centroid, which is defined as the average of the coordinates of all the atoms in the ring. the vector (yes, the original spells it "vecotr", we keep it real πŸ’€) is a Math::VectorReal object.
  • my ($norm, $d) = $ring->plane β€” returns the normal and the distance to the origin that define the plane that best fits the atoms in the ring, and it does this by using multivariate regression. the normal vector is a Math::VectorReal object. math ate, fr fr. πŸ”₯
  • $ring->is_aromatic β€” naively guesses whether the ring is aromatic, straight from the molecular graph, with a method based on Huckel's rule. lowkey this method is not very accurate, but it works for simple molecules. returns true or false. ✨

🧚 EXPORTABLE SUBROUTINES 🧚

nothing is exported by default, bestie. but you can export these subroutines explicitly, or all of them at once by using the ':all' tag. your call, your vibe. 🌈

  • aromatize_mol($mol) β€” finds all the aromatic rings in the molecule and marks all the atoms and bonds in those rings as aromatic. ✨

it also adds the 'ring/rings' attribute to the molecule and to all ring atoms and bonds. this attribute is an array reference containing the list of rings that involve that atom or bond β€” or, in the case of the molecule, all the rings. πŸ’…

NOTE β€” the ring/rings attribute is experimental and might change in future versions. so don't get too attached, okay? 😭

πŸ¦‹ SOURCE CODE REPOSITORY πŸ¦‹

<https://github.com/perlmol/Chemistry-Ring>

go. star it. it's the moment. ⭐


πŸ‘€ SEE ALSO πŸ‘€

Chemistry::Mol, Chemistry::Atom, Chemistry::Ring::Find, Math::VectorReal.

the whole friend group. 🫢


πŸ‘‘ AUTHOR πŸ‘‘

Ivan Tubert-Brohman <itub@cpan.org>


Copyright (c) 2009 Ivan Tubert-Brohman. 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 the whole page, bestie!! this was perl v5.36.0, dated 2022-12-18, and the manual is Chemistry::Ring(3pm). πŸ’–βœ¨πŸŽ€ bye ily, go aromatize something responsibly 🧚🌸

πŸ“¦ where this page comes from