|
12 | 12 | from ase.constraints import ExpCellFilter
|
13 | 13 | from ase.optimize import FIRE, LBFGS
|
14 | 14 | from mace.calculators.mace import MACECalculator
|
| 15 | +from mace.tools import count_parameters |
15 | 16 | from pymatgen.core import Structure
|
16 | 17 | from pymatgen.core.trajectory import Trajectory
|
17 | 18 | from pymatgen.io.ase import AseAtomsAdaptor
|
|
25 | 26 | __author__ = "Janosh Riebesell"
|
26 | 27 | __date__ = "2023-03-01"
|
27 | 28 |
|
| 29 | + |
| 30 | +# %% |
28 | 31 | task_type = "IS2RE" # "RS2RE"
|
29 | 32 | module_dir = os.path.dirname(__file__)
|
30 | 33 | # set large job array size for smaller data splits and faster testing/debugging
|
|
40 | 43 | # MACE trained by Yuan Chiang on CHGNet training set
|
41 | 44 | "2023-08-14-mace-yuan-mptrj-04",
|
42 | 45 | "2023-09-03-mace-yuan-mptrj-slower-14-lr-13_run-3",
|
| 46 | + "2023-10-29-mace-pbenner-mptrj-no-conditional-loss", |
43 | 47 | ][-1]
|
44 | 48 |
|
45 | 49 | slurm_vars = slurm_submit(
|
46 | 50 | job_name=job_name,
|
47 | 51 | out_dir=out_dir,
|
48 | 52 | account="matgen",
|
49 |
| - time="11:55:0", |
| 53 | + time="4:55:0", |
50 | 54 | array=f"1-{slurm_array_task_count}",
|
51 |
| - slurm_flags="--qos regular --constraint gpu --gpus 1", |
| 55 | + # slurm_flags="--qos shared --constraint gpu --gpus 1", |
| 56 | + slurm_flags="--qos shared --constraint cpu --mem 16G", |
52 | 57 | )
|
53 | 58 |
|
54 | 59 |
|
|
72 | 77 | max_steps = 500
|
73 | 78 | force_max = 0.05 # Run until the forces are smaller than this in eV/A
|
74 | 79 | checkpoint = f"{ROOT}/models/mace/checkpoints/{model_name}.model"
|
| 80 | +mace_calc = MACECalculator(checkpoint, device=device) |
75 | 81 |
|
76 | 82 | df_in: pd.DataFrame = np.array_split(
|
77 | 83 | pd.read_json(data_path).set_index(id_col), slurm_array_task_count
|
78 | 84 | )[slurm_array_task_id - 1]
|
79 | 85 |
|
| 86 | + |
| 87 | +# %% |
80 | 88 | run_params = dict(
|
81 | 89 | data_path=data_path,
|
82 | 90 | versions={dep: version(dep) for dep in ("mace", "numpy", "torch")},
|
|
89 | 97 | force_max=force_max,
|
90 | 98 | ase_optimizer=ase_optimizer,
|
91 | 99 | device=device,
|
| 100 | + trainable_params=count_parameters(mace_calc.models[0]), |
92 | 101 | )
|
93 | 102 |
|
94 | 103 | run_name = f"{job_name}-{slurm_array_task_id}"
|
95 | 104 | wandb.init(project="matbench-discovery", name=run_name, config=run_params)
|
96 | 105 |
|
97 | 106 |
|
98 | 107 | # %%
|
99 |
| -mace_calc = MACECalculator(checkpoint, device=device, default_dtype="float32") |
100 | 108 | relax_results: dict[str, dict[str, Any]] = {}
|
101 | 109 | input_col = {"IS2RE": "initial_structure", "RS2RE": "relaxed_structure"}[task_type]
|
102 | 110 |
|
|
0 commit comments