~ubuntu-branches/ubuntu/intrepid/psicode/intrepid

« back to all changes in this revision

Viewing changes to tests/mp2-opt-numer/mp2-opt-numer.test.pl

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck
  • Date: 2006-09-10 14:01:33 UTC
  • Revision ID: james.westby@ubuntu.com-20060910140133-ib2j86trekykfsfv
Tags: upstream-3.2.3
ImportĀ upstreamĀ versionĀ 3.2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl  
 
2
 
 
3
while ($ARGV = shift) {
 
4
  if   ("$ARGV" eq "-q") { $QUIET = 1; }
 
5
  elsif("$ARGV" eq "-i") { $SRC_PATH = shift; }
 
6
  elsif("$ARGV" eq "-x") { $EXEC_PATH = shift; }
 
7
}
 
8
 
 
9
if($SRC_PATH ne "") {
 
10
  require($SRC_PATH . "/../psitest.pl");
 
11
}
 
12
else {
 
13
  require("../psitest.pl");
 
14
}
 
15
 
 
16
# build the command for the psi3 driver
 
17
$PSICMD = build_psi_cmd($QUIET, $SRC_PATH, $EXEC_PATH);
 
18
 
 
19
$TOL = 10**-8;
 
20
$GTOL = 10**-8;
 
21
if($SRC_PATH ne "") {
 
22
  $REF_FILE = "$SRC_PATH/file11.ref";
 
23
}
 
24
else {
 
25
  $REF_FILE = "file11.ref";
 
26
}
 
27
$TEST_FILE = "psi.file11.dat";
 
28
$RESULT = "mp2-opt-numer.test";
 
29
 
 
30
system ($PSICMD);
 
31
 
 
32
$FAIL = 0;
 
33
 
 
34
$natom = seek_natom_file11($REF_FILE,"iteration");
 
35
 
 
36
open(RE, ">$RESULT") || die "cannot open $RESULT $!"; 
 
37
select (RE);
 
38
printf "MP2-OPT-NUMER:\n";
 
39
 
 
40
if(abs(seek_energy_file11($REF_FILE,"interation") - seek_energy_file11($TEST_FILE,"iteration")) > $TOL) {
 
41
  fail_test("MP2 energy");  $FAIL = 1;
 
42
}
 
43
else {
 
44
  pass_test("MP2 energy");
 
45
}
 
46
 
 
47
@geom_ref = seek_geom_file11($REF_FILE, "iteration");
 
48
@geom_test = seek_geom_file11($TEST_FILE, "iteration");
 
49
if(!compare_arrays(\@geom_ref, \@geom_test, $natom, 3, $GTOL)) {
 
50
  fail_test("MP2 Geometry");  $FAIL = 1;
 
51
}
 
52
else {
 
53
  pass_test("MP2 Geometry");
 
54
}
 
55
 
 
56
@grad_ref = seek_grad_file11($REF_FILE, "iteration");
 
57
@grad_test = seek_grad_file11($TEST_FILE, "iteration");
 
58
 
 
59
if(!compare_arrays(\@grad_ref, \@grad_test, $natom, 3, $GTOL)) {
 
60
  fail_test("MP2 Gradient");  $FAIL = 1;
 
61
}
 
62
else {
 
63
  pass_test("MP2 Gradient");
 
64
}
 
65
 
 
66
close (RE);
 
67
 
 
68
system("cat $RESULT");
 
69
 
 
70
exit($FAIL);