示例#1
0
def run():
    args = parse_args(sys.argv[1:])
    geoms = geoms_from_trj(
        args.trj,
        first=args.first,
        coord_type="redund",
    )
    filters = parse_filter(args.filter)
    print("Filters", filters)

    valid_geoms = list()
    invalid_geoms = list()
    for i, geom in enumerate(geoms):
        internals = get_unique_internals(geom)
        valid = all([
            is_present == (internal in internals)
            for is_present, internal in filters
        ])
        if not valid:
            print(f"geom {i+1} is not valid.")
            invalid_geoms.append(geom)
        else:
            valid_geoms.append(geom)
    print()
    print(f"Found {len(valid_geoms)} valid geometries.")
    print(f"Found {len(invalid_geoms)} invalid geometries.")

    write_geoms_to_trj(valid_geoms, "filtered_valid.trj")
    write_geoms_to_trj(invalid_geoms, "filtered_invalid.trj")
示例#2
0
def test_standard_orientation():
    geoms = geoms_from_trj(THIS_DIR / "std_orient.trj")
    geoms_aligned = list()
    for geom in geoms:
        geom.standard_orientation()
        geoms_aligned.append(geom.principal_axes_are_aligned)
    # with open("stdorient.trj", "w") as handle:
        # handle.write(make_trj_str_from_geoms(geoms))
    assert all(geoms_aligned)
示例#3
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)
示例#4
0
    def parse_opt(self, path, keep_log=False):
        xtbopt = path / "xtbopt.xyz"
        if not xtbopt.exists():
            self.log(f"{self.calc_number:03d} failed")
            return None
        opt_geom = geom_from_xyz_file(xtbopt)
        opt_geom.energy = self.parse_energy(path)

        opt_log = None
        if keep_log:
            opt_log = geoms_from_trj(path / "xtbopt.log")

        opt_result = OptResult(opt_geom=opt_geom, opt_log=opt_log)
        return opt_result
示例#5
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)
示例#6
0
 def parse_md(self, path):
     assert (path / "xtbmdok").exists(), "File xtbmdok does not exist!"
     geoms = geoms_from_trj(path / "xtb.trj")
     return geoms