Demian Riccardi > HackaMol-0.00_07 > HackaMol::Molecule

Download:
HackaMol-0.00_07.tar.gz

Dependencies

Annotate this POD

Source   Latest Release: HackaMol-0.00_21

NAME ^

HackaMol::Molecule - Molecule class for HackaMol

VERSION ^

version 0.00_07

SYNOPSIS ^

    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

DESCRIPTION ^

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.

METHODS ^

t

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.

push_groups_by_atom_attr

takes atom attribute as argument. pushes the atoms into the atomgroup array by attribute

all_bonds_atoms

takes array of atoms as argument, returns array of bonds that includes 1 or more of those atoms

all_angles_atoms

takes array of atoms as argument, returns array of angles that includes 1 or more of those atoms

all_dihedrals_atoms

takes array of atoms as argument, returns array of dihedrals that includes 1 or more of those atoms

bond_stretch_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)).

bond_stretch_groups

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.

angle_bend_atoms

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)).

angle_bend_groups

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)).

dihedral_rotate_atoms

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)).

dihedral_rotate_groups

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 METHODS ^

push_groups, get_groups, set_groups, all_groups, count_groups, delete_groups, clear_groups

ARRAY traits for the groups attribute, respectively: push, get, set, elements, count, delete, clear

push_groups

push bond on to groups array

$group->push_groups($bond1, $bond2, @othergroups);

all_groups

returns array of all elements in groups array

print $_->bond_order, "\n" foreach $group->all_groups;

get_groups

return element by index from groups array

print $group->get_groups(1); # returns $bond2 from that pushed above

set_groups

set groups array by index

$group->set_groups(1, $bond1);

count_groups

return number of groups in the array

print $group->count_groups;

has_groups

same as count_groups, allows clearer conditional code. i.e. doing something if $mol->has_groups;

push_bonds, set_bonds, delete_bonds, clear_bonds

MODIFIED ARRAY traits for the bonds attribute provided by BondsAnglesDihedralsRole

push_bonds

before push_bonds, bond_count is incremented for all atoms in all bonds to be pushed.

set_bonds

around set_bonds, bound_count decremented for all atoms in bond being replaced. Then, bond_count is incremented for all atoms in new bond

delete_bonds

before deleting bond, bond_count decremented for all atoms in bond.

clear_bonds

before clearing bonds, bond_count decremented for all atoms in all bonds.

SEE ALSO ^

EXTENDS ^

CONSUMES ^

AUTHOR ^

Demian Riccardi <demianriccardi@gmail.com>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2013 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.

syntax highlighting: