# Shuffling the indices of the data and then selecting the first 9625 data points
idx = list(range(len(ene_isopent)))
shuffle(idx)
idx = idx[:7621]

# Appending the true energies to a list
predictions = [ene_isopent[idx]]

# Creating the estimator
acsf_params = {"nRs2":10, "nRs3":10, "nTs":10, "rcut":3.18, "acut":3.18, "zeta":52.779232035094125, "eta":1.4954812022150898}

estimator = ARMP(iterations=5283, batch_size=37, l1_reg=8.931599068573057e-06, l2_reg=3.535679697949907e-05,
                 learning_rate=0.0008170485394812195, representation_name='acsf', representation_params=acsf_params,
                 tensorboard=True, store_frequency=25, hidden_layer_sizes=(15,88))

# Putting the data into the model
estimator.set_properties(ene_isopent)
estimator.generate_representation(xyz_isopent, zs_isopent, method="fortran")
estimator.load_nn("md-nn")

# Predicting the energies
predictions.append(estimator.predict(idx))

# Scoring the results
score = estimator.score(idx)
print(score)

# Saving the predictions to a npz file
np.savez("cross_pred_md_on_vr.npz", np.asarray(predictions))

Пример #2
0
    "zeta": 220.127,
    "eta": 30.8065
}
estimator = ARMP(iterations=200,
                 representation_name='acsf',
                 representation_params=acsf_params,
                 tensorboard=True,
                 store_frequency=10,
                 l1_reg=0.0001,
                 l2_reg=0.005,
                 learning_rate=0.0005)

estimator.set_properties(ene)
estimator.generate_representation(xyz, zs)

saved_dir = "saved_model"

estimator.load_nn(saved_dir)

idx = list(range(n_samples))

estimator.fit(idx)

pred_1 = estimator.predict(idx)
pred_2 = estimator.predict_from_xyz(xyz, zs)

# plt.scatter(pred_1, pred_2)
# plt.show()

# estimator.save_nn()
    "zeta": 100.06564927139748,
    "eta": 39.81824764370754
}
estimator = ARMP(iterations=2633,
                 batch_size=22,
                 l1_reg=1.46e-05,
                 l2_reg=0.0001,
                 learning_rate=0.0013,
                 representation_name='acsf',
                 representation_params=acsf_params,
                 tensorboard=True,
                 store_frequency=25,
                 hidden_layer_sizes=(185, ))

# Loading the model previously trained
estimator.load_nn("../trained_nn/vr-nn")
estimator.set_properties(ene_surface)

# Generating the representation
start = time.time()
estimator.generate_representation(xyz_surface, zs_surface, method="fortran")
end = time.time()
print("The time taken to generate the representations is %s s" %
      (str(end - start)))
print("The shape of the representations is %s" %
      (str(estimator.representation.shape)))

# Predicting the energies
idx = list(range(n_samples))
predictions = estimator.predict(idx)
Пример #4
0
    'radial_cutoff':
    5,
    'angular_cutoff':
    5,
    'zeta':
    17.8630,
    'eta':
    2.5148
}

# Generate estimator
estimator = ARMP(iterations=1,
                 l1_reg=0.0001,
                 l2_reg=0.005,
                 learning_rate=0.0005,
                 representation_name='acsf',
                 representation_params=acsf_params,
                 tensorboard=False,
                 store_frequency=10)
estimator.load_nn()

data_squal = h5py.File(
    "/Volumes/Transcend/data_sets/CN_squalane/dft/squalane_cn_dft.hdf5", "r")

xyz_squal = np.array(data_squal.get("xyz")[:10])
zs_squal = np.array(data_squal.get("zs")[:10], dtype=np.int32)
ene_squal = np.array(data_squal.get("ene")[:10]) * 2625.50

pred1 = estimator.predict_from_xyz(xyz_squal, zs_squal)

print(pred1)
    "rcut": 3.29,
    "acut": 3.29,
    "zeta": 100.06564927139748,
    "eta": 39.81824764370754
}
estimator = ARMP(iterations=2633,
                 batch_size=22,
                 l1_reg=1.46e-05,
                 l2_reg=0.0001,
                 learning_rate=0.0013,
                 representation_name='acsf',
                 representation_params=acsf_params,
                 tensorboard=True,
                 store_frequency=25,
                 hidden_layer_sizes=(185, ))

# Input the data into the model
estimator.set_properties(ene_isopent)
estimator.generate_representation(xyz_isopent, zs_isopent, method="fortran")
estimator.load_nn("vr-nn")

# Predicting the energies
predictions.append(estimator.predict(idx))

# Scoring the results
score = estimator.score(idx)
print(score)

# Saving the results to a .npz file
np.savez("cross_pred_vr_on_md.npz", np.asarray(predictions))
Пример #6
0
estimator.fit(idx)

pred2 = estimator.predict(idx)
estimator.session.close()
tf.reset_default_graph()

new_estimator = ARMP(iterations=10, l1_reg=0.0001, l2_reg=0.005, learning_rate=0.0005, representation='acsf',
                 representation_params={"radial_rs": np.arange(0, 10, 5), "angular_rs": np.arange(0, 10, 5),
                                        "theta_s": np.arange(0, 3.14, 3)},
                    tensorboard=True, store_frequency=10
                     )
new_estimator.set_properties(ene_true)
new_estimator.generate_representation(xyz, zs)

new_estimator.load_nn("temp")

pred3 = new_estimator.predict(idx)

new_estimator.fit(idx)

pred4 = new_estimator.predict(idx)

shutil.rmtree("temp")
# shutil.rmtree("tb")
# shutil.rmtree("tensorboard")

assert np.all(pred1 == pred3)
assert np.all(pred2 == pred4)