Author Topic: Get MTP calculator from previous training  (Read 96 times)

0 Members and 1 Guest are viewing this topic.

Offline gulian

  • New ATK user
  • *
  • Posts: 3
  • Country: it
  • Reputation: 0
    • View Profile
Get MTP calculator from previous training
« on: October 29, 2021, 13:45 »
Dear all, as a first step, by following the notes for the MomentTensorPotentialTraining class (see https://docs.quantumatk.com/manual/Types/MomentTensorPotentialTraining/MomentTensorPotentialTraining.html#momenttensorpotentialtraining-c), I obtained a trained MTP potential set, stored in the mtp_study.hdf5 file. Then, I would like to get the calculator that employes this potential set, as explained in the example:
Code
mtp_calculator = moment_tensor_potential_training.momentTensorPotentialCalculators()[0]
How can I achieve this by reading the "mtp_study.hdf5" file? Alternatively, what is the procedure to obtain a suitable calculator from the MTPPotential instantiated from the "mtp_study.mtp" file? Thank you very much for you help! Best regards

Offline Anders Blom

  • QuantumATK Staff
  • Supreme ATK Wizard
  • *****
  • Posts: 5012
  • Country: dk
  • Reputation: 85
    • View Profile
    • QuantumATK at Synopsys
Re: Get MTP calculator from previous training
« Reply #1 on: November 1, 2021, 20:33 »
I haven't had time to play with fitting MTPs myself yet, but following the manual you should be able to use the MTPPotential constructor:
https://docs.quantumatk.com/manual/Types/MTPPotential/MTPPotential.html
(see the bottom of the page you linked to, just before the Notes)

Offline sureshko

  • QuantumATK Staff
  • New ATK user
  • *****
  • Posts: 6
  • Country: dk
  • Reputation: 0
    • View Profile
Re: Get MTP calculator from previous training
« Reply #2 on: November 2, 2021, 17:00 »
Hi, You may try the below to get the MTP calculator from .hdf5 file.
Code
moment_tensor_potential_training=nlread('mtp_study.hdf5',MomentTensorPotentialTraining)[-1]
mtp_calculator = moment_tensor_potential_training.momentTensorPotentialCalculators()[0]
Easy way to use the calculator from .mtp file is to follow this manual page which is also what Anders suggested in previous comment https://docs.quantumatk.com/tutorials/combining_potentials/combining_potentials.html Basically doing this
Code
potentialSet = TremoloXPotentialSet('potential_name')
potentialSet.addParticleType(ParticleType.fromElement(Oxygen))
.
....add other elements...
.
potentialSet.addPotential(MTPPotential(file='mtp_study.mtp'))
calculator = TremoloXCalculator(parameters=potentialSet)
bulk_configuration.setCalculator(calculator)
I hope this answers your question. With regards, Suresh

Offline gulian

  • New ATK user
  • *
  • Posts: 3
  • Country: it
  • Reputation: 0
    • View Profile
Re: Get MTP calculator from previous training
« Reply #3 on: November 3, 2021, 11:01 »
Dear Anders, dear Suresh,

thank you very much for your answers.

Indeed, it was really easy to read the MTP set from both the .hdf5 and the .mtp files. I tried both approaches and they work fine.

Best regards,

Gianfranco