Skip to content

Commit

Permalink
Changed the forces and stress so as to use only q_e_tools constants
Browse files Browse the repository at this point in the history
  • Loading branch information
Minotakm committed May 7, 2024
1 parent e6ed99a commit a1ed5f4
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/aiida_quantumespresso/parsers/parse_xml/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,9 +569,6 @@ def parse_xml_post_6_2(xml):
def parse_step_to_trajectory(trajectory, data, skip_structure=False):
"""."""

haBohr_to_eVA = 51.42208619083232 # value taken from http://greif.geo.berkeley.edu/~driver/conversions.html
haBohr3_to_GPa = 29421.02648438959 # value taken from http://greif.geo.berkeley.edu/~driver/conversions.html

from ..pw import fix_sirius_xml_prints

if 'scf_conv' in data and 'n_scf_steps' in data['scf_conv']:
Expand Down Expand Up @@ -606,11 +603,11 @@ def parse_step_to_trajectory(trajectory, data, skip_structure=False):
if 'forces' in data and '$' in data['forces']:
forces = np.array(data['forces']['$'])
dimensions = data['forces']['@dims'] # Like [3, 2], should be reversed to reshape the forces array
forces = forces * haBohr_to_eVA
forces = forces * (CONSTANTS.ry_to_ev*2 )/CONSTANTS.bohr_to_ang
trajectory['forces'].append(forces.reshape(dimensions[::-1]))

if 'stress' in data and '$' in data['stress']:
stress = np.array(data['stress']['$'])
dimensions = data['stress']['@dims'] # Like [3, 3], should be reversed to reshape the stress array
stress = stress * haBohr3_to_GPa
stress = stress * CONSTANTS.au_GPA
trajectory['stress'].append(stress.reshape(dimensions[::-1]))

0 comments on commit a1ed5f4

Please sign in to comment.