def test_set_L_alpha(two_body_gp, params): # params cell = np.eye(3) unique_species = [2, 1] noa = 2 # create test structure test_structure, forces = get_random_structure(cell, unique_species, noa) # set gp model kernel = en.two_plus_three_body kernel_grad = en.two_plus_three_body_grad hyps = np.array([ 2.23751151e-01, 8.19990316e-01, 1.28421842e-04, 1.07467158e+00, 5.50677932e-02 ]) cutoffs = np.array([5.4, 5.4]) hyp_labels = ['sig2', 'ls2', 'sig3', 'ls3', 'noise'] energy_force_kernel = en.two_plus_three_force_en energy_kernel = en.two_plus_three_en opt_algorithm = 'BFGS' # test update_db gaussian = \ GaussianProcess(kernel, kernel_grad, hyps, cutoffs, hyp_labels, energy_force_kernel, energy_kernel, opt_algorithm, par=True, no_cpus=2) gaussian.update_db(test_structure, forces) gaussian.set_L_alpha()
def methanol_gp(): the_gp = GaussianProcess( kernel_name="2+3_mc", hyps=np.array([ 3.75996759e-06, 1.53990678e-02, 2.50624782e-05, 5.07884426e-01, 1.70172923e-03, ]), cutoffs=np.array([5, 3]), hyp_labels=["l2", "s2", "l3", "s3", "n0"], maxiter=1, opt_algorithm="L-BFGS-B", ) with open(path.join(TEST_FILE_DIR, "methanol_envs.json"), "r") as f: dicts = [loads(s) for s in f.readlines()] for cur_dict in dicts: force = cur_dict["forces"] env = AtomicEnvironment.from_dict(cur_dict) the_gp.add_one_env(env, force) the_gp.set_L_alpha() return the_gp
def methanol_gp(): the_gp = GaussianProcess(kernel_name="2+3_mc", hyps=np.array([ 3.75996759e-06, 1.53990678e-02, 2.50624782e-05, 5.07884426e-01, 1.70172923e-03 ]), cutoffs=np.array([7, 7]), hyp_labels=['l2', 's2', 'l3', 's3', 'n0'], maxiter=1, opt_algorithm='L-BFGS-B') with open('./test_files/methanol_envs.json') as f: dicts = [loads(s) for s in f.readlines()] for cur_dict in dicts: force = cur_dict['forces'] env = AtomicEnvironment.from_dict(cur_dict) the_gp.add_one_env(env, force) the_gp.set_L_alpha() return the_gp