Skip to content

Commit

Permalink
Merge pull request #805 from ThomasWarford/preproc
Browse files Browse the repository at this point in the history
Preprocessing: Save statistics.json in a way which can be loaded by ast.literal_eval
  • Loading branch information
ilyes319 authored Jan 27, 2025
2 parents a686631 + e157d3a commit 5dccd81
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion mace/cli/preprocess_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def run(args: argparse.Namespace):
"avg_num_neighbors": avg_num_neighbors,
"mean": mean,
"std": std,
"atomic_numbers": str(z_table.zs),
"atomic_numbers": str([int(z) for z in z_table.zs]),
"r_max": args.r_max,
}

Expand Down
7 changes: 4 additions & 3 deletions mace/data/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,16 +269,17 @@ def load_from_xyz(
len(atoms) == 1 and atoms.info.get("config_type") == "IsolatedAtom"
)
if isolated_atom_config:
atomic_number = int(atoms.get_atomic_numbers()[0])
if energy_key in atoms.info.keys():
atomic_energies_dict[atoms.get_atomic_numbers()[0]] = atoms.info[
atomic_energies_dict[atomic_number] = float(atoms.info[
energy_key
]
])
else:
logging.warning(
f"Configuration '{idx}' is marked as 'IsolatedAtom' "
"but does not contain an energy. Zero energy will be used."
)
atomic_energies_dict[atoms.get_atomic_numbers()[0]] = np.zeros(1)
atomic_energies_dict[atomic_number] = 0.0
else:
atoms_without_iso_atoms.append(atoms)

Expand Down

0 comments on commit 5dccd81

Please sign in to comment.