@@ -26,37 +26,40 @@ class ValidationError(Exception):
2626 """Define custom exception during validation."""
2727
2828
29- class PotcarSummaryStats (BaseModel ):
30- """Schematize `PotcarSingle._summary_stats`."""
29+ class PotcarSummaryKeywords (BaseModel ):
30+ """Schematize `PotcarSingle._summary_stats["keywords"]` field."""
31+
32+ header : set [str ] = Field (description = "The keywords in the POTCAR header." )
33+ data : set [str ] = Field (description = "The keywords in the POTCAR body." )
34+
35+ @model_serializer
36+ def set_to_list (self ) -> dict [str , list [str ]]:
37+ """Ensure JSON compliance of set fields."""
38+ return {k : list (getattr (self , k )) for k in ("header" , "data" )}
39+
3140
32- class _PotcarSummaryStatsKeywords (BaseModel ):
33- """Schematize `PotcarSingle._summary_stats["keywords"]` field ."""
41+ class PotcarSummaryStatisticsFields (BaseModel ):
42+ """Define statistics used in `PotcarSingle._summary_stats` ."""
3443
35- header : set [str ] = Field (description = "The keywords in the POTCAR header." )
36- data : set [str ] = Field (description = "The keywords in the POTCAR body." )
44+ MEAN : float = Field (description = "Data mean." )
45+ ABSMEAN : float = Field (description = "Data magnitude mean." )
46+ VAR : float = Field (description = "Mean of squares of data." )
47+ MIN : float = Field (description = "Data minimum." )
48+ MAX : float = Field (description = "Data maximum." )
3749
38- @model_serializer
39- def set_to_list (self ) -> dict [str , list [str ]]:
40- """Ensure JSON compliance of set fields."""
41- return {k : list (getattr (self , k )) for k in ("header" , "data" )}
4250
43- class _PotcarSummaryStatsStats (BaseModel ):
44- """Schematize `PotcarSingle._summary_stats["stats"]` field."""
51+ class PotcarSummaryStatistics (BaseModel ):
52+ """Schematize `PotcarSingle._summary_stats["stats"]` field."""
4553
46- class _PotcarSummaryStatsNames ( BaseModel ):
47- """Define statistics used in `PotcarSingle._summary_stats`."""
54+ header : PotcarSummaryStatisticsFields = Field ( description = "The keywords in the POTCAR header." )
55+ data : PotcarSummaryStatisticsFields = Field ( description = "The keywords in the POTCAR body." )
4856
49- MEAN : float = Field (description = "Data mean." )
50- ABSMEAN : float = Field (description = "Data magnitude mean." )
51- VAR : float = Field (description = "Mean of squares of data." )
52- MIN : float = Field (description = "Data minimum." )
53- MAX : float = Field (description = "Data maximum." )
5457
55- header : _PotcarSummaryStatsNames = Field ( description = "The keywords in the POTCAR header." )
56- data : _PotcarSummaryStatsNames = Field ( description = "The keywords in the POTCAR body." )
58+ class PotcarSummaryStats ( BaseModel ):
59+ """Schematize `PotcarSingle._summary_stats`."""
5760
58- keywords : Optional [_PotcarSummaryStatsKeywords ] = None
59- stats : Optional [_PotcarSummaryStatsStats ] = None
61+ keywords : Optional [PotcarSummaryKeywords ] = None
62+ stats : Optional [PotcarSummaryStatistics ] = None
6063 titel : str
6164 lexch : str
6265
0 commit comments