Skip to content

Commit

Permalink
Merge pull request #409 from ACEsuit/finetune_mp_forces_in_atoms_arrays
Browse files Browse the repository at this point in the history
fix incorrect conversion of forces from calculator to atoms.arrays for finetuning pbe mp replay head
  • Loading branch information
ilyes319 authored May 6, 2024
2 parents fb35950 + a208f19 commit a9681fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions mace/cli/run_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,14 @@ def main() -> None:
"weight_pt": args.weight_pt_head,
"weight_ft": 1.0,
"filtering_type": "combination",
"output": f"{cache_dir}/mp_finetuning.xyz",
"output": f"mp_finetuning-{tag}.xyz",
"descriptors": descriptors_mp,
"device": args.device,
"default_dtype": args.default_dtype,
}
select_samples(dict_to_namespace(args_samples))
collections_mp, _, _ = get_dataset_from_xyz(
train_path=f"{cache_dir}/mp_finetuning.xyz",
train_path=f"mp_finetuning-{tag}.xyz",
valid_path=None,
valid_fraction=args.valid_fraction,
config_type_weights=config_type_weights,
Expand Down
4 changes: 2 additions & 2 deletions mace/data/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,10 @@ def load_from_xyz(

if forces_from_calc:
try:
atoms.info["_REF_forces"] = atoms.get_forces()
atoms.arrays["_REF_forces"] = atoms.get_forces()
except Exception as e: # pylint: disable=W0703
logging.warning(f"Failed to extract forces: {e}")
atoms.info["_REF_forces"] = None
atoms.arrays["_REF_forces"] = None

if stress_from_calc:
try:
Expand Down

0 comments on commit a9681fe

Please sign in to comment.