| 1 | package HackaMol::AtomGroup; | ||||||||||
| 2 | 14 | $HackaMol::AtomGroup::VERSION = '0.053'; | |||||||||
| 3 | #ABSTRACT: HackaMol AtomGroup class | ||||||||||
| 4 | 14 | ▶ | use 5.008; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 14 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 14 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 14 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 14 | ▶ | use MooseX::StrictConstructor; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | #use MooseX::Storage; | ||||||||||
| 11 | #with Storage( 'io' => 'StorableFile' ), | ||||||||||
| 12 | 14 | with 'HackaMol::Roles::NameRole', | |||||||||
| 13 | 'HackaMol::Roles::AtomGroupRole', | ||||||||||
| 14 | 'HackaMol::Roles::SelectionRole'; | ||||||||||
| 15 | |||||||||||
| 16 | 8 | ▶ | sub Rg { | ||||||||
|
Subroutine
Rg: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 17 | |||||||||||
| 18 | #radius of gyration. | ||||||||||
| 19 | 8 | my $self = shift; | |||||||||
| 20 | 8 | ▶ | return (0) unless ( $self->count_atoms ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | 7 | my @atoms = $self->all_atoms; | |||||||||
| 22 | 7 | my $com = $self->COM; | |||||||||
| 23 | 7 | my $total_mass = $self->total_mass; | |||||||||
| 24 | 7 | my @masses = map { $_->mass } @atoms; | |||||||||
| 25 | 7 | my @dvec2 = map { $_ * $_ } map { $_->get_coords( $_->t ) - $com } @atoms; | |||||||||
| 26 | 7 | my $sum = 0; | |||||||||
| 27 | 7 | $sum += $masses[$_] * $dvec2[$_] foreach 0 .. $#dvec2; | |||||||||
| 28 | 7 | return ( sqrt( $sum / $total_mass ) ); | |||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | 14 | __PACKAGE__->meta->make_immutable; | |||||||||
| 32 | |||||||||||
| 33 | 14 | 1; | |||||||||
| 34 | |||||||||||
| 35 | __END__ | ||||||||||