Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Laurell, Pontus Bengt Johan
dmrgpp
Commits
862e1c1a
Commit
862e1c1a
authored
Feb 22, 2021
by
Alvarez, Gonzalo
Browse files
Script: ritz.pl
parent
ab51d3b1
Changes
1
Hide whitespace changes
Inline
Side-by-side
scripts/ritz.pl
0 → 100755
View file @
862e1c1a
#!/usr/bin/perl
use
strict
;
use
warnings
;
use
utf8
;
my
(
$file
,
$n
)
=
@ARGV
;
defined
(
$file
)
or
die
"
USAGE: $0 filename [set number]
\n
";
defined
(
$n
)
or
$n
=
-
1
;
my
@data
=
loadData
(
$file
,
$n
);
printData
(
\
@data
);
sub
printData
{
my
(
$a
)
=
@_
;
my
$n
=
scalar
(
@$a
);
for
(
my
$i
=
0
;
$i
<
$n
;
++
$i
)
{
print
"
$i
"
.
$a
->
[
$i
]
.
"
\n
";
}
}
sub
loadData
{
my
(
$file
,
$n
)
=
@_
;
open
(
FILE
,
"
<
",
"
$file
")
or
die
"
$0: Cannot open
$file
: $!
\n
";
my
@temp
;
my
$counter
=
0
;
while
(
<
FILE
>
)
{
next
unless
(
/RitzEigenvalues: index\=\d+\|/
);
s/RitzEigenvalues: index=\d+\|//
;
chomp
;
@temp
=
split
;
last
if
(
$counter
++
==
$n
);
}
close
(
FILE
);
my
$m
=
scalar
(
@temp
);
die
"
$0: No /RitzEigenvalues found in
$file
\n
"
if
(
$m
==
0
);
return
@temp
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment