[WIP] Update VASP outputs.py for more robust piezo and elastic tensor extraction from OUTCAR #4412
+504
−1,147
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose:
This PR updates the VASP
outputs.py
to allow for the extraction from OUTCAR of piezoelectric properties from PEAD calculations (LCALCEPS). It also updates the code to allow for the correct extraction of the electronic (ion-clamped) piezoelectric stress tensor for both LEPSILON and LCALCEPS calculations. The full elastic tensor is now also extracted in the case of a finite difference (FD) calculation that allows for variable cell deformation.Modifications:
The
Outcar
class is modified to include a finite differenceself.fd
check if IBRION is 5 or 6. We also check for RPA (LRPA) in OUTCAR and whether a variable cell relaxation is being performed (ISIF is 3), and setself.lrpa
andself.varcell
accordingly.We add a check for LCALCEPS in OUTCAR and set
self.lcalceps
accordingly. Similar to the workflow for LEPSILON, we callself.read_epsilon()
ifself.lcalceps
is True, and callself.read_lepsilon_ionic()
ifself.fd
is True. Note that we can re-use theread_epsilon()
andread_lepsilon_ionic()
functions for the LCALCEPS workflow.We update
read_lepsilon()
to check ifself.lrpa
is False (it should be for piezo calculations, cf. VASP wiki) and modify the search string to correctly extract the electronic piezo tensor (verified to work at least for VASP v6.4.3).If we have a FD calculation (
self.fd = True
) and ISIF is 3 (self.varcell = True
), we can extract the full elastic tensor usingself.read_elastic_tensor()
. This function has been updated by modifying the search string to ensure the full 6x6 tensor is correctly read (verified for VASP v6.4.3).In
as_dict
we add checks forself.lcalceps
,self.lcalceps
ANDself.fd
, andself.fd
ANDself.varcell
. We append the corresponding electronic piezo, ionic piezo, and elastic tensors in a manner consistent with the existing code.NB I’m not sure if the changes are substantial enough to warrant new tests, but I can write them if needed.