I have performed a ‘relax’ calculation of a periodic slab model in Quantum Espresso and have imported the final structure into an ase.Atoms object with an automatically attached Espresso calculator.
I am trying to use the finite displacement method to get ZPE and entropy corrections. However, when I try to generate the phonon DOS using the Phonons module, I get this error:
“ase.calculators.calculator.PropertyNotImplementedError: The property “forces” is not available.”
Is there something I need to do to get the forces? As far as I know, the Atoms.calc generated by read_espresso_out has forces, and I get a list when I print(Atoms.calc.get_forces()). Please let me know how I can fix this issue.
You may need to explicitly tell Espresso to calculate the forces; by default it does not! Copying an Espresso example from a recent ASE tutorial:
pseudo_dir = Path.home() / 'SSSP-1.2.1_PBE_efficiency'
calc = Espresso(profile=profile,
pseudo_dir=pseudo_dir,
kpts=(3, 3, 3),
input_data={'control': {'tprnfor': True,
'tstress': True},
'system': {'ecutwfc': 50.}},
pseudopotentials={'Si': 'Si.pbe-n-rrkjus_psl.1.0.0.UPF'})
I think you need the “tprnfor” argument.
Hi AJ,
Thanks for your reply. I believe .tprnfor. is set to TRUE for ‘relax’ calculations by default (though I didn’t enable it explicitly). And I am still able to print out Atoms.calc.get_forces() which returns a realistic-looking list, which tells me that ase is grabbing whatever forces are in the output file of the ‘relax’ calculation.
Is there any other potential cause or fix for this? Is using a ‘relax’ calculation for this bad practice?
What happens when you call atoms.get_forces()
instead of atoms.calc.get_forces()
? The phonon routine will use the former.
Did you use ASE or Espresso to drive the geometry optimisation? You should not have Espresso relaxation parameters set during a phonon calculation or you will end up with forces that bear no relation to the displacements. It’s probably safest to make a fresh Calculator for the phonon calculation.