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