Skip to content

Print out long-range and short-range part during prediction with MACELES #1223

Closed

Description

@FadillaRizka

Dear developers,

I am interested to use MACE with long-range corrections (MACE-LES).
I would like to request a guidance on how to print out the short-range and long-range part of the total energy, as well as the atomic charge during the predictions.

As reference, here in the input file I use to train the MACE-LES potential and the script to do total energy and force predictions.

TRAINING_INPUT_FILE

model: "MACELES" 
num_interactions: 2 
num_channels: 128
max_L: 1
correlation: 3 
r_max: 6.0
max_ell: 3 
name: "mace01" 
model_dir: "MACE_models" 
log_dir: "MACE_models" 
checkpoints_dir: "MACE_models" 
results_dir: "MACE_models" 
train_file: "../database/h2o-all.xyz" 
valid_fraction: 0.20 
test_file: "../database/h2o-all.xyz" 
E0s: '{1:-1.122582090, 8:-2.39899122}'
energy_key: "energy" 
forces_key: "forces" 
device: cuda 
batch_size: 5 
max_num_epochs: 6000 
distributed: True
enable_cueq: True
swa: True
seed: 123
restart_latest: True

PREDICTION_SCRIPT

from ase.io import read, write
import numpy as np
from ase import Atoms
from ase.io.trajectory import Trajectory
from ase.calculators.singlepoint import SinglePointCalculator
from mace.calculators import MACECalculator

calc = MACECalculator(model_path='../MACE_models/mace01.model', device='cuda')

traj = read('dft.xyz', index=':')
for atoms in traj:
    atoms.calc = calc
    atoms.get_potential_energy()
    atoms.write('mace.xyz', append=True)

Thank you for your help.

Activity

  1. ilyes319 commented on Oct 20, 2025

    @ilyes319
    Contributor

    Hey, that is currently not possible from the ASE calculator atm. We will add that in a future update. If you need it now, you can try to hack it by directly evaluating the model and looking at the "les_energy"

    "les_energy": les_energy,

  2. locked and limited conversation to collaborators on Oct 20, 2025
  3. converted this issue into a discussion #1233 on Oct 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions