예제 #1
0
def test_keep_ccre():
    path = Path("../../tests_staging/test_turbo_butadien_td_opt/butadiene")
    calc = Turbomole(path)
    ccre_pattern = "__ccre*"

    pat, multi, key = calc.prepare_pattern(ccre_pattern)
    assert pat == "ccre*"
    assert multi
    assert key == "ccres"
예제 #2
0
def test_benzene_wfoverlap():
    control_path = THIS_DIR / "benzene_3states"
    td_vec_fn = str(control_path / "ciss_a")
    mos_fn = str(control_path / "mos")
    turbo = Turbomole(control_path)
    geom = geom_from_library("benzene_bp86sto3g_opt.xyz")
    geom.set_calculator(turbo)
    turbo.td_vec_fn = td_vec_fn
    turbo.mos = mos_fn
예제 #3
0
def test_wfo_compare_butadiene_cc2_sto3g():
    in_path = THIS_DIR / "butadiene_cc2_sto3g"
    geom = geom_from_xyz_file(in_path / "buta.xyz")
    turbo = Turbomole(in_path, track=True, wfo_basis="sto3g")
    geom.set_calculator(turbo)

    # opt_kwargs = {
    # "max_cycles": 1,
    # "dump": True,
    # }
    # opt = SteepestDescent(geom, **opt_kwargs)
    # opt.run()
    turbo.run_calculation(geom.atoms, geom.coords)
    wfow = turbo.wfow
    wfow.compare(wfow)
예제 #4
0
def turbo_comp():
    calc_kwargs = {
        "xc": "pbe",
        "method": "tddft",
        "basis": "def2-SVP",
        "pal": 4,
        "nstates": 2,
        "root": 1,
        "track": True,
    }
    pyscf_ = PySCF(**calc_kwargs)
    geom = geom_from_xyz_file("cytosin.xyz")
    geom.set_calculator(pyscf_)
    f = geom.forces.reshape(-1, 3)
    print("pyscf")
    print(f.reshape(-1, 3))

    ref_geom = geom.copy()
    turbo_kwargs = {
        "control_path": "/scratch/turbontos/control_pbe_clean",
        "track": True,
        "ovlp_type": "wf",
        "ovlp_with": "first",
        "pal": 4,
    }
    turbo = Turbomole(**turbo_kwargs)
    ref_geom.set_calculator(turbo)
    f_ref = ref_geom.forces
    print("Turbo")
    print(f_ref.reshape(-1, 3))
예제 #5
0
def test_forces():
    geom = geom_from_xyz_file(THIS_DIR / "h2o.xyz")
    control_path = THIS_DIR / "h2o_forces"
    turbo = Turbomole(control_path)
    geom.set_calculator(turbo)
    forces = geom.forces
    ref_forces = -np.loadtxt("h2o_gradient.ref")
    np.testing.assert_allclose(forces, ref_forces, atol=1e-8)
예제 #6
0
def test_wfo_ref():
    in_path = THIS_DIR / "butadiene_twist"
    geom = geom_from_xyz_file(in_path / "02_buta_twist.xyz")
    turbo = Turbomole(in_path, track=True, wfo_basis="def2-svp")
    geom.set_calculator(turbo)

    opt_kwargs = {
        "max_cycles": 2,
        "dump": True,
    }
    opt = SteepestDescent(geom, **opt_kwargs)
    opt.run()
예제 #7
0
def test_wfo_compare_sto3g():
    in_path = THIS_DIR / "butadiene_twist_sto3g"
    geom = geom_from_xyz_file(in_path / "02_buta_twist.xyz")
    turbo = Turbomole(in_path, track=True, wfo_basis="sto-3g")
    geom.set_calculator(turbo)

    opt_kwargs = {
        "max_cycles": 1,
        "dump": True,
    }
    opt = SteepestDescent(geom, **opt_kwargs)
    opt.run()
    wfow = turbo.wfow
    wfow.compare(wfow)
예제 #8
0
def test_wfo_compare_neon():
    in_path = THIS_DIR / "neon"
    geom = geom_from_xyz_file(in_path / "neon.xyz")
    turbo = Turbomole(in_path, track=True, wfo_basis="def2-svp")
    geom.set_calculator(turbo)

    opt_kwargs = {
        "max_cycles": 1,
        "dump": True,
    }
    opt = SteepestDescent(geom, **opt_kwargs)
    opt.run()
    wfow = turbo.wfow
    wfow.compare(wfow)
예제 #9
0
def get_calc(ovlp_type, ovlp_with):
    calc_kwargs = {
        "control_path": THIS_DIR / "control_pbe0_clean",
        "track": True,
        "ovlp_type": ovlp_type,
        "ovlp_with": ovlp_with,
        # "cdds": "render",
        # "orient": "reset;center {-3.5575373 2.2096293 1.4794437E-5}; " \
        # "rotate z -112.54; rotate y 41.57; rotate z 99.02;",
        "adapt_args": [0.5, 0.3, 0.6],
        "pal": 4,
    }
    calc = Turbomole(**calc_kwargs)
    return calc
