#!/usr/bin/env python

import os
import sys

sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from runtest_dirac import Filter, TestRun

test = TestRun(__file__, sys.argv)

f = Filter()
f.add(from_string = 'Electronic energy',
      num_lines   = 8,
      rel_tolerance   = 1.0e-9)
f.add(from_string = 'Eigenvalues',
      to_re       = 'HOMO - LUMO',
      rel_tolerance   = 1.0e-5)

test.run(['sf.scf.inp'],     ['H2O.mol'], f, args='--outcmo                 ')

f = Filter()
f.add(from_string = 'Electronic energy',
      num_lines   = 8,
      rel_tolerance   = 1.0e-9)

test.run(['so-ccsd.inp'],    ['H2O.mol'], f, args='--mw=64 --aw=130  --incmo')

f.add(from_string = ' Overview of calculated energies',
      to_string   = '@ Total CCSD-T  energy',
      rel_tolerance   = 1.0e-7)

f.add(from_string = '* Dipole moment',
      to_string   = '1 a.u =   2.54177000 Debye',
      rel_tolerance   = 1.0e-5)

test.run(['ccsd.inp'],       ['H2O.mol'], f, args='--ag=0.50 --gb=0.48      ') #miro: found mimimal memory demand

sys.exit(test.return_code)
