QuantumATK Forum

QuantumATK => General Questions and Answers => Topic started by: AsifShah on March 16, 2024, 08:08

Title: M3GNet energies
Post by: AsifShah on March 16, 2024, 08:08
Dear Admin,
When using M3GNet to calculate the total energy of a system the output shows nothing. Is it due to some bug?

Thanks
Here is the code:
# %% MoSe2

# Set up lattice
lattice = Hexagonal(3.288*Angstrom, 40.0*Angstrom)

# Define elements
elements = [Molybdenum, Selenium, Selenium]

# Define coordinates
fractional_coordinates = [[ 0.333333333333,  0.666666666667,  0.5           ],
                          [ 0.666666666667,  0.333333333333,  0.4583975     ],
                          [ 0.666666666667,  0.333333333333,  0.5416025     ]]

# Set up configuration
mose2 = BulkConfiguration(
    bravais_lattice=lattice,
    elements=elements,
    fractional_coordinates=fractional_coordinates
    )
mose2_name = "mose2"


# %% Set LCAOCalculator

from tremolox.neighborlistcalculator.M3GNetCalculator import TremoloXM3GNetDirectPESCalculator
calculator = TremoloXM3GNetDirectPESCalculator(device='cpu')


# %% Set Calculator

mose2.setCalculator(calculator)

mose2.update()

nlsave('TE.hdf5', mose2)


# %% TotalEnergy

total_energy = TotalEnergy(
    configuration=mose2
)
nlsave('TE.hdf5', total_energy)

Title: Re: M3GNet energies
Post by: Anders Blom on March 19, 2024, 20:51
You are not telling it to print anything...
Add nlprint(total_energy) and you will see the energy printed