HackaMol/Dihedral.pm

filter: Statementstmt 100% 48 / 48 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 14 / 14 Podpod 100% 4 / 4 totaltotal 100% 66 / 66 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« HackaMol/Bond.pm ↑ Summary HackaMol/Roles/BondsAnglesDihedralsRole.pm »
1 package HackaMol::Dihedral;
2 12 $HackaMol::Dihedral::VERSION = '0.053';
3 #ABSTRACT: Dihedral Angle class for HackaMol
4 12 ▶use 5.008;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 12 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 12 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 12 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 12 ▶use Math::Trig;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 12 ▶use MooseX::StrictConstructor;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 #use MooseX::Storage;
12 #with Storage( 'io' => 'StorableFile' ),
13 12 with 'HackaMol::Roles::NameRole', 'HackaMol::Roles::AtomGroupRole';
14  
15 has $_ => (
16 is => 'rw',
17 isa => 'Num',
18 default => 0,
19 lazy => 1,
20 clearer => "clear_$_",
21 12 ) foreach qw(dihe_fc dihe_dphase dihe_eq dihe_mult);
22  
23 144 ▶sub dihe_deg {
Subroutine dihe_deg: called CC=1 SCAR=0.0
Pod documented
24 144 my $self = shift;
25 144 my @atoms = $self->all_atoms;
26 144 return ( $atoms[0]->dihedral_deg( $atoms[1], $atoms[2], $atoms[3] ) );
27 }
28  
29 2 ▶sub dihe_rad {
Subroutine dihe_rad: called CC=1 SCAR=0.0
Pod documented
30 2 my $self = shift;
31 2 my @atoms = $self->all_atoms;
32 2 return ( $atoms[0]->dihedral_rad( $atoms[1], $atoms[2], $atoms[3] ) );
33 }
34  
35 12 has 'improper_dihe_efunc' => (
36 is => 'rw',
37 isa => 'CodeRef',
38 builder => "_build_improper_dihe_efunc",
39 lazy => 1,
40 );
41  
42 1 ▶sub _build_improper_dihe_efunc {
Subroutine _build_improper_dihe_efunc: called CC=1 SCAR=0.0
43 2 ▶ my $subref = sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
44 2 my $dihedral = shift;
45 2 my $val = ( $dihedral->dihe_deg - $dihedral->dihe_eq )**2;
46 2 return ( $dihedral->dihe_fc * $val );
47 1 };
48 1 return ($subref);
49 }
50  
51 12 has 'torsion_efunc' => (
52 is => 'rw',
53 isa => 'CodeRef',
54 builder => "_build_torsion_efunc",
55 lazy => 1,
56 );
57  
58 1 ▶sub _build_torsion_efunc {
Subroutine _build_torsion_efunc: called CC=1 SCAR=0.0
59 2 ▶ my $subref = sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
60 2 my $dihedral = shift;
61 2 my $val =
62 1 +
63 cos( $dihedral->dihe_mult * $dihedral->dihe_rad -
64 $dihedral->dihe_dphase );
65 2 return ( $dihedral->dihe_fc * $val );
66 1 };
67 1 return ($subref);
68 }
69  
70 3 ▶sub torsion_energy {
Subroutine torsion_energy: called CC=1 SCAR=0.0
Pod documented
71 3 my $self = shift;
72 3 my $energy = &{ $self->torsion_efunc }( $self, @_ );
73 3 return ($energy);
74 }
75  
76 3 ▶sub improper_dihe_energy {
Subroutine improper_dihe_energy: called CC=1 SCAR=0.0
Pod documented
77 3 my $self = shift;
78 3 my $energy = &{ $self->improper_dihe_efunc }( $self, @_ );
79 3 return ($energy);
80 }
81  
82 12 __PACKAGE__->meta->make_immutable;
83  
84 12 1;
85  
86 __END__
« HackaMol/Bond.pm ↑ Summary HackaMol/Roles/BondsAnglesDihedralsRole.pm »