11"""Implementation of `aiida_common_workflows.common.relax.workchain.CommonRelaxWorkChain` for VASP."""
2+ import numpy as np
23from aiida import orm
34from aiida .common .exceptions import NotExistentAttributeError
45from aiida .engine import calcfunction
1415def get_stress (misc ):
1516 """Return the final stress array."""
1617 stress_data = orm .ArrayData ()
17- stress_kbar = misc ['stress' ]
18+ stress_kbar = np . array ( misc ['stress' ])
1819 stress_ev_per_angstr3 = stress_kbar / 1602.1766208
1920 stress_data .set_array (name = 'stress' , array = stress_ev_per_angstr3 )
2021
@@ -25,7 +26,7 @@ def get_stress(misc):
2526def get_forces (misc ):
2627 """Return the final forces array.."""
2728 forces_data = orm .ArrayData ()
28- forces_data .set_array (name = 'forces' , array = misc ['forces' ])
29+ forces_data .set_array (name = 'forces' , array = np . array ( misc ['forces' ]) )
2930
3031 return forces_data
3132
@@ -42,7 +43,7 @@ def get_total_free_energy(misc):
4243@calcfunction
4344def get_total_cell_magnetic_moment (misc ):
4445 """Return the total cell magnetic moment."""
45- magnetization = misc .get_dict ()[ 'magnetization' ]
46+ magnetization = misc .get ( 'magnetization' )
4647
4748 if not magnetization :
4849 # If list is empty, we have no magnetization
@@ -63,7 +64,7 @@ class VaspCommonRelaxWorkChain(CommonRelaxWorkChain):
6364 def convert_outputs (self ):
6465 """Convert the outputs of the sub workchain to the common output specification."""
6566 try :
66- self .out ('relaxed_structure' , self .ctx .workchain .outputs .relax__structure )
67+ self .out ('relaxed_structure' , self .ctx .workchain .outputs .relax . structure )
6768 except NotExistentAttributeError :
6869 # We have no control of when we want to perform relaxations here,
6970 # this is up to the calling workchains, so do not set the relaxed structure if a
0 commit comments