HackaMol::Molecule - Molecule class for HackaMol
version 0.00_13
use HackaMol; use Math::Vector::Real; my $hack = HackaMol->new(name => "hackitup"); my @atoms = $hack->read_file_atoms("t/lib/1L2Y.pdb"); my $mol = HackaMol::Molecule->new(name=> 'trp-cage', atoms=>[@atoms]); $mol->translate(-$mol->COM); $mol->rotate(V(1,0,0), 180, V(10,10,10)); $mol->print_xyz; # see examples
The Molecule class provides methods and attributes for collections of atoms that may be divided into groups, placed into bonds, angles, and dihedrals. The Molecule class extends the AtomGroup parent class, which consumes the AtomGroupRole, and consumes PhysVecMVRRole, QmRole, and BondsAnglesDihedralsRole. See the documentation of those classes and roles for details.
In addition to Bonds, Angles, and Dihedrals, which also consume the AtomGroupRole, the Molecule class has the atomgroups attr. The atomgroups attr is an ArrayRef[AtomGroup] with native array traits that allows all the atoms in the Molecule to be grouped and regroup at will. Thus, the Molecule class provides a suite of methods and attributes that is very powerful. For example, a HackaMolX extension for proteins could group the atoms by sidechains and backbones, populate bonds, and then use Math::Vector::Real objects to sample alternative conformations of the sidechains and backbone.
t is the same attr as before. Molecule modifies t. the $mol->t accessor behaves as before. The $mol->(1) setter $self->gt(1) to set t for all atoms in the molecule.
takes atom attribute as argument. pushes the atoms into the atomgroup array by attribute
takes array of atoms as argument, returns array of bonds that includes 1 or more of those atoms
takes array of atoms as argument, returns array of angles that includes 1 or more of those atoms
takes array of atoms as argument, returns array of dihedrals that includes 1 or more of those atoms
takes Bond object, a distance (angstroms, typically), and active atoms as arguments. translates the active atoms along the bond_vector by the distance and stores coordinates in place ($atom->set_coords($mol->t,$translated_coors)).
takes Bond object, a distance (angstroms, typically), and active groups as arguments. translates the atoms in the active groups along the bond_vector by the distance and stores coordinates in place.
takes Angle object, an angle (degress), and active atoms as arguments. rotates the active atoms about the vector normal to be angle and stores rotated coordinates in place ($atom->set_coords($mol->t,$rotated_coor)).
takes Angle object, an angle (degress), and active groups as arguments. rotates the atoms in the active groups about the vector normal to be angle and stores rotated coordinates in place ($atom->set_coords($mol->t,$rotated_coor)).
takes Dihedral object, an angle (degress), and active atoms as arguments. rotates the active atoms about the dihedral and stores rotated coordinates in place ($atom->set_coords($mol->t,$rotated_coor)).
takes Dihedral object, an angle (degress), and active groups as arguments. rotates atoms in groups about the dihedral and stores rotated coordinates in place ($atom->set_coords($mol->t,$rotated_coor)).
ARRAY traits for the groups attribute, respectively: push, get, set, elements, count, delete, clear
push bond on to groups array
$group->push_groups($bond1, $bond2, @othergroups);
returns array of all elements in groups array
print $_->bond_order, "\n" foreach $group->all_groups;
return element by index from groups array
print $group->get_groups(1); # returns $bond2 from that pushed above
set groups array by index
$group->set_groups(1, $bond1);
return number of groups in the array
print $group->count_groups;
same as count_groups, allows clearer conditional code. i.e. doing something if $mol->has_groups;
MODIFIED ARRAY traits for the bonds attribute provided by BondsAnglesDihedralsRole
before push_bonds, bond_count is incremented for all atoms in all bonds to be pushed.
around set_bonds, bound_count decremented for all atoms in bond being replaced. Then, bond_count is incremented for all atoms in new bond
before deleting bond, bond_count decremented for all atoms in bond.
before clearing bonds, bond_count decremented for all atoms in all bonds.
HackaMol::PhysVecMVRRole
HackaMol::BondsAnglesDihedralsRole
HackaMol::QmMolRole
Chemistry::Molecule
HackaMol::AtomGroup
HackaMol::NameRole
HackaMol::QmAtomRole
Demian Riccardi <demianriccardi@gmail.com>
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.
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.