| Filename | /Users/dde/HackaMol_devel/HackaMol/lib/HackaMol/Atom.pm |
| Statements | Executed 1550025 statements in 1.89s |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 200000 | 1 | 1 | 3.77s | 6.86s | Atom::BUILD |
| 150000 | 1 | 1 | 136ms | 136ms | Atom::_fix_symbol |
| 1 | 1 | 1 | 1.65ms | 338ms | Atom::BEGIN@2 |
| 1 | 1 | 1 | 1.26ms | 1.39ms | Atom::BEGIN@8 |
| 1 | 1 | 1 | 562µs | 4.61ms | Atom::BEGIN@3 |
| 1 | 1 | 1 | 478µs | 21.2ms | Atom::BEGIN@6 |
| 1 | 1 | 1 | 7µs | 54µs | Atom::BEGIN@100 |
| 1 | 1 | 1 | 7µs | 36µs | Atom::BEGIN@5 |
| 1 | 1 | 1 | 7µs | 59µs | Atom::BEGIN@93 |
| 1 | 1 | 1 | 6µs | 75µs | Atom::BEGIN@4 |
| 1 | 1 | 1 | 6µs | 52µs | Atom::BEGIN@106 |
| 0 | 0 | 0 | 0s | 0s | Atom::_Z_to_covalent_radius |
| 0 | 0 | 0 | 0s | 0s | Atom::_Z_to_symbol |
| 0 | 0 | 0 | 0s | 0s | Atom::_Z_to_vdw_radius |
| 0 | 0 | 0 | 0s | 0s | Atom::__ANON__[lib/HackaMol/Atom.pm:62] |
| 0 | 0 | 0 | 0s | 0s | Atom::_build_Z |
| 0 | 0 | 0 | 0s | 0s | Atom::_build_covalent_radius |
| 0 | 0 | 0 | 0s | 0s | Atom::_build_symbol |
| 0 | 0 | 0 | 0s | 0s | Atom::_build_vdw_radius |
| 0 | 0 | 0 | 0s | 0s | Atom::_symbol_to_Z |
| 0 | 0 | 0 | 0s | 0s | Atom::_symbol_to_mass |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Atom; | ||||
| 2 | 2 | 87µs | 2 | 342ms | # spent 338ms (1.65+337) within Atom::BEGIN@2 which was called:
# once (1.65ms+337ms) by main::BEGIN@5 at line 2 # spent 338ms making 1 call to Atom::BEGIN@2
# spent 3.45ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:519] |
| 3 | 2 | 102µs | 2 | 4.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 # spent 4.61ms making 1 call to Atom::BEGIN@3
# spent 23µs making 1 call to namespace::autoclean::import |
| 4 | 2 | 22µs | 2 | 143µ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 # spent 75µs making 1 call to Atom::BEGIN@4
# spent 68µs making 1 call to lib::import |
| 5 | 2 | 21µs | 2 | 66µ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 # spent 36µs making 1 call to Atom::BEGIN@5
# spent 30µs making 1 call to Exporter::import |
| 6 | 2 | 118µs | 2 | 21.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 # spent 21.2ms making 1 call to Atom::BEGIN@6
# spent 269µs making 1 call to MooseX::Storage::import |
| 7 | 1 | 5µs | 2 | 274ms | with 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 |
| 8 | 2 | 1.30ms | 2 | 1.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 # spent 1.39ms making 1 call to Atom::BEGIN@8
# spent 128µs making 1 call to Exporter::import |
| 9 | |||||
| 10 | 1 | 2µs | 1 | 6.32ms | has '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 | |||||
| 18 | sub _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 | |||||
| 24 | 1 | 2µs | 1 | 2.54ms | has '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 | |||||
| 32 | sub _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 | |||||
| 38 | has $_ => ( | ||||
| 39 | is => 'rw', | ||||
| 40 | isa => 'Num', | ||||
| 41 | predicate => "has_$_", | ||||
| 42 | lazy => 1, | ||||
| 43 | builder => "_build_$_", | ||||
| 44 | 1 | 5µs | 2 | 9.11ms | ) foreach (qw(covalent_radius vdw_radius)); # spent 9.11ms making 2 calls to Moose::has, avg 4.56ms/call |
| 45 | |||||
| 46 | sub _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 | |||||
| 52 | sub _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 | |||||
| 58 | has 'bonds' => ( | ||||
| 59 | traits => [ 'Array' ], | ||||
| 60 | is => 'rw', | ||||
| 61 | isa => 'ArrayRef[Bond]', | ||||
| 62 | default => sub { [] }, | ||||
| 63 | 1 | 9µs | 1 | 38.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 | ||||
| 79 | 200000 | 20.3ms | my $self = shift; | ||
| 80 | |||||
| 81 | 200000 | 229ms | 350000 | 284ms | 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 | |||||
| 85 | 200000 | 139ms | 200000 | 157ms | $self->push_charges($self->charge) if $self->has_charge; # spent 157ms making 200000 calls to Atom::has_charge, avg 787ns/call |
| 86 | 200000 | 342ms | 600000 | 1.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 |
| 87 | 200000 | 154ms | 200000 | 180ms | $self->push_forces($self->force) if $self->has_force; # spent 180ms making 200000 calls to Atom::has_force, avg 900ns/call |
| 88 | 200000 | 122ms | 200000 | 141ms | $self->push_forces($self->force) if $self->has_force; # spent 141ms making 200000 calls to Atom::has_force, avg 706ns/call |
| 89 | 200000 | 619ms | 650000 | 780ms | $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 | |||||
| 92 | sub _symbol_to_Z{ | ||||
| 93 | 2 | 48µs | 2 | 112µ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 # 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 | |||||
| 99 | sub _Z_to_symbol{ | ||||
| 100 | 2 | 40µs | 2 | 102µ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 # 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 | |||||
| 105 | sub _symbol_to_mass{ | ||||
| 106 | 2 | 102µs | 2 | 99µ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 # 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 | ||||
| 113 | 150000 | 261ms | return ucfirst( lc( shift ) ); | ||
| 114 | } | ||||
| 115 | |||||
| 116 | sub _Z_to_covalent_radius{ | ||||
| 117 | my $Z = shift; | ||||
| 118 | # index 1 for single bond length.. | ||||
| 119 | return $COVALENT_RADII[$Z][1]/100; | ||||
| 120 | } | ||||
| 121 | |||||
| 122 | sub _Z_to_vdw_radius{ | ||||
| 123 | my $Z = shift; | ||||
| 124 | return $VDW_RADII[$Z][1]/100; | ||||
| 125 | } | ||||
| 126 | |||||
| 127 | 1 | 5µs | 2 | 26.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 | |||||
| 129 | 1 | 31µs | 1; | ||
| 130 | |||||
| 131 | 1 | 21µs | 1 | 1.57ms | __END__ # spent 1.57ms making 1 call to B::Hooks::EndOfScope::XS::__ANON__[B/Hooks/EndOfScope/XS.pm:26] |