| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Chemistry::ESPT::Aprmcrd; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
26070
|
use base qw(Chemistry::ESPT::ESSfile); |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
678
|
|
|
4
|
1
|
|
|
1
|
|
7
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
30
|
|
|
5
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
1884
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Chemistry::ESPT::Aprmcrd - AMBER prmcrd file object. |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use Chemistry::ESPT::Aprmcrd; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $prmcrd = Chemistry::ESPT::Aprmcrd->new(); |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
This module provides methods to quickly access data contained in an AMBER prmcrd file. |
|
20
|
|
|
|
|
|
|
AMBER prmcrd files can only be read currently. |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=cut |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=begin comment |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
### Version History ### |
|
29
|
|
|
|
|
|
|
0.01 digest prmcrd files from Amber9 |
|
30
|
|
|
|
|
|
|
0.02 moved to Chemistry::ESPT namespace |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=end comment |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
All attributes are currently read-only and get populated by reading the assigned ESS file. Attribute values are |
|
37
|
|
|
|
|
|
|
accessible through the B<$Aprmcrd-Eget()> method. |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=over 15 |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=item CARTCOORD |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
NATOMS x 3 matrix containing Cartesian coordinates |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=back |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 METHODS |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Method parameters denoted in [] are optional. |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=over 15 |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=item B<$prmcrd-Enew()> |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Creates a new Aprmcrd object |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
## the object constructor ** |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub new { |
|
62
|
1
|
|
|
1
|
1
|
13
|
my $invocant = shift; |
|
63
|
1
|
|
33
|
|
|
12
|
my $class = ref($invocant) || $invocant; |
|
64
|
1
|
|
|
|
|
17
|
my $prmcrd = Chemistry::ESPT::ESSfile->new(); |
|
65
|
|
|
|
|
|
|
|
|
66
|
1
|
|
|
|
|
7
|
$prmcrd->{PROGRAM} = "AMBER"; |
|
67
|
1
|
|
|
|
|
10
|
$prmcrd->{TYPE} = "prmcrd"; |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# molecular info |
|
70
|
1
|
|
|
|
|
3
|
$prmcrd->{CARTCOORD} = []; # Current cartesian coordinates |
|
71
|
|
|
|
|
|
|
|
|
72
|
1
|
|
|
|
|
3
|
bless($prmcrd, $class); |
|
73
|
1
|
|
|
|
|
4
|
return $prmcrd; |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
## methods ## |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item B<$prmcrd-Eanalyze(filename [spin])> |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Analyze the spin results in file called filename. Spin defaults to Alpha. |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
# set filename & spin then digest the file |
|
86
|
|
|
|
|
|
|
sub analyze : method { |
|
87
|
0
|
|
|
0
|
1
|
|
my $prmcrd = shift; |
|
88
|
0
|
|
|
|
|
|
$prmcrd->prepare(@_); |
|
89
|
0
|
|
|
|
|
|
$prmcrd->_digest(); |
|
90
|
0
|
|
|
|
|
|
return; |
|
91
|
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
## subroutines ## |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub _digest { |
|
97
|
|
|
|
|
|
|
|
|
98
|
0
|
|
|
0
|
|
|
my $prmcrd = shift; |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
# flags & counters |
|
101
|
0
|
|
|
|
|
|
my $counter = 0; |
|
102
|
0
|
|
|
|
|
|
my $Titleflag = 1; |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
# open filename for reading or display error |
|
105
|
0
|
0
|
|
|
|
|
open(PRMCRDFILE,$prmcrd->{FILENAME}) || die "Could not read $prmcrd->{FILENAME}\n$!\n"; |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
# grab everything which may be useful |
|
108
|
0
|
|
|
|
|
|
while (){ |
|
109
|
|
|
|
|
|
|
# skip blank lines |
|
110
|
0
|
0
|
|
|
|
|
next if /^$/; |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
# title; first line of text |
|
113
|
0
|
0
|
0
|
|
|
|
if ( $Titleflag == 1 && /^[\w\d\-\(\)]+/ ) { |
|
114
|
0
|
|
|
|
|
|
chomp($_); |
|
115
|
0
|
|
|
|
|
|
s/\s+$//; |
|
116
|
0
|
|
|
|
|
|
$prmcrd->{TITLE} = $_; |
|
117
|
0
|
|
|
|
|
|
$Titleflag = 0; |
|
118
|
0
|
|
|
|
|
|
next; |
|
119
|
|
|
|
|
|
|
} |
|
120
|
|
|
|
|
|
|
# number of atoms |
|
121
|
0
|
0
|
0
|
|
|
|
if ( $Titleflag == 0 && /^\s+(\d+)$/ ) { |
|
122
|
0
|
|
|
|
|
|
$prmcrd->{NATOMS} = $1; |
|
123
|
0
|
|
|
|
|
|
next; |
|
124
|
|
|
|
|
|
|
} |
|
125
|
|
|
|
|
|
|
# current cartesian coordinates |
|
126
|
|
|
|
|
|
|
# store in an N x 3 array for the time being |
|
127
|
|
|
|
|
|
|
# switch to PerlMol objects in the future |
|
128
|
0
|
0
|
|
|
|
|
if ( /^\s+((?:-*\d+\.\d+\s+){1,6})/ ) { |
|
129
|
0
|
|
|
|
|
|
my @carts = split /\s+/, $1; |
|
130
|
0
|
|
|
|
|
|
for (my $i=0; $i
|
|
131
|
0
|
|
|
|
|
|
push @{ $prmcrd->{CARTCOORD} [$counter] }, $carts[$i]; |
|
|
0
|
|
|
|
|
|
|
|
132
|
0
|
0
|
|
|
|
|
$counter++ if $#{$prmcrd->{CARTCOORD} [$counter]} == 2; |
|
|
0
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
} |
|
134
|
0
|
|
|
|
|
|
next; |
|
135
|
|
|
|
|
|
|
} |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
} |
|
138
|
|
|
|
|
|
|
} |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
1; |
|
142
|
|
|
|
|
|
|
__END__ |