# TURBOMOLE NO2 doublet ROHF single point energy

from chemsh import *
from chemsh.utils import testutils

rohf_control = {
    "symmetry": """
    $symmetry d2h
        """,
    "closed_shells": """
    $closed shells
       ag 1-3 (2)
       b1u 1-2 (2)
       b2u 1 (2)
       b3u 1 (2)
""",
    "open_shells": """
    $open shells type=1
      b2g 1 (1)
      b3g 1 (1)
""",
    "roothaan": """
    $roothaan 2
""",

    "rohf": """
    $rohf
    1b2g-1b3g a = 0 b = 2
    1b2g-1b2g a = 1 b = 0
    1b3g-1b3g a = 1 b = 0
""",
}

o2 = Fragment(coords="o2.cjson")

# default: convergence='tightscf'
turbomole = TURBOMOLE(
    frag=o2,
    method="hf",
    basis="SVP",
    scftype="rohf",
    mult=1,
    rohf_control=rohf_control,
    convergence=10
)

sp = SP(theory=turbomole, gradients=False)
sp.run()

ecalc = sp.result.energy

# Taken from TURBOMOLE Manual
eref = -149.4297623516

testutils.validate(ecalc, eref)
