line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Chemistry::ESPT::ESSfile; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
32809
|
use strict; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
214
|
|
4
|
6
|
|
|
6
|
|
31
|
use warnings; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
7163
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Chemistry::ESPT::ESSfile - Generic Electronic Structure Suite (ESS) file object. |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 SYNOPSIS |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
package Chemistry::ESPT::MyFile; |
13
|
|
|
|
|
|
|
use base qw(Chemistry::ESPT::ESSfile); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
package Main; |
16
|
|
|
|
|
|
|
my $object = Chemistry::ESPT::MyFile->new(); |
17
|
|
|
|
|
|
|
$object->prepare(filename); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 DESCRIPTION |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
This module is the base class for all of the Electronic Structure Perl Toolkit (ESPT) ESS file objects. It provides the generic |
22
|
|
|
|
|
|
|
attributes, methods, and subroutines common to all ESPT file objects. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=begin comment |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
### Version History ### |
31
|
|
|
|
|
|
|
0.01 consolidate common properties & methods |
32
|
|
|
|
|
|
|
0.02 moved to ESPT namespace, Time property |
33
|
|
|
|
|
|
|
0.03 generalized get method for Rank N tensors, added CHARGE, |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
### To Do ### |
36
|
|
|
|
|
|
|
- Move ENERGY & EINFO attributes here |
37
|
|
|
|
|
|
|
- Move TIME into its own method that automatically handles time addition |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=end comment |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
All attributes are currently read-only and get populated by reading the assigned ESS file. Attribute values are |
44
|
|
|
|
|
|
|
accessible through the B method unless otherwise noted. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=over 10 |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=item ALPHA |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Total number of alpha electrons. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=item ATOMS |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Array of atoms stored as atomic symbols. Array length equals NATOMS. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=item BASIS |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
String containing the basis set employed in the calculation. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=item BETA |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Total number of beta electrons. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=item CHARGE |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Total molecular charge. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=item COMPLETE |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Flag indicating ESS job completion (1). Defaults to 0. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=item DEBUG |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Debug flag enabling or disabling (0) verbose output. Useful when writing new code. |
75
|
|
|
|
|
|
|
Defaults to 0. Accessible via the B method. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item EINFO |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Text description of the energy contained in ENERGY. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=item ENERGY |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Total energy as described by EINFO. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item FILENAME |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Full name of the file, including path if passed, assigned to the object. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=item JOBTYPE |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
ESS job type stored as capitalized keyword(s). Current keywords are: |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=back |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=over 10 |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=over 5 |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=over 10 |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=item SP |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Single Point |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=item OPT |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Optimization |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=item OPT FREQ |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Optimization & Frequency |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=item OPT SP |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Optimization & Single Point |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=item FREQ |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Frequency |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=back |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=back |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=back |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=over 10 |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=item MULTIPLICITY |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Molecular spin multiplicity, 2S+1. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=item NATOMS |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
Total number of atoms. |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=item NBASIS |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Total number of basis functions in the basis set. |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=item PROGRAM |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Full name of the ESS program |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=item SPIN |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Type of electrons, Alpha or Beta, to analyse. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=item THEORY |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Theory level used in the calculation. |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=item TITLE |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
ESS job title. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=item TIME |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
Total time for all calculations perfomed in the ESS file. Stored as an array with four elements, [days, hours, minutes, seconds]. |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=item TYPE |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
File type. This usually equal to the file's extension such as log, out, fchk, etc. |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=back |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head1 METHODS |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
Method parameters denoted in [ ] are optional. |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=over 15 |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=item B<$object-Enew()> |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
Creates a new ESSfile object. |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=cut |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
## the object constructor ** |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
sub new { |
182
|
6
|
|
|
6
|
1
|
28
|
my $invocant = shift; |
183
|
6
|
|
33
|
|
|
44
|
my $class = ref($invocant) || $invocant; |
184
|
6
|
|
|
|
|
19
|
my $ESSfile = {}; |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
# Generating ESS |
187
|
6
|
|
|
|
|
23
|
$ESSfile->{PROGRAM} = undef; |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
# File type (log, out, fchk, etc.) |
190
|
6
|
|
|
|
|
17
|
$ESSfile->{TYPE} = undef; |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
# Analysis info |
193
|
6
|
|
|
|
|
48
|
$ESSfile->{DEBUG} = 0; |
194
|
6
|
|
|
|
|
18
|
$ESSfile->{FILENAME} = undef; |
195
|
6
|
|
|
|
|
17
|
$ESSfile->{SPIN} = undef; |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
# Calculation info |
198
|
6
|
|
|
|
|
23
|
$ESSfile->{BASIS} = undef; |
199
|
6
|
|
|
|
|
20
|
$ESSfile->{CHARGE} = undef; # total molecular charge |
200
|
6
|
|
|
|
|
49
|
$ESSfile->{COMPLETE} = 0; # flag indicating job completion |
201
|
6
|
|
|
|
|
17
|
$ESSfile->{EINFO} = undef; # string description of ENERGY |
202
|
6
|
|
|
|
|
17
|
$ESSfile->{ENERGY} = undef; # total energy |
203
|
6
|
|
|
|
|
19
|
$ESSfile->{JOBTYPE} = undef; # type of calculation performed |
204
|
6
|
|
|
|
|
17
|
$ESSfile->{MULTIPLICITY} = undef; # 2S+1 |
205
|
6
|
|
|
|
|
18
|
$ESSfile->{NBASIS} = undef; |
206
|
6
|
|
|
|
|
15
|
$ESSfile->{THEORY} = undef; |
207
|
6
|
|
|
|
|
28
|
$ESSfile->{TIME} = [ 0, 0, 0, 0 ]; # Total computation time in days [0], hours [1], minutes [2], seconds [3] |
208
|
6
|
|
|
|
|
23
|
$ESSfile->{TITLE} = undef; |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
# Molecular info |
211
|
6
|
|
|
|
|
15
|
$ESSfile->{ALPHA} = undef; |
212
|
6
|
|
|
|
|
14
|
$ESSfile->{ATOMS} = undef; |
213
|
6
|
|
|
|
|
15
|
$ESSfile->{BETA} = undef; |
214
|
6
|
|
|
|
|
28
|
$ESSfile->{NATOMS} = undef; |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
|
217
|
6
|
|
|
|
|
19
|
bless($ESSfile, $class); |
218
|
6
|
|
|
|
|
622
|
return $ESSfile; |
219
|
|
|
|
|
|
|
} |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
### Methods ### |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=item B<$object-Eprepare(filename [spin])> |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
Set FILENAME, and SPIN. SPIN defaults to Alpha. |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=cut |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
# set filename, spin, & debug options |
231
|
|
|
|
|
|
|
sub prepare : method { |
232
|
0
|
|
|
0
|
1
|
0
|
my $ESSfile = shift; |
233
|
0
|
|
|
|
|
0
|
$ESSfile->{FILENAME} = shift; |
234
|
0
|
|
|
|
|
0
|
$ESSfile->{SPIN} = shift; |
235
|
0
|
|
0
|
|
|
0
|
$ESSfile->{SPIN} ||= "Alpha"; |
236
|
0
|
|
|
|
|
0
|
return; |
237
|
|
|
|
|
|
|
} |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
=item B<$object-Eatomconvert(atom)> |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
Convert atomic symbols to atomic numbers and vice versa. Atom must |
244
|
|
|
|
|
|
|
be a valid atomic symbol or number. |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
=cut |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
# Convert atomic numbers to atomic symbols |
250
|
|
|
|
|
|
|
sub atomconvert : method { |
251
|
0
|
|
|
0
|
1
|
0
|
shift; # remove object reference |
252
|
0
|
|
|
|
|
0
|
my (@num2sym, %sym2num); |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
#populate atomic symbols |
255
|
0
|
|
|
|
|
0
|
@num2sym = ("H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne"); |
256
|
0
|
|
|
|
|
0
|
push @num2sym, ("Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar"); |
257
|
0
|
|
|
|
|
0
|
push @num2sym, ("K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr"); |
258
|
0
|
|
|
|
|
0
|
push @num2sym, ("Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe"); |
259
|
0
|
|
|
|
|
0
|
push @num2sym, ("Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu"); |
260
|
0
|
|
|
|
|
0
|
push @num2sym, ("Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn"); |
261
|
0
|
|
|
|
|
0
|
push @num2sym, ("Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr"); |
262
|
0
|
|
|
|
|
0
|
push @num2sym, ("Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg", "Uub", "Uut", "Uuq", "Uup"); |
263
|
|
|
|
|
|
|
|
264
|
0
|
|
|
|
|
0
|
for (my $i=0; $i
|
265
|
0
|
|
|
|
|
0
|
$sym2num{$num2sym[$i]} = $i+1; |
266
|
|
|
|
|
|
|
} |
267
|
0
|
|
|
|
|
0
|
$sym2num{D} = $sym2num{T} = 1; |
268
|
|
|
|
|
|
|
|
269
|
0
|
|
|
|
|
0
|
my $value = shift; |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
# determine what was passed and return the opposite |
272
|
0
|
0
|
|
|
|
0
|
if ( $value =~ /^[a-zA-Z]+\Z/ ){ |
273
|
0
|
|
|
|
|
0
|
return $sym2num{$value}; |
274
|
|
|
|
|
|
|
} else { |
275
|
0
|
0
|
|
|
|
0
|
if ( $value <= $#num2sym ) { |
276
|
0
|
|
|
|
|
0
|
return $num2sym[$value - 1]; |
277
|
|
|
|
|
|
|
} else { |
278
|
0
|
|
|
|
|
0
|
return $value; |
279
|
|
|
|
|
|
|
} |
280
|
|
|
|
|
|
|
} |
281
|
|
|
|
|
|
|
} |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
=item B<$object-Edebug([debuglevel])> |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
Set or retrieve the DEBUG attribute. Passing a debuglevel equal to 1 enables standard debug |
286
|
|
|
|
|
|
|
printing. Verbose debug printing can be enabled by passing integers greater than one. |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
=cut |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
sub debug : method { |
291
|
4
|
|
|
4
|
1
|
6317
|
my $ESSfile = shift; |
292
|
|
|
|
|
|
|
|
293
|
4
|
|
|
|
|
5
|
my $debug = shift; |
294
|
|
|
|
|
|
|
|
295
|
4
|
100
|
66
|
|
|
28
|
if (defined $debug && $debug =~ /\d+/ ) { |
296
|
2
|
|
|
|
|
4
|
$ESSfile->{DEBUG} = $debug; |
297
|
2
|
|
|
|
|
123
|
return; |
298
|
|
|
|
|
|
|
} else { |
299
|
2
|
|
|
|
|
12
|
return $ESSfile->{DEBUG}; |
300
|
|
|
|
|
|
|
} |
301
|
|
|
|
|
|
|
} |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
=item B<$object-Eget(attribute [index1] [index2] ... [indexN])> |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
Get attribute data stored in an N dimensional tensor. If the tensor indicies are |
306
|
|
|
|
|
|
|
not passed, then the last value for that attribute will be passesd. If a requested |
307
|
|
|
|
|
|
|
attribute is not present, then a null string is returned. If the requested datum is |
308
|
|
|
|
|
|
|
not present then undef will be returned as a string. |
309
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
=cut |
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
# retrieve values. for array data the last element is returned |
313
|
|
|
|
|
|
|
# unless otherwise requested |
314
|
|
|
|
|
|
|
sub get : method { |
315
|
0
|
|
|
0
|
1
|
|
my $ESSfile = shift; |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
# required parameters : value |
318
|
0
|
|
|
|
|
|
my $value = shift; |
319
|
0
|
0
|
|
|
|
|
print "Get method called for ", $value, "\n" if $ESSfile->{DEBUG} >= 4; |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
# optional parameters : index values |
322
|
0
|
|
|
|
|
|
my @index = @_; |
323
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
# warn if requested property is not coded & return empty string |
325
|
0
|
|
|
|
|
|
my $valid = 0; |
326
|
0
|
|
|
|
|
|
foreach my $p ( keys %$ESSfile ) { |
327
|
0
|
0
|
|
|
|
|
if ( $value eq $p ) { |
|
|
0
|
|
|
|
|
|
328
|
0
|
|
|
|
|
|
$valid = 1; |
329
|
0
|
|
|
|
|
|
last; |
330
|
|
|
|
|
|
|
} elsif ( $value eq "DEBUG" ) { |
331
|
0
|
|
|
|
|
|
$valid = 2; |
332
|
0
|
|
|
|
|
|
last; |
333
|
|
|
|
|
|
|
} |
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
} |
336
|
0
|
0
|
|
|
|
|
if ( $valid == 0 ) { |
|
|
0
|
|
|
|
|
|
337
|
0
|
0
|
|
|
|
|
warn "Requested property, $value, is not currently coded.\n$!\n" if $ESSfile->{DEBUG} == 1; |
338
|
0
|
|
|
|
|
|
return ""; |
339
|
|
|
|
|
|
|
} elsif ( $valid ==2 ) { |
340
|
0
|
|
|
|
|
|
warn "Please use the debug() method to access the DEBUG attribute.\n$!\n"; |
341
|
0
|
|
|
|
|
|
return ""; |
342
|
|
|
|
|
|
|
} |
343
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
# build hard reference |
345
|
0
|
|
|
|
|
|
my $reference = \$ESSfile->{$value}; |
346
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
# undef if no scalar value is present |
348
|
0
|
0
|
|
|
|
|
return "undef" unless ( defined $ESSfile->{$value} ); |
349
|
|
|
|
|
|
|
|
350
|
|
|
|
|
|
|
# check for multidimensional array in a nested |
351
|
|
|
|
|
|
|
# manner to avoid autovivification problems. |
352
|
0
|
|
|
|
|
|
my $i =0; |
353
|
0
|
|
|
|
|
|
while ( ref $$reference eq "ARRAY" ) { |
354
|
|
|
|
|
|
|
# get array length |
355
|
0
|
0
|
0
|
|
|
|
$index [$i] ||= scalar(@{$$reference}) - 1 unless ( defined $index[$i] ); |
|
0
|
|
|
|
|
|
|
356
|
0
|
0
|
|
|
|
|
return "undef" unless ( defined @{$$reference} [$index[$i]] ); |
|
0
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
# update reference |
359
|
0
|
|
|
|
|
|
$reference = \@{$$reference} [$index[$i]]; |
|
0
|
|
|
|
|
|
|
360
|
0
|
0
|
|
|
|
|
return $$reference unless ( ref $$reference eq "ARRAY" ); |
361
|
0
|
|
|
|
|
|
$i++; |
362
|
|
|
|
|
|
|
} |
363
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
# scalar values |
365
|
0
|
|
|
|
|
|
return $$reference; |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
} |
368
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
=item B<$object-EMOdecoder(MO)> |
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
Return the molecular orbital number for the requested MO. MO may be HOMO, LUMO or SHOMO. |
372
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
=cut |
374
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
# decode homo, shomo & lumo |
376
|
|
|
|
|
|
|
# correct for arrays starting with 0 |
377
|
|
|
|
|
|
|
sub MOdecoder : method { |
378
|
0
|
|
|
0
|
1
|
|
my $ESSfile = shift; |
379
|
0
|
|
|
|
|
|
my $MO = lc(shift); |
380
|
|
|
|
|
|
|
|
381
|
0
|
0
|
|
|
|
|
if ($MO eq "homo") { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
382
|
0
|
|
|
|
|
|
return $ESSfile->{HOMO} - 1; |
383
|
|
|
|
|
|
|
} elsif ($MO eq "lumo") { |
384
|
0
|
|
|
|
|
|
return $ESSfile->{HOMO}; |
385
|
|
|
|
|
|
|
} elsif ($MO eq "shomo") { |
386
|
0
|
|
|
|
|
|
return $ESSfile->{HOMO} - 2; |
387
|
|
|
|
|
|
|
} else { |
388
|
0
|
|
|
|
|
|
return $MO - 1; |
389
|
|
|
|
|
|
|
} |
390
|
|
|
|
|
|
|
} |
391
|
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
### Utilities ### |
393
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
sub printattributes : method { |
395
|
|
|
|
|
|
|
# print out object attributes |
396
|
0
|
|
|
0
|
0
|
|
my $ESSfile = shift; |
397
|
0
|
|
|
|
|
|
foreach my $p ( sort keys %$ESSfile ) { |
398
|
0
|
|
|
|
|
|
print "$p\n"; |
399
|
|
|
|
|
|
|
} |
400
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
} |
402
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
1; |
405
|
|
|
|
|
|
|
__END__ |