You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Could we get a parser for the electric field gradient output in OUTCAR? The corresponding INCAR flag is LEFG = .TRUE.
I attach a parser that I wrote, which puts the relevant results in the dictionary result, along with an abriged OUTCAR file.
Please excuse that I didn't commit this change myself. I tried to, but I lack the experience with git and python programming to do so. I wanted to follow similar approaches from the aiida-vasp repository but I couldn't figure out how the parsing is actually done.
Thank you very much for your help and for creating and maintaining this highly useful package!
Parser
"""
Parse electric field gradients from OUTCAR
"""
with open('OUTCAR', 'r', encoding='utf-8') as outcar:
outcar = outcar.readlines()
# Obtain the start and end lines for each data block
for nr, line in enumerate(outcar):
if 'Electric field gradients (V/A^2)' in line:
efg_start = nr + 4
if 'Electric field gradients after diagonalization (V/A^2)' in line:
efg_end = nr - 3
efg_diag_start = nr + 5
if 'Eigenvectors' in line:
efg_diag_end = nr - 3
efg_eigenvectors_start = nr + 3
if 'NMR quadrupolar parameters' in line:
efg_eigenvectors_end = nr - 4
break
# Parse the EFG
efg = []
for line in outcar[efg_start:efg_end]:
efg.append([float(val) for val in line.split()[1:]])
# Parse the diagonalized EFG
efg_diag = []
for line in outcar[efg_diag_start:efg_diag_end]:
efg_diag.append([float(val) for val in line.split()[1:]])
# Parse the eigenvectors
efg_eigenvectors = []
eigenvectors_block = []
for line in outcar[efg_eigenvectors_start:efg_eigenvectors_end]:
if 'ion' in line:
if len(eigenvectors_block) != 0:
efg_eigenvectors.append(eigenvectors_block)
eigenvectors_block = []
elif len(line.split()) == 0:
pass
else:
eigenvectors_block.append([float(val) for val in line.split()[1:]])
efg_eigenvectors.append(eigenvectors_block)
# Put results to a dictionary
result = {'efg': efg,
'efg_diag': efg_diag,
'efg_eigenvectors': efg_eigenvectors}
The parsing is actually done by another package called parsevasp this is called by aiida-vasp and then the results are passed to the results nodes. That is why it can be sometimes difficult to see where and how the parsing happens.
For what I understand there are two arrays of size Natoms*4 (diagonalized and bare) plus 3x3 matrices per atom.
By just quickly looking at the parsing it looks okay, just probably one would try to have everything inside the first loop (just for efficiency) and then store this as an ArrayData.
The one would need to pass to the settings that one wants to actually parse this quantity so that it is appended to the outputs.
I've not worked with this quantity before, but I can try to see about adding it to the parsevasp.
Environment
AlmaLinux release 8.5 (Arctic Sphynx)
2.5.1
3.1.0
Desired Feature
Could we get a parser for the electric field gradient output in
OUTCAR
? The correspondingINCAR
flag isLEFG = .TRUE.
I attach a parser that I wrote, which puts the relevant results in the dictionary
result
, along with an abrigedOUTCAR
file.Please excuse that I didn't commit this change myself. I tried to, but I lack the experience with git and python programming to do so. I wanted to follow similar approaches from the
aiida-vasp
repository but I couldn't figure out how the parsing is actually done.Thank you very much for your help and for creating and maintaining this highly useful package!
Parser
OUTCAR
The text was updated successfully, but these errors were encountered: