~ubuntu-branches/ubuntu/quantal/psicode/quantal

« back to all changes in this revision

Viewing changes to lib/ruby/testcases.rb

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck, Michael Banck, Daniel Leidert
  • Date: 2009-02-23 00:12:02 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090223001202-rutldoy3dimfpesc
Tags: 3.4.0-1
* New upstream release.

[ Michael Banck ]
* debian/patches/01_DESTDIR.dpatch: Refreshed.
* debian/patches/02_FHS.dpatch: Removed, applied upstream.
* debian/patches/03_debian_docdir: Likewise.
* debian/patches/04_man.dpatch: Likewise.
* debian/patches/06_466828_fix_gcc_43_ftbfs.dpatch: Likewise.
* debian/patches/07_464867_move_executables: Fixed and refreshed.
* debian/patches/00list: Adjusted.
* debian/control: Improved description.
* debian/patches-held: Removed.
* debian/rules (install/psi3): Do not ship the ruby bindings for now.

[ Daniel Leidert ]
* debian/rules: Fix txtdir via DEB_MAKE_INSTALL_TARGET.
* debian/patches/01_DESTDIR.dpatch: Refreshed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Make sure color.rb is included
 
2
require 'color'
 
3
 
 
4
PSITEST_ETOL = 10e-8;           # Default test criterion for energies
 
5
PSITEST_ENUCTOL = 10e-10;       # Check nuclear repulsion energy tighter than other energies
 
6
 
 
7
def test_scf_energy(expected)
 
8
  retcode = 0
 
9
  
 
10
  # Make sure SCF is in the checkpoint
 
11
  if Psi::Chkpt::exist?("SCF energy")
 
12
    if (Psi::Chkpt::escf - expected).abs < PSITEST_ETOL
 
13
      puts "SCF final energy:          " + green("PASSED")
 
14
    else
 
15
      puts "SCF final energy:          " + red("FAILED")
 
16
      puts "Obtained: #{Psi::Chkpt::escf}"
 
17
      puts "Expected: #{expected}"
 
18
      retcode = 1
 
19
    end
 
20
  else
 
21
    puts red("Error: ") + "SCF energy not found in checkpoint."
 
22
    retcode = 1
 
23
  end
 
24
  
 
25
  return retcode
 
26
end
 
27
 
 
28
def test_ccsd_energy(expected)
 
29
  retcode = 0
 
30
 
 
31
  # Make sure CCSD is in the checkpoint
 
32
  if Psi::Chkpt::exist?("CCSD Energy")
 
33
    if (Psi::Chkpt::eccsd - expected).abs < PSITEST_ETOL
 
34
      puts "CCSD final energy:         " + green("PASSED")
 
35
    else
 
36
      puts "CCSD final energy:         " + red("FAILED")
 
37
      puts "Obtained: #{Psi::Chkpt::eccsd}"
 
38
      puts "Expected: #{expected}"
 
39
      retcode = 1
 
40
    end
 
41
  else
 
42
    puts red("Error: ") + "CCSD energy not found in checkpoint."
 
43
    retcode = 1
 
44
  end
 
45
 
 
46
  return retcode
 
47
end
 
48
 
 
49
def test_t_energy(expected)
 
50
  retcode = 0
 
51
 
 
52
  # Make sure (T) is in the checkpoint
 
53
  if Psi::Chkpt::exist?("(T) Energy")
 
54
    if (Psi::Chkpt::e_t - expected).abs < PSITEST_ETOL
 
55
      puts "(T) final energy:          " + green("PASSED")
 
56
    else
 
57
      puts "(T) final energy:          " + red("FAILED")
 
58
      puts "Obtained: #{Psi::Chkpt::e_t}"
 
59
      puts "Expected: #{expected}"
 
60
      retcode = 1
 
61
    end
 
62
  else
 
63
    puts red("Error: ") + "(T) energy not found in checkpoint."
 
64
    retcode = 1
 
65
  end
 
66
 
 
67
  return retcode
 
68
end
 
69
 
 
70
def test_nuclear_repulsion(expected)
 
71
  retcode = 0
 
72
  
 
73
  # Make sure it is found in the checkpoint
 
74
  if Psi::Chkpt::exist?("Nuclear rep. energy")
 
75
    if (Psi::Chkpt::enuc - expected).abs < PSITEST_ENUCTOL
 
76
      puts "Nuclear repulsion energy:  " + green("PASSED")
 
77
    else
 
78
      puts "Nuclear repulsion energy:  " + red("FAILED")
 
79
      puts "Obtained: #{Psi::Chkpt::enuc}"
 
80
      puts "Expected: #{expected}"
 
81
      retcode = 1
 
82
    end
 
83
  else
 
84
    puts red("Error:") + "Nuclear repulsion energy not found in checkpoint."
 
85
    retcode = 1
 
86
  end
 
87
  
 
88
  return retcode
 
89
end
 
90
 
 
91
def test_total_energy(expected)
 
92
  retcode = 0
 
93
  
 
94
  # Make sure it is found in the checkpoint
 
95
  if Psi::Chkpt::exist?("Total energy")
 
96
    if (Psi::Chkpt::etot - expected).abs < PSITEST_ETOL
 
97
      puts "Total energy:              " + green("PASSED")
 
98
    else
 
99
      puts "Total energy:              " + red("FAILED")
 
100
      puts "Obtained: #{Psi::Chkpt::etot}"
 
101
      puts "Expected: #{expected}"
 
102
      retcode = 1
 
103
    end
 
104
  else
 
105
    puts red("Error:") + "Total energy not found in checkpoint."
 
106
    retcode = 1
 
107
  end
 
108
  
 
109
  return retcode
 
110
end