### Author Topic: M3GNet energies  (Read 773 times)

0 Members and 1 Guest are viewing this topic.

#### AsifShah

• QuantumATK Guru
• Posts: 146
• Country:
• Reputation: 2
##### M3GNet energies
« on: March 16, 2024, 08:08 »
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)

#### Anders Blom

• QuantumATK Staff
• Supreme QuantumATK Wizard
• Posts: 5405
• Country:
• Reputation: 89
##### Re: M3GNet energies
« Reply #1 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