NAME
HackaMol::Atom - HackaMol Atom Class
VERSION
version 0.00_17
SYNOPSIS
use HackaMol::Atom;
use Math::Vector::Real;
my $atom1 = HackaMol::Atom->new(
name => 'Zinc',
coords => [ V( 2.05274, 0.01959, -0.07701 ) ],
Z => 30,
);
print $atom->symbol ; #prints "Zn"
print "clean " unless $atom->is_dirty; #prints clean
$atom->change_symbol("Hg");
print $atom->Z ; #prints 80
print "dirty " if $atom->is_dirty; #prints dirty
DESCRIPTION
Central to HackaMol, the Atom class provides methods and attributes for a given atom. The Atom class consumes HackaMol::PhysVecMVRRole, HackaMol::PdbRole, and HackaMol::QmAtomRole. See the documentation of those roles for details. The Atom class adds attributes (such as symbol, Z, covalent_radius) and methods (such as change_symbol) specific to atoms. Creating an instance of an Atom object requires either the atomic number (Z) or symbol (symbol). The other attributes are lazily built when needed. The Atom class is flexible. The atom type can be changed in place (e.g. convert a zinc atom to a mercury atom, see SYNOPSIS), but changing the type of atom will set the is_dirty flag so that other objects using the atom have the ability to know whether atom-type dependent attributes need to be updated (e.g. forcefield parameters, etc.). Atom data is generated from the PeriodicTable module that borrows data from PerlMol. The PeriodicTable module is for data and will be dumped into a YAML file in the future.
METHODS
change_Z
no arguments. Changes the atom type using Z. change_Z calls _clean_atom which clears all attributes and sets calls is_dirty(1).
change_symbol
no arguments. Changes the atom type using symbol and is analogous to change_Z.
ATTRIBUTES
is_dirty
isa Bool that is lazy and rw. Default is 0. $self->is_dirty(1) called during the change_symbol and change_Z methods.
symbol
isa Str that is lazy and rw. _build_symbol builds the default.
Generating an atom instance with symbol, will run ucfirst(lc ($symbol))
to make sure the format is correct. Thus, creating an atom object is slightly slower with symbol than with Z. If Z is used to generate the instance of the Atom class (my $atom = Atom-
new(Z=>1)>), the _build_symbol
method generates the symbol from Z only when the symbol attribute is read (symbol attribute is lazy).
Z
isa Int that is lazy and rw. _build_Z builds the default
Z is the Atomic number.
covalent_radius
isa Num that is lazy and rw. _build_covalent_radius builds the default.
the covalent radii are taken from those tabulated in:
P. Pyykkoe, M. Atsumi (2009). "Molecular Single-Bond Covalent Radii for Elements 1 to 118". Chemistry: A European Journal 15: 186.
Covalent radii for double and triple bonds, generated from the same authors, are also tabulated but currently not used.
vdw_radius
isa Num that is lazy and rw. _build_vdw_radius builds the default.
Atomic Van der Waals radii information will be revisited and revised. Included as reminder for now. See the source of PeriodicTable.pm for more information.
=bond_count
isa Num that is lazy with a default of 0. The value adjusted with public Counter traits:
inc_bond_count adds 1 by default
dec_bond_count subtracts 1 by default
reset_bond_count sets to zero
SEE ALSO
EXTENDS
CONSUMES
AUTHOR
Demian Riccardi <demianriccardi@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2014 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.