Skip to content

Commit

Permalink
fix urls and extract E0s
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyes319 committed May 2, 2024
1 parent 3502a2d commit 5016abf
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions mace/cli/run_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
load_foundations_elements,
extract_config_mace_model,
)
from mace.tools.utils import AtomicNumberTable


def main() -> None:
Expand Down Expand Up @@ -187,8 +188,8 @@ def main() -> None:
args.heads = heads
logging.info(f"Using heads: {heads}")
try:
checkpoint_url = "https://tinyurl.com/mw2wetc5"
descriptors_url = "https://tinyurl.com/mpe7br4d"
checkpoint_url = "https://github.com/ACEsuit/mace-mp/releases/download/mace_mp_0b/mp_traj_combined.xyz"
descriptors_url = "https://github.com/ACEsuit/mace-mp/releases/download/mace_mp_0b/descriptors.npy"
cache_dir = os.path.expanduser("~/.cache/mace")
checkpoint_url_name = "".join(
c
Expand Down Expand Up @@ -309,9 +310,21 @@ def main() -> None:
else:
atomic_energies_dict = get_atomic_energies(args.E0s, None, z_table, heads)
if args.multiheads_finetuning:
with open(r"mace\calculators\foundations_models\mp_vasp_e0.json", "r") as file:
E0s_mp = json.load(file)
atomic_energies_dict["pbe_mp"] = {z: E0s_mp["pbe"][f"{z}"] for z in z_table.zs}
assert (
model_foundation is not None
), "Model foundation must be provided for multiheads finetuning"
logging.info(
"Using atomic energies from foundation model for multiheads finetuning"
)
z_table_foundation = AtomicNumberTable(
[int(z) for z in model_foundation.atomic_numbers]
)
atomic_energies_dict["pbe_mp"] = {
z: model_foundation.atomic_energies_fn.atomic_energies[
z_table_foundation.z_to_index(z)
].item()
for z in z_table.zs
}

if args.model == "AtomicDipolesMACE":
atomic_energies = None
Expand Down

0 comments on commit 5016abf

Please sign in to comment.