def from_orca(path="."): calc = ORCA("") path = Path(path) results = calc.parse_hessian(path) hess = results["hessian"] np.save("hess", hess) # hess = np.load("hess.npy") return hess
def run_cos_opt(cos, Opt, images, **kwargs): opt = Opt(cos, **kwargs) for img in cos.images: img.set_calculator(ORCA()) opt.run() return opt
def prepare_opt(): ethan_xyz = "xyz_files/ethan.xyz" atoms, coords = parse_xyz_file(ethan_xyz) geom = Geometry(atoms, coords.flatten()) geom.set_calculator(ORCA()) return geom, copy.copy(KWARGS)
def prepare_geometry(xyz_fn, keywords): #blocks = "%pal nprocs 3 end" blocks = "" atoms, coords = parse_xyz_file(THIS_DIR / xyz_fn) coords *= ANG2BOHR geometry = Geometry(atoms, coords.flatten()) geometry.set_calculator(ORCA(keywords, charge=0, mult=1, blocks=blocks)) hessian = geometry.hessian return geometry
def prepare_geometry(): keywords = "HF 4-22GSP TightSCF" xyz_fn = "01_irc_sn2_fluour_transfer_optts.xyz" #blocks = "%pal nprocs 3 end" blocks = "" atoms, coords = parse_xyz_file(THIS_DIR / xyz_fn) coords *= ANG2BOHR geometry = Geometry(atoms, coords.flatten()) geometry.set_calculator(ORCA(keywords, charge=-1, mult=1, blocks=blocks)) hessian = geometry.hessian return geometry, THIS_DIR
def get_geom(): init_logging("./") geom = geom_from_library("h2.xyz") kwargs = { "keywords": "BP86 def2-SV(P)", "charge": 0, "mult": 1, "blocks": "%tddft nroots 2 iroot 1 end", "track": True, } orca = ORCA(**kwargs) geom.set_calculator(orca) return geom
def test_do_final_hessian(data_dir): fn = data_dir / "final_geometry.xyz" geom = geom_from_xyz_file(fn, coord_type="redund") calc = ORCA("") grad = np.load(data_dir / "grad.npy") hess = np.load(data_dir / "hess.npy") geom.hessian = hess geom.gradient = grad res = do_final_hessian(geom, save_hessian=False) neg_eigvals = res.neg_eigvals assert len(neg_eigvals) == 1 np.testing.assert_allclose(neg_eigvals[0], -0.00224392407)
def prepare_geometry(keywords=None, xyz_fn=None): this_dir = pathlib.Path(os.path.dirname(os.path.realpath(__file__))) if not keywords: keywords = "HF STO-3G TightSCF" if not xyz_fn: xyz_fn = "hfabstraction_sto3g_ts.xyz" #blocks = "%pal nprocs 3 end" blocks = "" atoms, coords = parse_xyz_file(this_dir / xyz_fn) coords *= ANG2BOHR geometry = Geometry(atoms, coords.flatten()) geometry.set_calculator(ORCA(keywords, charge=0, mult=1, blocks=blocks)) hessian = geometry.hessian return geometry, this_dir
def run_distributed(scheduler=None): init_logging(THIS_DIR, scheduler) atoms = ("H", "H") geoms = list() for i in range(7): bond_length = 0.8 + i * 0.2 print(f"{i}: {bond_length:.02f}") coords = np.array((0., 0., 0., 0., 0., bond_length)) geom = Geometry(atoms, coords) # def2-TZVP / TDDFT td_kwargs = { "keywords": "BP86 def2-TZVP", "charge": 0, "mult": 1, "calc_number": i, "blocks": "%tddft nroots 2 iroot 1 end", #"track": True, "out_dir": THIS_DIR, } # def2-SV(P) / Ground state kwargs = { "keywords": "BP86 def2-SV(P)", "charge": 0, "mult": 1, "calc_number": i, "out_dir": THIS_DIR, } orca = ORCA(**td_kwargs) geom.set_calculator(orca) geoms.append(geom) neb_kwargs = { "dask_cluster": scheduler, } neb = NEB(geoms, **neb_kwargs) forces = neb.forces for f in forces.reshape(-1, 6): print(f, f"{np.linalg.norm(f):.2f}") for geom in neb.images: print(geom.calculator.wfow)
def self_compare_base(geom, wfo_basis): calc_kwargs = { "keywords": "B3LYP def2-TZVP", "blocks": "%tddft nroots 2 maxdim 5 end", "track": True, "pal": 4, } orca = ORCA(**calc_kwargs) orca.run_calculation(geom.atoms, geom.coords) # cis = "calculator_0.000.orca.cis" # gbw = "calculator_0.000.orca.gbw" # out = "calculator_0.000.orca.out" # orca.cis = cis # orca.gbw = gbw # orca.out = out orca.store_wfo_data(geom.atoms, geom.coords) wfow = orca.wfow res = wfow.compare(wfow) print(res)