@@ -256,6 +256,13 @@ def test_get_incar(self):
256
256
incar = MITRelaxSet (struct ).incar
257
257
self .assertEqual (incar ["LDAUU" ], [4.0 , 0 ])
258
258
259
+ # This seems counterintuitive at first, but even if the prior INCAR has a MAGMOM flag,
260
+ # because the structure has no site properties, the default MAGMOM is assigned from the
261
+ # config dictionary.
262
+ struct = Structure (lattice , ["Fe" , "F" ], coords )
263
+ incar = MPRelaxSet (struct , prev_incar = os .path .join (self .TEST_FILES_DIR , "INCAR" )).incar
264
+ self .assertEqual (incar ["MAGMOM" ], [5 , 0.6 ])
265
+
259
266
# Make sure this works with species.
260
267
struct = Structure (lattice , ["Fe2+" , "O2-" ], coords )
261
268
incar = MPRelaxSet (struct ).incar
@@ -272,10 +279,6 @@ def test_get_incar(self):
272
279
incar = MPRelaxSet (struct ).incar
273
280
self .assertEqual (incar ["MAGMOM" ], [5 , 4.1 ])
274
281
275
- struct = Structure (lattice , [Species ("Fe" , 2 , {"spin" : 4.1 }), "Mn" ], coords )
276
- incar = MPRelaxSet (struct , user_incar_settings = {"MAGMOM" : [1.0 , 1.0 ]}).incar
277
- self .assertEqual (incar ["MAGMOM" ], [1.0 , 1.0 ])
278
-
279
282
struct = Structure (lattice , ["Mn3+" , "Mn4+" ], coords )
280
283
incar = MITRelaxSet (struct ).incar
281
284
self .assertEqual (incar ["MAGMOM" ], [4 , 3 ])
@@ -525,16 +528,6 @@ def test_valid_magmom_struct(self):
525
528
)
526
529
vis .incar .items ()
527
530
528
- # Test the behavior of passing in the wrong type of MAGMOM to user_incar_settings
529
- struct = self .structure .copy ()
530
- with pytest .raises (TypeError , match = r"MAGMOM must be supplied" ):
531
- vis = MPRelaxSet (
532
- struct ,
533
- user_incar_settings = {"MAGMOM" : [5.0 , 5.0 ]},
534
- user_potcar_settings = {"Fe" : "Fe" },
535
- )
536
- vis .incar .items ()
537
-
538
531
539
532
class MPStaticSetTest (PymatgenTest ):
540
533
def setUp (self ):
0 commit comments