-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbispectrum_hyperopt.py
33 lines (28 loc) · 1.49 KB
/
bispectrum_hyperopt.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import mala
from os.path import join as pj
data_path = "/home/fiedlerl/data/mala_data_repo/Be2"
acsd_parameters = mala.Parameters()
acsd_parameters.descriptors.descriptor_type = "Bispectrum"
acsd_parameters.descriptors.bispectrum_twojmax = 10
acsd_parameters.descriptors.bispectrum_cutoff = 4.67637
acsd_parameters.descriptors.descriptors_contain_xyz = True
acsd_parameters.targets.target_type = "LDOS"
acsd_parameters.targets.ldos_gridsize = 11
acsd_parameters.targets.ldos_gridspacing_ev = 2.5
acsd_parameters.targets.ldos_gridoffset_ev = -5
acsd_parameters.descriptors.acsd_points = 100
hyperoptimizer = mala.ACSDAnalyzer(acsd_parameters)
hyperoptimizer.add_hyperparameter("bispectrum_twojmax", [2, 4, 10])
hyperoptimizer.add_hyperparameter("bispectrum_cutoff", [0.5, 2.0, 4.67637])
# Add raw snapshots to the hyperoptimizer. For the targets, numpy files are
# okay as well.
hyperoptimizer.add_snapshot("espresso-out", pj(data_path, "Be_snapshot1.out"),
"numpy", pj(data_path, "Be_snapshot1.in.npy"),
target_units="1/(Ry*Bohr^3)")
hyperoptimizer.add_snapshot("espresso-out", pj(data_path, "Be_snapshot2.out"),
"numpy", pj(data_path, "Be_snapshot2.in.npy"),
target_units="1/(Ry*Bohr^3)")
# If you plan to plot the results (recommended for exploratory searches),
# the optimizer can return the necessary quantities to plot.
plotting = hyperoptimizer.perform_study()
hyperoptimizer.set_optimal_parameters()