def MP2_optimize():
    '''Optimize geometry at MP2(full)/6-31G(d)
    '''

    global Emp2full
    global Emp2frozen

    say('MP2 optimize.')

    if Multiplicity > 1:
        send_nwchem_cmd("tce ; scf ; mp2 ; end")
        if is_atom():
            en = nwchem.task_energy("tce")
        else:
            en, grad = nwchem.task_optimize("tce")
    else:
        if is_atom():
            en = nwchem.task_energy("mp2")
        else:
            en, grad = nwchem.task_optimize("mp2")

    debug('optimize: MP(2,full)/6-31G*= %.6f\n' % en)

    Emp2full = en

    return False
    def optimize(self):
        """# 1 optimize  B3LYP/6-31G(2df,p)

        """

        self.say('optimize.')

        self.send_nwchem_cmd("basis noprint ; * library 6-31G(2df,p) ; end")
        #self.send_nwchem_cmd("basis spherical noprint ; * library 6-31G(2df,p) ; end")
        scfcmd = self.build_SCF_cmd()
        self.send_nwchem_cmd(scfcmd)

        # canonical B3LYP spec
        # GAMESS-US b3lyp uses VWN_5
        # Gaussian uses VWN_3
        # NWChem uses something entirely different

        b3lyp_GAMESS = 'xc HFexch 0.2 slater 0.8 becke88 nonlocal 0.72 vwn_5 0.19 lyp 0.81'
        b3lyp_Gaussian = 'xc HFexch 0.2 slater 0.8 becke88 nonlocal 0.72 vwn_3 0.19 lyp 0.81'
        b3lyp_NWChem = 'xc b3lyp'

        blips = b3lyp_Gaussian
        memory_cache_words = self.integral_memory_cache / 8
        disk_cache_words = self.integral_disk_cache / 8
        mem = "semidirect memsize {0} filesize {1}".format(memory_cache_words,
                                                           disk_cache_words)

        if self.multiplicity != "singlet":
            self.send_nwchem_cmd('dft ; odft ; mult %d ; %s ; %s ; end' % (self.multiplicity_numeric, blips, mem))
        else:
            self.send_nwchem_cmd('dft ; %s ; %s ; end' % (blips, mem))

        # fetch and copy atom names list (tags) which enumerates atoms.
        # only available _after_ SCF statement

        self.initialize_atoms_list()
        self.send_nwchem_cmd("driver; maxiter 999; xyz {0}; end".format(self.geohash))
        self.send_nwchem_cmd("scf; maxiter 999; end")

        # optimize the geometry, ignore energy and gradient results
        if self.is_atom():
            en = nwchem.task_energy("dft")

        else:
            self.debug("task_optimize(dft)")
            en, grad = nwchem.task_optimize("dft")

        self.Eb3lyp = en
def optimize():
    # 1 optimize  B3LYP/6-31G(2df,p)

    global Eb3lyp
    global Multiplicity

    say("optimize.")
    limits_high()

    send_nwchem_cmd("basis noprint ; * library 6-31G(2df,p) ; end")

    # canonical B3LYP spec
    # GAMESS-US b3lyp uses VWN_5
    # Gaussian uses VWN_3
    # NWChem uses something entirely different

    b3lyp_GAMESS = "xc HFexch 0.2 slater 0.8 becke88 nonlocal 0.72 vwn_5 0.19 lyp 0.81"
    b3lyp_Gaussian = "xc HFexch 0.2 slater 0.8 becke88 nonlocal 0.72 vwn_3 0.19 lyp 0.81"
    b3lyp_NWChem = "xc b3lyp"

    # blips = b3lyp_GAMESS
    # blips = b3lyp_NWChem
    blips = b3lyp_Gaussian

    if Multiplicity > 1:
        send_nwchem_cmd("dft ; odft ; mult %d ; %s ; end" % (Multiplicity, blips))
    else:
        send_nwchem_cmd("dft ; %s ; end" % blips)

    # fetch and copy atom names list (tags) which enumerates atoms.
    # only available _after_ SCF statement

    set_atoms_list()

    if is_atom():
        en = nwchem.task_energy("dft")
    else:
        en, grad = nwchem.task_optimize("dft")

    Eb3lyp = en

    debug("B3LYP/6-31G(2df,p) energy = %f Ha" % (en))
    return False
def HF_optimize():
    '''
       HF/6-31G(d) optimization
    '''
    say('optimize.')

    limits_high()
    send_nwchem_cmd("basis noprint ; * library 6-31G* ; end")
    scfcmd = build_SCF_cmd()
    send_nwchem_cmd(scfcmd)

    # fetch and copy atom names list (tags) which enumerates atoms.
    # only available _after_ SCF statement

    set_atoms_list()

    # optimize the geometry, ignore energy and gradient results
    if is_atom():
        en = nwchem.task_energy("scf")
    else:
        en, grad = nwchem.task_optimize("scf")

    debug("HF/6-31G(d) SCF:energy = %.7f Ha" % (en))
    return False