@@ -74,6 +74,10 @@ def test_user_incar_settings():
74
74
"NSW" : 5_000 ,
75
75
"PREC" : 10 , # wrong type, should be string.
76
76
"SIGMA" : 20 ,
77
+ "LDAUU" : {"H" : 5.0 },
78
+ "LDAUJ" : {"H" : 6.0 },
79
+ "LDAUL" : {"H" : 3.0 },
80
+ "LDAUTYPE" : 2 ,
77
81
}
78
82
79
83
static_set_generator = StaticSetGenerator (user_incar_settings = uis )
@@ -82,6 +86,8 @@ def test_user_incar_settings():
82
86
for key in uis :
83
87
if isinstance (incar [key ], str ):
84
88
assert incar [key ].lower () == uis [key ].lower ()
89
+ elif isinstance (uis [key ], dict ):
90
+ assert incar [key ] == [uis [key ][str (site .specie )] for site in structure ]
85
91
else :
86
92
assert incar [key ] == uis [key ]
87
93
@@ -92,9 +98,9 @@ def test_user_incar_settings():
92
98
("struct_no_magmoms" , {}),
93
99
("struct_with_magmoms" , {}),
94
100
("struct_with_spin" , {}),
95
- ("struct_no_magmoms" , {"MAGMOM" : [ 3.7 , 0.8 ] }),
96
- ("struct_with_magmoms" , {"MAGMOM" : [ 3.7 , 0.8 ] }),
97
- ("struct_with_spin" , {"MAGMOM" : [ 3.7 , 0.8 ] }),
101
+ ("struct_no_magmoms" , {"MAGMOM" : { "Fe" : 3.7 , "O" : 0.8 } }),
102
+ ("struct_with_magmoms" , {"MAGMOM" : { "Fe" : 3.7 , "O" : 0.8 } }),
103
+ ("struct_with_spin" , {"MAGMOM" : { "Fe2+,spin=4" : 3.7 , "O2-,spin=0.63" : 0.8 } }),
98
104
],
99
105
)
100
106
def test_incar_magmoms_precedence (structure , user_incar_settings , request ) -> None :
@@ -121,7 +127,9 @@ def test_incar_magmoms_precedence(structure, user_incar_settings, request) -> No
121
127
has_struct_spin = getattr (structure .species [0 ], "spin" , None ) is not None
122
128
123
129
if user_incar_settings : # case 1
124
- assert incar_magmom == user_incar_settings ["MAGMOM" ]
130
+ assert incar_magmom == [
131
+ user_incar_settings ["MAGMOM" ][str (site .specie )] for site in structure
132
+ ]
125
133
elif has_struct_magmom : # case 2
126
134
assert incar_magmom == structure .site_properties ["magmom" ]
127
135
elif has_struct_spin : # case 3
0 commit comments