def test__gradient(): """ test the gradient pipeline """ basis = 'sto-3g' geo = (('O', (0.0, 0.0, -0.110)), ('H', (0.0, -1.635, 0.876)), ('H', (-0.0, 1.635, 0.876))) mult_vals = [1, 2] charge_vals = [0, 1] for prog in elstruct.writer.gradient_programs(): methods = list(elstruct.program_nondft_methods(prog)) dft_methods = list(elstruct.program_dft_methods(prog)) if dft_methods: methods.append(numpy.random.choice(dft_methods)) for method in methods: for mult, charge in zip(mult_vals, charge_vals): for orb_type in (elstruct.program_method_orbital_types( prog, method, singlet=(mult == 1))): vals = _test_pipeline( script_str=SCRIPT_DCT[prog], writer=elstruct.writer.gradient, readers=( elstruct.reader.energy, elstruct.reader.gradient, ), args=(prog, geo, charge, mult, method, basis), kwargs={'orb_type': orb_type}, ) # Print the value for Psi4 since it was run and read if prog == elstruct.par.Program.PSI4: print('grad\n', vals)
def test__hessian(): """ test the hessian pipeline """ basis = 'sto-3g' geom = (('O', (0.0, 0.0, -0.110)), ('H', (0.0, -1.635, 0.876)), ('H', (-0.0, 1.635, 0.876))) mult_vals = [1, 2] charge_vals = [0, 1] for prog in elstruct.writer.hessian_programs(): methods = list(elstruct.program_nondft_methods(prog)) dft_methods = list(elstruct.program_dft_methods(prog)) if dft_methods: methods.append(numpy.random.choice(dft_methods)) for method in methods: for mult, charge in zip(mult_vals, charge_vals): for orb_type in (elstruct.program_method_orbital_types( prog, method, singlet=(mult == 1))): vals = _test_pipeline( script_str=SCRIPT_DCT[prog], writer=elstruct.writer.hessian, readers=( elstruct.reader.energy_(prog, method), elstruct.reader.hessian_(prog), ), args=(geom, charge, mult, method, basis, prog), kwargs={'orb_type': orb_type}, ) print(vals)
def test__energy(): """ test the energy pipeline """ basis = '6-31g' geo = (('O', (0.0, 0.0, -0.110)), ('H', (0.0, -1.635, 0.876)), ('H', (-0.0, 1.635, 0.876))) mult_vals = [1, 2] charge_vals = [0, 1] for prog in elstruct.writer.programs(): print(prog) for method in elstruct.program_methods(prog): print(method) for mult, charge in zip(mult_vals, charge_vals): for orb_type in (elstruct.program_method_orbital_types( prog, method, singlet=(mult == 1))): vals = _test_pipeline( script_str=SCRIPT_DCT[prog], writer=elstruct.writer.energy, readers=(elstruct.reader.energy, ), args=(prog, geo, charge, mult, method, basis), kwargs={'orb_type': orb_type}, error=elstruct.Error.SCF_NOCONV, error_kwargs={ 'scf_options': [ elstruct.option.specify( elstruct.Option.Scf.MAXITER_, 2) ] }, ) # Print the value for Psi4 since it was run and read if prog == elstruct.par.Program.PSI4: print('ene\n', vals)
def test__energy(): """ test the energy pipeline """ basis = '6-31g' geom = (('O', (0.0, 0.0, -0.110)), ('H', (0.0, -1.635, 0.876)), ('H', (-0.0, 1.635, 0.876))) mult_vals = [1, 2] charge_vals = [0, 1] for prog in elstruct.writer.programs(): for method in elstruct.program_methods(prog): for mult, charge in zip(mult_vals, charge_vals): for orb_type in (elstruct.program_method_orbital_types( prog, method, singlet=(mult == 1))): vals = _test_pipeline( script_str=SCRIPT_DCT[prog], writer=elstruct.writer.energy, readers=(elstruct.reader.energy_(prog, method), ), args=(geom, charge, mult, method, basis, prog), kwargs={'orb_type': orb_type}, error=elstruct.Error.SCF_NOCONV, error_kwargs={ 'scf_options': [ elstruct.option.specify( elstruct.Option.Scf.MAXITER_, 2) ] }, ) print(vals)