HackaMol::Roles::BondsAnglesDihedralsRole - Array traits for containers of HackaMol Bonds, Angles, Dihedrals.
version 0.042
The HackaMol BondsAnglesDihedralsRole provides ARRAY trait methods for interacting with arrays of bonds angles and dihedrals. The Molecule class consumes this role. The Atom class does not. Thus, Molecules are responsible for reporting multiple bonded connections for any given atom.
ARRAY traits for the bonds attribute, respectively: push, get, set, elements, count, delete, clear
push bond on to bonds array
$group->push_bonds($bond1, $bond2, @otherbonds);
returns array of all elements in bonds array
print $_->bond_order, "\n" foreach $group->all_bonds;
return element by index from bonds array
print $group->get_bonds(1); # returns $bond2 from that pushed above
set bonds array by index
$group->set_bonds(1, $bond1);
return number of bonds in the array
print $group->count_bonds;
deletes bond from bonds array and returns it.
clears bonds array
Analogous to those for bonds.
my $atom1 = HackaMol::Atom->new( name => 'O1', coords => [ V( 2.05274, 0.01959, -0.07701 ) ], Z => 8, ); my $atom2 = HackaMol::Atom->new( name => 'H1', coords => [ V( 1.08388, 0.02164, -0.12303 ) ], Z => 1, ); my $atom3 = HackaMol::Atom->new( name => 'H2', coords => [ V( 2.33092, 0.06098, -1.00332 ) ], Z => 1, ); my $atom4 = HackaMol::Atom->new( name => 'Cl', coords => [ V(-0.91386, 0.02587, -0.21792 ) ], Z => 17, ); my @atoms = ($atom1,$atom2,$atom3,$atom4); my $bond1 = HackaMol::Angle->new(name=> 'test', atoms[@atoms[0,1]]); my $bond2 = HackaMol::Angle->new(name=> 'test', atoms[@atoms[0,2]]); my @bonds = $atom1->all_bonds; my $angle1 = HackaMol::Angle->new(name=> 'test', atoms[@atoms[1,0,2]]); my $angle2 = HackaMol::Angle->new(name=> 'test', atoms[@atoms[0,1,3]]); my @angles = $atom1->all_angles; my $dihe1 = HackaMol::Dihedral->new(name=> 'test', atoms[@atoms]); my $dihe2 = HackaMol::Dihedral->new(name=> 'test', atoms[reverse @atoms]); my @dihes = $atom1->all_dihedrals;
HackaMol::Molecule
Demian Riccardi <demianriccardi@gmail.com>
This software is copyright (c) 2017 by Demian Riccardi.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install HackaMol, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HackaMol
CPAN shell
perl -MCPAN -e shell install HackaMol
For more information on module installation, please visit the detailed CPAN module installation guide.