@@ -192,20 +192,23 @@ def test_advanced_magnetic_settings(generate_structure_data):
192192 MagnetizationConfigurationSettingsModel ,
193193 MagnetizationConfigurationSettingsPanel ,
194194 )
195+ from aiidalab_qe .utils import fetch_pseudo_family_by_label
195196
196197 model = MagnetizationConfigurationSettingsModel ()
197198 magnetic = MagnetizationConfigurationSettingsPanel (model = model )
198- magnetic .render ()
199199
200- model . family = "SSSP/1.3/PBE/efficiency"
200+ pseudo_family = fetch_pseudo_family_by_label ( "SSSP/1.3/PBE/efficiency" )
201201
202202 structure = generate_structure_data (name = "LiCoO2" )
203203 model .input_structure = structure
204- model ._update_default_moments ()
204+ model .spin_type = "collinear"
205+ model .dictionary = {
206+ kind .name : pseudo_family .get_pseudo (kind .symbol ).uuid
207+ for kind in structure .kinds
208+ }
209+
210+ magnetic .render ()
205211
206- # The sssp fixture sets the number of valence electrons to 4 for all electrons. Here, we are only
207- # testing that the correct logic is applied, i.e., 0.1 * number of electrons for elements with
208- # default magnetic moment 0.
209212 assert model ._defaults ["moments" ] == {"Li" : 0.4 , "Co" : 5 , "O" : 0.4 }
210213
211214 structure = StructureData (
@@ -215,14 +218,31 @@ def test_advanced_magnetic_settings(generate_structure_data):
215218 [1.923685 , 1.110640 , 3.141364 ],
216219 ]
217220 )
218- structure .append_atom (position = (0.0 , 0.0 , 0.0 ), symbols = "Ni" , name = "Ni1" )
219221 structure .append_atom (
220- position = (1.923685 , 1.110640 , 0.785341 ), symbols = "Ni" , name = "Ni2"
222+ position = (0.0 , 0.0 , 0.0 ),
223+ symbols = "Ni" ,
224+ name = "Ni1" ,
225+ )
226+ structure .append_atom (
227+ position = (1.923685 , 1.110640 , 0.785341 ),
228+ symbols = "Ni" ,
229+ name = "Ni2" ,
230+ )
231+ structure .append_atom (
232+ position = (1.923685 , 0.0 , 2.356204 ),
233+ symbols = "O" ,
234+ name = "O1" ,
235+ )
236+ structure .append_atom (
237+ position = (1.923685 , 0.0 , 0.785341 ),
238+ symbols = "O" ,
239+ name = "O2" ,
221240 )
222- structure .append_atom (position = (1.923685 , 0.0 , 2.356204 ), symbols = "O" , name = "O1" )
223- structure .append_atom (position = (1.923685 , 0.0 , 0.785341 ), symbols = "O" , name = "O2" )
224241
225242 model .input_structure = structure
226- model ._update_default_moments ()
243+ model .dictionary = {
244+ kind .name : pseudo_family .get_pseudo (kind .symbol ).uuid
245+ for kind in structure .kinds
246+ }
227247
228248 assert model ._defaults ["moments" ] == {"O1" : 0.4 , "O2" : 0.4 , "Ni1" : 5 , "Ni2" : 5 }
0 commit comments