HackaMol::Angle - Angle class for HackaMol
version 0.041
use HackaMol::Atom; use HackaMol::Angle; 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 $angle1 = HackaMol::Angle->new(name=>'OH2', atoms=>[$atom1,$atom2,$atom3]); my $angle2 = HackaMol::Angle->new(name=>'OH2', atoms=>[$atom2,$atom1,$atom3]); foreach my $angle ($angle1, $angle2){ my $pangle = sprintf( "Angle: %s, angle: %.2f, vector normal to angle plane: %.5 %.5 %.5 \n", $angle->name, $angle->ang, @{$angle->ang_normvec}, ); print $pangle; } my @COM_ats = map {HackaMol::Atom->new( name => "X".$_->name."X", coords => [ $_->COM ], Z => 1) }($angle1, $angle2); my @ang_w_HH = grep { $_->get_atoms(0)->Z == 1 and $_->get_atoms(1)->Z == 1} ($angle1, $angle2);
The HackaMol Angle class provides a set of methods and attributes for working with two connections between three atoms. Like the Bond, the Angle class consumes the AtomGroupRole providing methods to determine the center of mass, total charge, etc (see HackaMol::AtomGroupRole). An Angle containing (atom1,atom2,atom3) produce angles between the atom21 atom23 interatomic vectors.
The Angle class also provides attributes and methods to set force_constants and measure energy. The angle_energy method calls on a CodeRef attribute that the user may define. See descriptions below.
no arguments. returns Math::Vector::Real (MVR) object from the normalized cross product of the atom21 and atom23 interatomic vectors.
no arguments. returns vector (MVR) that bisects the angle between the two vectors of the angle.
no arguments. returns the angle (degrees) between the atom21 and atom23 vectors.
no arguments. returns the angle (radians) between the atom21 and atom23 vectors.
arguments, as many as you want. Calculates energy using the angle_efunc described below, if the attribute, angle_fc > 0. The angle_energy method calls the angle_efunc as follows:
my $energy = &{$self->angle_efunc}($self,@_);
which will pass $self and that in @_ array to angle_efunc, which, similar to the Bond class, can be redefined.
isa Str that is lazy and rw. useful for labeling, bookkeeping...
isa Num that is lazy and rw. default = 0. force constant for harmonic potentials.
isa Num that is lazy and rw. default = 0. Equilibrium angle. The ang method returns angle in degrees.
isa CodeRef that is lazy and rw. default uses builder to generate harmonic potential from the angle_fc, ang_eq, and ang. See the _build_angle_efunc, if interested in changing the function form.
HackaMol::AtomGroupRole
HackaMol::Bond
HackaMol::Dihedral
Moose::Object
HackaMol::Roles::AtomGroupRole
HackaMol::Roles::NameRole
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.