# Get forces from quantum espresso calc

**URL:** <https://aiida.discourse.group/t/get-forces-from-quantum-espresso-calc/226>\
**Category:** General Usage\
**Tags:** question, plugin\
**Created:** [January 18, 2024, 11:09am UTC](https://aiida.discourse.group/t/get-forces-from-quantum-espresso-calc/226 "2024-01-18T11:09:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Federica\_Zanca](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/federica_zanca/32/38_2.png) [@Federica\_Zanca](https://aiida.discourse.group/u/Federica_Zanca)\
**Post date:** [January 18, 2024, 11:09am UTC](https://aiida.discourse.group/t/get-forces-from-quantum-espresso-calc/226/1 "2024-01-18T11:09:01Z")

</div>

Not sure if this is the place to ask about plugins too so sorry if it’s not.  
I need to do what is being done here for other structures. In this example the dict\_of\_forces that is computed in quantum espresso is just written there assuming it’s been computed already.  
I was wondering is there a command in aiida-qe or aiida-phonopy to get this result from the qe output file or do I need to write it?

> <https://github.com/aiida-phonopy/aiida-phonopy/blob/main/examples/Si/preprocess.ipynb>

---

<div class="post-metadata">

**Author:** ![killercatempire](https://avatars.discourse-cdn.com/v4/letter/k/94ad74/32.png) [@killercatempire](https://aiida.discourse.group/u/killercatempire)\
**Post date:** [January 18, 2024, 11:12am UTC](https://aiida.discourse.group/t/get-forces-from-quantum-espresso-calc/226/2 "2024-01-18T11:12:40Z")

</div>

If I remember correctly, Aiida-Quantumespresso already parses the forces and includes them. It may be worthwhile to look at Bastonero’s aiida-vibroscopy plugin for ideas

---

<div class="post-metadata">

**Author:** ![sphuber](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/sphuber/32/6_2.png) [@sphuber](https://aiida.discourse.group/u/sphuber)\
**Post date:** [January 18, 2024, 1:16pm UTC](https://aiida.discourse.group/t/get-forces-from-quantum-espresso-calc/226/3 "2024-01-18T13:16:21Z")

</div>

The forces are already parsed and stored in the `output_trajectory` output. This is a `TrajectoryData` that records various properties for each “frame” of the simulation. If it was an scf or nscf, there would be just a single frame. But for relaxations, there would be multiple.  
You can get the forces array as follows:

```auto
load_node(PK).outputs.output_trajectory.get_array('forces')

```

where you replace `PK` with the pk of the completed `PwCalculation`.

---

<div class="post-metadata">

**Author:** ![bastonero](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/bastonero/32/32_2.png) [@bastonero](https://aiida.discourse.group/u/bastonero)\
**Post date:** [January 30, 2024, 11:36pm UTC](https://aiida.discourse.group/t/get-forces-from-quantum-espresso-calc/226/4 "2024-01-30T23:36:09Z")

</div>

Just randomly passed through here. If you’d like to, we have from some months published the `aiida-vibroscopy` package, which uses both `aiida-phonopy` and `aiida-quantumespresso` to perform phonons via finite difference in supercells. It also supports Hubbard (U+V) and the calculation of IR/Raman spectra with any funcitonal, thanks to the use of finite electric fields.  
Here the extended documentation: [AiiDA Vibroscopy — aiida-vibroscopy 1.0.2 documentation](https://aiida-vibroscopy.readthedocs.io/en/latest/).  
HTH
