@@ -328,21 +328,42 @@ def str_to_eigenvalues(val_in):
328328 ('TITEL' , re .search (r'TITEL\s*=\s*(.+)' , val_in )),
329329 ('VRHFIN' , re .search (r'VRHFIN\s*=(.+?)(?:\n|$)' , val_in )),
330330 ('LEXCH' , re .search (r'LEXCH\s*=\s*(\w+)' , val_in )),
331- ('ZVAL' , re .search (r'POMASS\s*=\s*[\d\.]+;\s*ZVAL\s*=\s*([\d\.]+)' , val_in )),
331+ (
332+ 'ZVAL' ,
333+ re .search (
334+ r'POMASS\s*=\s*[\d\.]+;\s*ZVAL\s*=\s*([\d\.]+)' ,
335+ val_in ,
336+ ),
337+ ),
332338 ('RCORE' , re .search (r'RCORE\s*=\s*([\d\.]+)' , val_in )),
333339 ('ENMAX' , re .search (r'ENMAX\s*=\s*([\d\.]+)' , val_in )),
334340 ('ENMIN' , re .search (r'ENMIN\s*=\s*([\d\.]+)' , val_in )),
335341 ('LPAW' , re .search (r'LPAW\s*=\s*([TF])' , val_in )),
336342 ('LULTRA' , re .search (r'LULTRA\s*=\s*([TF])' , val_in )),
337- ('LMAX' , re .search (r'number of l-projection\s+operators is LMAX\s*=\s*(\d+)' , val_in )),
338- ('LMMAX' , re .search (r'number of lm-projection\s+operators is LMMAX\s*=\s*(\d+)' , val_in )),
343+ (
344+ 'LMAX' ,
345+ re .search (
346+ r'number of l-projection\s+operators is '
347+ r'LMAX\s*=\s*(\d+)' ,
348+ val_in ,
349+ ),
350+ ),
351+ (
352+ 'LMMAX' ,
353+ re .search (
354+ r'number of lm-projection\s+operators is '
355+ r'LMMAX\s*=\s*(\d+)' ,
356+ val_in ,
357+ ),
358+ ),
339359 ('SHA256' , re .search (r'SHA256\s*=\s*(\w+)' , val_in )),
340360 ]
341361 if value is not None
342362 for key , value in [(key , value .group (1 ) if value else None )]
343363 if value is not None
344364 }
345- if 'VRHFIN' in val_in else {} # Only process detailed sections with VRHFIN
365+ if 'VRHFIN' in val_in
366+ else {} # Only process detailed sections with VRHFIN
346367 ),
347368 convert = False ,
348369 ),
@@ -494,18 +515,23 @@ def get_xc_functionals(self, parameters: dict[str, Any]) -> list[dict[str, Any]]
494515 xc_functionals .append ({'name' : functional })
495516 return xc_functionals
496517
497- def get_pseudopotentials (self , source : list [dict [str , Any ]]) -> list [dict [str , Any ]]:
518+ def get_pseudopotentials (
519+ self , source : list [dict [str , Any ]]
520+ ) -> list [dict [str , Any ]]:
498521 """
499- Idiomatic transformer: Extract and derive all pseudopotential metadata from OUTCAR.
522+ Idiomatic transformer: Extract and derive all pseudopotential metadata
523+ from OUTCAR.
500524
501- Performs ALL derivations here (type, XC functional, cutoffs) - no post-processing needed.
502- Returns plain dicts that the mapping framework converts to Pseudopotential instances.
525+ Performs ALL derivations here (type, XC functional, cutoffs) - no
526+ post-processing needed. Returns plain dicts that the mapping framework
527+ converts to Pseudopotential instances.
503528
504529 Args:
505530 source: List of raw POTCAR header dicts from OUTCAR parser
506531
507532 Returns:
508- list[dict]: List of complete pseudopotential dicts ready for schema population
533+ list[dict]: List of complete pseudopotential dicts ready for schema
534+ population
509535 """
510536 pseudopotentials = []
511537
@@ -517,7 +543,9 @@ def get_pseudopotentials(self, source: list[dict[str, Any]]) -> list[dict[str, A
517543 # Extract basic metadata
518544 pp_data = {
519545 'name' : raw_pp .get ('TITEL' ),
520- 'n_valence_electrons' : float (raw_pp ['ZVAL' ]) if 'ZVAL' in raw_pp else None ,
546+ 'n_valence_electrons' : float (raw_pp ['ZVAL' ])
547+ if 'ZVAL' in raw_pp
548+ else None ,
521549 'reference_configuration' : raw_pp .get ('VRHFIN' ),
522550 'r_core' : float (raw_pp ['RCORE' ]) if 'RCORE' in raw_pp else None ,
523551 'l_max' : int (raw_pp ['LMAX' ]) if 'LMAX' in raw_pp else None ,
@@ -527,10 +555,15 @@ def get_pseudopotentials(self, source: list[dict[str, Any]]) -> list[dict[str, A
527555
528556 # Derive type from LPAW/LULTRA flags and name patterns (idiomatic)
529557 pp_data ['type' ] = self ._derive_pp_type (raw_pp )
530- pp_data ['is_norm_conserving' ] = pp_data ['type' ] in ['NC' , 'NC-PAW' , 'NC-PAW-GW' ]
558+ pp_data ['is_norm_conserving' ] = pp_data ['type' ] in [
559+ 'NC' ,
560+ 'NC-PAW' ,
561+ 'NC-PAW-GW' ,
562+ ]
531563 pp_data ['is_gw_optimized' ] = '_GW' in (raw_pp .get ('TITEL' ) or '' )
532564
533- # Derive XC functional dict (will be instantiated as XCFunctional subsection)
565+ # Derive XC functional dict (will be instantiated as XCFunctional
566+ # subsection)
534567 xc_key = self ._derive_pp_xc_functional_key (raw_pp )
535568 if xc_key :
536569 pp_data ['xc_functional' ] = {'functional_key' : xc_key }
@@ -567,7 +600,8 @@ def _derive_pp_type(self, raw_pp: dict[str, Any]) -> str | None:
567600 def _derive_pp_xc_functional_key (self , raw_pp : dict [str , Any ]) -> str | None :
568601 """Derive XC functional_key from LEXCH parameter using VASP mapping.
569602
570- Returns standard functional aliases that will be expanded to LibXC components by normalization.
603+ Returns standard functional aliases that will be expanded to LibXC
604+ components by normalization.
571605 """
572606 lexch = raw_pp .get ('LEXCH' )
573607 if not lexch :
@@ -576,11 +610,11 @@ def _derive_pp_xc_functional_key(self, raw_pp: dict[str, Any]) -> str | None:
576610 # Map VASP LEXCH codes to standard functional aliases
577611 # These aliases are expanded to LibXC labels during XCFunctional.normalize()
578612 lexch_mapping = {
579- 'PE' : 'PBE' , # Perdew-Burke-Ernzerhof -> XC_GGA_X_PBE + XC_GGA_C_PBE
580- 'CA' : 'CA' , # Ceperley-Alder (Teter parametrization)
581- 'PW' : 'PW91' , # Perdew-Wang 91
582- 'HL' : 'HL' , # Hedin-Lundqvist
583- 'WI' : 'WI' , # Wigner interpolation
613+ 'PE' : 'PBE' , # Perdew-Burke-Ernzerhof -> XC_GGA_X_PBE + XC_GGA_C_PBE
614+ 'CA' : 'CA' , # Ceperley-Alder (Teter parametrization)
615+ 'PW' : 'PW91' , # Perdew-Wang 91
616+ 'HL' : 'HL' , # Hedin-Lundqvist
617+ 'WI' : 'WI' , # Wigner interpolation
584618 }
585619
586620 return lexch_mapping .get (lexch )
@@ -591,19 +625,23 @@ def _derive_pp_cutoffs(self, raw_pp: dict[str, Any]) -> list[dict[str, Any]]:
591625
592626 enmax = raw_pp .get ('ENMAX' )
593627 if enmax is not None :
594- cutoffs .append ({
595- 'cutoff_kind' : 'wavefunction' ,
596- 'cutoff_role' : 'recommended' ,
597- 'value' : float (enmax ),
598- })
628+ cutoffs .append (
629+ {
630+ 'cutoff_kind' : 'wavefunction' ,
631+ 'cutoff_role' : 'recommended' ,
632+ 'value' : float (enmax ),
633+ }
634+ )
599635
600636 enmin = raw_pp .get ('ENMIN' )
601637 if enmin is not None :
602- cutoffs .append ({
603- 'cutoff_kind' : 'wavefunction' ,
604- 'cutoff_role' : 'recommended_min' ,
605- 'value' : float (enmin ),
606- })
638+ cutoffs .append (
639+ {
640+ 'cutoff_kind' : 'wavefunction' ,
641+ 'cutoff_role' : 'recommended_min' ,
642+ 'value' : float (enmin ),
643+ }
644+ )
607645
608646 return cutoffs
609647
0 commit comments