예제 #10
0
def test_wfo_compare_neon_dimer():
    in_path = THIS_DIR / "neon_dimer"
    geom = geom_from_xyz_file(in_path / "neon_dimer.xyz")
    turbo = Turbomole(in_path, track=True, wfo_basis="def2-svp")
    geom.set_calculator(turbo)

    opt_kwargs = {
        "max_cycles": 5,
        "dump": True,
        "track": True,
        # "convergence": {
        # "max_force_thresh": 2.5e-8,
        # }
    }
    opt = SteepestDescent(geom, **opt_kwargs)
    #import pdb; pdb.set_trace()
    opt.run()
예제 #11
0
def test_diabatize():
    geoms = geoms_from_trj(THIS_DIR / "ma_proton_transfer/interpolated.trj")
    in_path = THIS_DIR / "ma_turbo"
    calc_kwargs = {
        "track": True,
        "wfo_basis": "sto-3g",
    }
    turbos = list()
    wfos = list()
    for i, geom in enumerate(geoms):
        pickle_fn = f"wfo_pickle_{i}"
        turbo = Turbomole(in_path, calc_number=i, **calc_kwargs)
        geom.set_calculator(turbo)
        forces = geom.forces
        print(f"cycle {i}")
        turbos.append(turbo)
        wfos.append(turbo.wfow)
        with open(pickle_fn, "wb") as handle:
            cloudpickle.dump(turbo.wfow, handle)
예제 #12
0
def test_diabatize():
    geoms = geoms_from_trj(THIS_DIR /
                           "ma_proton_transfer/interpolated.trj")[:4]
    #in_path = THIS_DIR / "ma_turbo"
    in_path = THIS_DIR / "ma_turbo_no_exopt"
    calc_kwargs = {
        "track": True,
        "wfo_basis": "sto-3g",
    }

    #geoms = geoms_from_trj(THIS_DIR / "biaryl_trj/biaryl_first_13.trj")[:4]
    #in_path = THIS_DIR / "biaryl"
    #calc_kwargs = {
    #    "track": True,
    #    "wfo_basis": "def2-svp",
    #}

    turbos = list()
    wfos = list()
    mos = None
    np.set_printoptions(precision=2, suppress=True)
    # for i, geom in enumerate(geoms):
    # pickle_fn = f"wfo_pickle_{i}"
    # turbo = Turbomole(in_path, calc_number=i, **calc_kwargs)
    # if i > 0:
    # turbo.mos = mos
    # none_ = turbo.get_tddft(geom.atoms, geom.coords)
    # mos = turbo.mos
    # print(f"cycle {i}")
    # turbos.append(turbo)
    # wfos.append(turbo.wfow)
    # with open(pickle_fn, "wb") as handle:
    # cloudpickle.dump(turbo.wfow, handle)
    # if i > 0:
    # wfo1 = wfos[i-1]
    # inds = wfo1.compare(turbo.wfow)
    # print(inds)

    mos = natsorted(THIS_DIR.glob("*.mos"))
    td_vecs = natsorted(THIS_DIR.glob("*.ciss_a"))
    for i, (geom, mos, td_vec) in enumerate(zip(geoms, mos, td_vecs)):
        print("cycle", i, geom, mos, td_vec)
        turbo = Turbomole(in_path, calc_number=i, **calc_kwargs)
        turbo.mos = mos
        turbo.td_vec_fn = td_vec
        turbo.check_for_root_flip(geom.atoms, geom.coords)
        wfos.append(turbo.wfow)
        if i > 0:
            wfo1 = wfos[i - 1]
            inds = wfo1.compare(turbo.wfow)
예제 #13
0
def test_h2o_wfoverlap():
    path1 = THIS_DIR / "h2o1_wfoverlap"
    path2 = THIS_DIR / "h2o2_wfoverlap"
    geom1 = geom_from_xyz_file(path1 / "h2o1.xyz")
    geom2 = geom_from_xyz_file(path2 / "h2o2.xyz")
    turbo = Turbomole(path1)
    get_mos_ciss = lambda path: (str(path / "mos"), str(path / "ciss_a"))
    mos1, ciss1 = get_mos_ciss(path1)
    mos2, ciss2 = get_mos_ciss(path2)

    turbo.td_vec_fn = ciss1
    turbo.mos = mos1

    turbo.td_vec_fn = ciss2
    turbo.mos = mos2
예제 #14
0
def test_butadiene_track_opt():
    in_path = THIS_DIR / "butadiene"
    geom = geom_from_xyz_file(in_path / "butadiene_hf_sto3g.xyz")
    turbo = Turbomole(in_path, track=True, wfo_basis="def2-svp")
    geom.set_calculator(turbo)

    #fn = "/scratch/programme/pysisyphus/tests/test_turbo_butadien_td_opt/wfo_backup.out"
    #with open(fn) as handle:
    #    stdout = handle.read()
    #wfo = turbo.wfow
    #a = wfo.parse_wfoverlap_out(stdout)
    #print(a)
    #print(a.reshape(-1, 6))

    opt_kwargs = {
        "max_cycles": 10,
        "dump": True,
    }
    opt = ConjugateGradient(geom, **opt_kwargs)
    opt = SteepestDescent(geom, **opt_kwargs)
    opt.run()