← Index
NYTProf Performance Profile   « line view »
For examples/Atom-timer.pl
  Run on Mon Aug 12 14:45:28 2013
Reported on Mon Aug 12 14:46:14 2013

Filename/Users/dde/HackaMol_devel/HackaMol/lib/HackaMol/Atom.pm
StatementsExecuted 1550025 statements in 1.89s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
200000113.77s6.86sAtom::::BUILDAtom::BUILD
15000011136ms136msAtom::::_fix_symbolAtom::_fix_symbol
1111.65ms338msAtom::::BEGIN@2Atom::BEGIN@2
1111.26ms1.39msAtom::::BEGIN@8Atom::BEGIN@8
111562µs4.61msAtom::::BEGIN@3Atom::BEGIN@3
111478µs21.2msAtom::::BEGIN@6Atom::BEGIN@6
1117µs54µsAtom::::BEGIN@100Atom::BEGIN@100
1117µs36µsAtom::::BEGIN@5Atom::BEGIN@5
1117µs59µsAtom::::BEGIN@93Atom::BEGIN@93
1116µs75µsAtom::::BEGIN@4Atom::BEGIN@4
1116µs52µsAtom::::BEGIN@106Atom::BEGIN@106
0000s0sAtom::::_Z_to_covalent_radiusAtom::_Z_to_covalent_radius
0000s0sAtom::::_Z_to_symbolAtom::_Z_to_symbol
0000s0sAtom::::_Z_to_vdw_radiusAtom::_Z_to_vdw_radius
0000s0sAtom::::__ANON__[lib/HackaMol/Atom.pm:62]Atom::__ANON__[lib/HackaMol/Atom.pm:62]
0000s0sAtom::::_build_ZAtom::_build_Z
0000s0sAtom::::_build_covalent_radiusAtom::_build_covalent_radius
0000s0sAtom::::_build_symbolAtom::_build_symbol
0000s0sAtom::::_build_vdw_radiusAtom::_build_vdw_radius
0000s0sAtom::::_symbol_to_ZAtom::_symbol_to_Z
0000s0sAtom::::_symbol_to_massAtom::_symbol_to_mass
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Atom;
2287µs2342ms
# spent 338ms (1.65+337) within Atom::BEGIN@2 which was called: # once (1.65ms+337ms) by main::BEGIN@5 at line 2
use Moose;
# spent 338ms making 1 call to Atom::BEGIN@2 # spent 3.45ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:519]
32102µs24.63ms
# spent 4.61ms (562µs+4.05) within Atom::BEGIN@3 which was called: # once (562µs+4.05ms) by main::BEGIN@5 at line 3
use namespace::autoclean;
# spent 4.61ms making 1 call to Atom::BEGIN@3 # spent 23µs making 1 call to namespace::autoclean::import
4222µs2143µs
# spent 75µs (6+68) within Atom::BEGIN@4 which was called: # once (6µs+68µs) by main::BEGIN@5 at line 4
use lib 'lib/roles', 'lib/HackaMol/lib';
# spent 75µs making 1 call to Atom::BEGIN@4 # spent 68µs making 1 call to lib::import
5221µs266µs
# spent 36µs (7+30) within Atom::BEGIN@5 which was called: # once (7µs+30µs) by main::BEGIN@5 at line 5
use Carp;
# spent 36µs making 1 call to Atom::BEGIN@5 # spent 30µs making 1 call to Exporter::import
62118µs221.5ms
# spent 21.2ms (478µs+20.7) within Atom::BEGIN@6 which was called: # once (478µs+20.7ms) by main::BEGIN@5 at line 6
use MooseX::Storage;
# spent 21.2ms making 1 call to Atom::BEGIN@6 # spent 269µs making 1 call to MooseX::Storage::import
715µs2274mswith Storage('io' => 'StorableFile'), 'PhysVecRole';
# spent 246ms making 1 call to Moose::with # spent 27.7ms making 1 call to MooseX::Storage::_injected_storage_role_generator
821.30ms21.51ms
# spent 1.39ms (1.26+128µs) within Atom::BEGIN@8 which was called: # once (1.26ms+128µs) by main::BEGIN@5 at line 8
use PeriodicTable qw(@ELEMENTS %ELEMENTS %ATOMIC_MASSES @COVALENT_RADII @VDW_RADII %ATOM_MULTIPLICITY);
# spent 1.39ms making 1 call to Atom::BEGIN@8 # spent 128µs making 1 call to Exporter::import
9
1012µs16.32mshas 'symbol' => (
# spent 6.32ms making 1 call to Moose::has
11 is => 'rw',
12 isa => 'Str',
13 predicate => 'has_symbol',
14 lazy => 1,
15 builder => '_build_symbol',
16 );
17
18sub _build_symbol {
19 # if we are building symbol, Z must exist. BUILD croaks without one of them
20 my $self = shift;
21 $self->symbol( _Z_to_symbol($self->Z) );
22}
23
2412µs12.54mshas 'Z' => (
# spent 2.54ms making 1 call to Moose::has
25 is => 'rw',
26 isa => 'Int',
27 predicate => 'has_Z',
28 lazy => 1,
29 builder => '_build_Z',
30 );
31
32sub _build_Z {
33 # if we are building Z, symbol must exist. BUILD croaks without one of them
34 my $self = shift;
35 $self->Z( _symbol_to_Z($self->symbol) );
36}
37
38has $_ => (
39 is => 'rw',
40 isa => 'Num',
41 predicate => "has_$_",
42 lazy => 1,
43 builder => "_build_$_",
4415µs29.11ms ) foreach (qw(covalent_radius vdw_radius));
# spent 9.11ms making 2 calls to Moose::has, avg 4.56ms/call
45
46sub _build_covalent_radius {
47 # if we are building symbol, Z must exist. BUILD croaks without one of them
48 my $self = shift;
49 $self->covalent_radius( _Z_to_covalent_radius($self->Z) );
50}
51
52sub _build_vdw_radius {
53 # if we are building symbol, Z must exist. BUILD croaks without one of them
54 my $self = shift;
55 $self->vdw_radius( _Z_to_vdw_radius($self->Z) );
56}
57
58has 'bonds' => (
59 traits => [ 'Array' ],
60 is => 'rw',
61 isa => 'ArrayRef[Bond]',
62 default => sub { [] },
6319µs138.2ms lazy => 1,
# spent 38.2ms making 1 call to Moose::has
64 weak_ref => 1,
65 handles =>
66 {
67 "has_bonds" => 'count' ,
68 "add_bonds" => 'push' ,
69 "get_bonds" => 'get' ,
70 "set_bonds" => 'set' ,
71 "all_bonds" => 'elements',
72 "count_bonds" => 'count' ,
73 "break_bonds" => 'delete' ,
74 "clear_bonds" => 'clear' ,
75 },
76);
77
78
# spent 6.86s (3.77+3.09) within Atom::BUILD which was called 200000 times, avg 34µs/call: # 200000 times (3.77s+3.09s) by Atom::new at line 219 of (eval 74)[Eval/Closure.pm:135], avg 34µs/call
sub BUILD {
7920000020.3ms my $self = shift;
80
81200000229ms350000284ms unless ($self->has_Z or $self->has_symbol){
# spent 164ms making 200000 calls to Atom::has_Z, avg 820ns/call # spent 120ms making 150000 calls to Atom::has_symbol, avg 801ns/call
82 croak "Either Z or Symbol must be set when calling Atom->new()";
83 }
84
85200000139ms200000157ms $self->push_charges($self->charge) if $self->has_charge;
# spent 157ms making 200000 calls to Atom::has_charge, avg 787ns/call
86200000342ms6000001.55s $self->push_coords($self->coord) if $self->has_coord;
# spent 1.14s making 200000 calls to Atom::push_coords, avg 6µs/call # spent 242ms making 200000 calls to Atom::coord, avg 1µs/call # spent 163ms making 200000 calls to Atom::has_coord, avg 813ns/call
87200000154ms200000180ms $self->push_forces($self->force) if $self->has_force;
# spent 180ms making 200000 calls to Atom::has_force, avg 900ns/call
88200000122ms200000141ms $self->push_forces($self->force) if $self->has_force;
# spent 141ms making 200000 calls to Atom::has_force, avg 706ns/call
89200000619ms650000780ms $self->symbol( _fix_symbol($self->symbol) ) if ($self->has_symbol);
# spent 501ms making 300000 calls to Atom::symbol, avg 2µs/call # spent 144ms making 200000 calls to Atom::has_symbol, avg 722ns/call # spent 136ms making 150000 calls to Atom::_fix_symbol, avg 904ns/call
90}
91
92sub _symbol_to_Z{
93248µs2112µs
# spent 59µs (7+52) within Atom::BEGIN@93 which was called: # once (7µs+52µs) by main::BEGIN@5 at line 93
use PeriodicTable qw(%ELEMENTS);
# spent 59µs making 1 call to Atom::BEGIN@93 # spent 52µs making 1 call to Exporter::import
94 my $symbol = shift;
95 $symbol = ucfirst( lc($symbol) );
96 return $ELEMENTS{$symbol};
97}
98
99sub _Z_to_symbol{
100240µs2102µs
# spent 54µs (7+47) within Atom::BEGIN@100 which was called: # once (7µs+47µs) by main::BEGIN@5 at line 100
use PeriodicTable qw(@ELEMENTS);
# spent 54µs making 1 call to Atom::BEGIN@100 # spent 47µs making 1 call to Exporter::import
101 my $Z = shift;
102 return $ELEMENTS[$Z];
103}
104
105sub _symbol_to_mass{
1062102µs299µs
# spent 52µs (6+46) within Atom::BEGIN@106 which was called: # once (6µs+46µs) by main::BEGIN@5 at line 106
use PeriodicTable qw(%ATOMIC_MASSES);
# spent 52µs making 1 call to Atom::BEGIN@106 # spent 46µs making 1 call to Exporter::import
107 my $symbol = shift;
108 $symbol = ucfirst( lc($symbol) );
109 return $ATOMIC_MASSES{$symbol};
110}
111
112
# spent 136ms within Atom::_fix_symbol which was called 150000 times, avg 904ns/call: # 150000 times (136ms+0s) by Atom::BUILD at line 89, avg 904ns/call
sub _fix_symbol{
113150000261ms return ucfirst( lc( shift ) );
114}
115
116sub _Z_to_covalent_radius{
117 my $Z = shift;
118 # index 1 for single bond length..
119 return $COVALENT_RADII[$Z][1]/100;
120}
121
122sub _Z_to_vdw_radius{
123 my $Z = shift;
124 return $VDW_RADII[$Z][1]/100;
125}
126
12715µs226.3ms__PACKAGE__->meta->make_immutable;
# spent 26.3ms making 1 call to Class::MOP::Class::make_immutable # spent 10µs making 1 call to Atom::meta
128
129131µs1;
130
131121µs11.57ms__END__