@@ -38,52 +38,8 @@ export class PlanewaveCutoffsContextProvider extends ContextProvider {
38
38
return cutoffConfig [ this . application . name ] ;
39
39
}
40
40
41
- /**
42
- * @summary Find cutoff values corresponding to wavefunction or charge
43
- * density with accuracy level in the pseudo method data
44
- * @param data {Object}: the data object from pseudo method data
45
- * @param cutoffEntity {String}: "wavefunction", or "density"
46
- * @param accuracyLevel {String}: "standard", "high", or "low"
47
- * @return {number }: if cutoff value present returns value else return 0
48
- */
49
- _cutoffFromPseudoData = ( data , cutoffEntity , accuracyLevel = "standard" ) => {
50
- const cutoff = data ?. cutoffs ?. [ cutoffEntity ] || [ ] ;
51
- return cutoff . find ( ( obj ) => obj . accuracy_level === accuracyLevel ) ?. value ?? 0 ;
52
- } ;
53
-
54
- /**
55
- * @summary Set highest cutoff of all elements present, in case wavefunction
56
- * cutoff is present but no charge density cutoff, set charge density cutoff
57
- * to 4 or 8 times that of wavefunction cutoff
58
- * @return {Array<number> }: tuple of wavefunction and density cutoffs
59
- */
60
- get _cutoffsFromPseudos ( ) {
61
- let ecutwfc = 0 ;
62
- let ecutrho = 0 ;
63
- const pseudos = this . methodData ?. pseudo || [ ] ;
64
-
65
- pseudos . forEach ( ( data ) => {
66
- const ecutwfcStandard = this . _cutoffFromPseudoData ( data , "wavefunction" ) ;
67
- const ecutrhoStandard = this . _cutoffFromPseudoData ( data , "density" ) ;
68
- // set the highest cutoff of all elements
69
- ecutwfc = Math . max ( ecutwfc , ecutwfcStandard ) ;
70
-
71
- if ( ecutrhoStandard > ecutrho ) {
72
- ecutrho = ecutrhoStandard ;
73
- } else {
74
- // if rho cutoff is not present, set it based on wfc cutoff
75
- // if it is ultrasoft pseudopotential set rho cutoff 8 times
76
- // that of wfc cutoff, otherwise 4 times that of wfc cutoff
77
- const rhoMultiplier = data ?. type === "us" ? 8 : 4 ;
78
- ecutrho = Math . max ( ecutrho , ecutwfc * rhoMultiplier ) ;
79
- }
80
- } ) ;
81
-
82
- return [ ecutwfc , ecutrho ] ;
83
- }
84
-
85
41
get defaultECUTWFC ( ) {
86
- const [ ecutwfc ] = this . _cutoffsFromPseudos ;
42
+ const [ ecutwfc ] = this . highestCutoffsFromPseudos ;
87
43
88
44
if ( ecutwfc > 0 ) {
89
45
return ecutwfc ;
@@ -93,7 +49,7 @@ export class PlanewaveCutoffsContextProvider extends ContextProvider {
93
49
}
94
50
95
51
get defaultECUTRHO ( ) {
96
- const [ , ecutrho ] = this . _cutoffsFromPseudos ; // destructure and select second item
52
+ const [ , ecutrho ] = this . highestCutoffsFromPseudos ; // destructure and select second item
97
53
98
54
if ( ecutrho > 0 ) {
99
55
return ecutrho ;
0 commit comments