@@ -22,10 +22,10 @@ def load_from_internal(self, name, oxidations, working_ion="Li"):
22
22
return BatteryAnalyzer (struct , working_ion )
23
23
24
24
def setUp (self ):
25
- self .lifepo4 = self .load_from_internal ("LiFePO4" , {"Li" : 1 , "Fe" : 2 , "P" : 5 , "O" : - 2 })
26
- self .nafepo4 = self .load_from_internal ("NaFePO4" , {"Na" : 1 , "Fe" : 2 , "P" : 5 , "O" : - 2 }, working_ion = "Na" )
25
+ self .li_fe_p_o4 = self .load_from_internal ("LiFePO4" , {"Li" : 1 , "Fe" : 2 , "P" : 5 , "O" : - 2 })
26
+ self .na_fe_p_o4 = self .load_from_internal ("NaFePO4" , {"Na" : 1 , "Fe" : 2 , "P" : 5 , "O" : - 2 }, working_ion = "Na" )
27
27
self .la2coo4f = self .load_from_internal ("La2CoO4F" , {"La" : 3 , "Co" : 3 , "O" : - 2 , "F" : - 1 }, working_ion = "F" )
28
- self .fepo4 = self .load_from_cif ("FePO4a.cif" , {"Fe" : 3 , "P" : 5 , "O" : - 2 })
28
+ self .fe_p_o4 = self .load_from_cif ("FePO4a.cif" , {"Fe" : 3 , "P" : 5 , "O" : - 2 })
29
29
self .la2coo4 = self .load_from_cif ("La2CoO4.cif" , {"La" : 3 , "Co" : 2 , "O" : - 2 }, working_ion = "F" )
30
30
self .lifemnpo4 = self .load_from_cif ("Li4Fe3Mn1(PO4)4.cif" , {"Li" : 1 , "Fe" : 2 , "Mn" : 2 , "P" : 5 , "O" : - 2 })
31
31
self .li8nicofe208 = self .load_from_cif (
@@ -34,55 +34,55 @@ def setUp(self):
34
34
self .li3v2p3o12 = self .load_from_internal ("Li3V2(PO4)3" , {"Li" : 1 , "V" : 3 , "O" : - 2 , "P" : 5 })
35
35
self .mgnif6 = self .load_from_cif ("MgNiF6.cif" , {"Mg" : 2 , "Ni" : 4 , "F" : - 1 }, working_ion = "F" )
36
36
37
- def test_oxid_check (self ):
37
+ def test_oxide_check (self ):
38
38
struct = self .get_structure ("LiFePO4" )
39
- with pytest .raises (ValueError ):
39
+ with pytest .raises (ValueError , match = "BatteryAnalyzer requires oxidation states assigned to structure" ):
40
40
BatteryAnalyzer (struct , "Li" )
41
41
42
42
def test_capacitygrav_calculations (self ):
43
- lifepo4_cap = 169.89053 # same as fepo4 cap
44
- nafepo4_cap = 154.20331
45
- la2coo4f_cap = 175.6564
46
- li3v2p3o12_cap_remove = 197.25339
47
- li3v2p3o12_cap_insert = 127.17129
43
+ li_fe_p_o4_cap = 169.89053 # same as fe_po4 cap
44
+ na_fe_p_o4_cap = 154.20331
45
+ la2_co_o4_f_cap = 175.6564
46
+ li3_v2_p3_o12_cap_remove = 197.25339
47
+ li3_v2_p3_o12_cap_insert = 127.17129
48
48
49
- assert self .lifepo4 .get_max_capgrav () == approx (lifepo4_cap , abs = 1e-3 )
50
- assert self .lifepo4 .get_max_capgrav (remove = False ) == 0
51
- assert self .lifepo4 .get_max_capgrav (insert = False ) == approx (lifepo4_cap , abs = 1e-3 )
49
+ assert self .li_fe_p_o4 .get_max_capgrav () == approx (li_fe_p_o4_cap , abs = 1e-3 )
50
+ assert self .li_fe_p_o4 .get_max_capgrav (remove = False ) == 0
51
+ assert self .li_fe_p_o4 .get_max_capgrav (insert = False ) == approx (li_fe_p_o4_cap , abs = 1e-3 )
52
52
53
- assert self .nafepo4 .get_max_capgrav () == approx (nafepo4_cap , abs = 1e-3 )
54
- assert self .nafepo4 .get_max_capgrav (remove = False ) == 0
53
+ assert self .na_fe_p_o4 .get_max_capgrav () == approx (na_fe_p_o4_cap , abs = 1e-3 )
54
+ assert self .na_fe_p_o4 .get_max_capgrav (remove = False ) == 0
55
55
56
- assert self .fepo4 .get_max_capgrav () == approx (lifepo4_cap , abs = 1e-3 )
57
- assert self .fepo4 .get_max_capgrav (insert = False ) == 0
56
+ assert self .fe_p_o4 .get_max_capgrav () == approx (li_fe_p_o4_cap , abs = 1e-3 )
57
+ assert self .fe_p_o4 .get_max_capgrav (insert = False ) == 0
58
58
59
- assert self .la2coo4f .get_max_capgrav () == approx (la2coo4f_cap , abs = 1e-3 )
60
- assert self .la2coo4 .get_max_capgrav () == approx (la2coo4f_cap , abs = 1e-3 )
59
+ assert self .la2coo4f .get_max_capgrav () == approx (la2_co_o4_f_cap , abs = 1e-3 )
60
+ assert self .la2coo4 .get_max_capgrav () == approx (la2_co_o4_f_cap , abs = 1e-3 )
61
61
assert self .la2coo4 .get_max_capgrav (insert = False ) == 0
62
62
63
- assert self .li3v2p3o12 .get_max_capgrav (insert = False ) == approx (li3v2p3o12_cap_remove , abs = 1e-3 )
64
- assert self .li3v2p3o12 .get_max_capgrav (remove = False ) == approx (li3v2p3o12_cap_insert , abs = 1e-3 )
63
+ assert self .li3v2p3o12 .get_max_capgrav (insert = False ) == approx (li3_v2_p3_o12_cap_remove , abs = 1e-3 )
64
+ assert self .li3v2p3o12 .get_max_capgrav (remove = False ) == approx (li3_v2_p3_o12_cap_insert , abs = 1e-3 )
65
65
66
66
def test_capacityvol_calculations (self ):
67
- lifepo4_cap = 594.17518
68
- nafepo4_cap = 542.86104
67
+ li_fe_p_o4_cap = 594.17518
68
+ na_fe_p_o4_cap = 542.86104
69
69
70
- fepo4_cap = 624.82289 # this is different than lifepo4 cap if lifepo4 volume not known
70
+ fe_p_o4_cap = 624.82289 # this is different than li_fe_p_o4_cap cap if li_fe_p_o4 volume not known
71
71
72
- assert self .lifepo4 .get_max_capvol () == approx (lifepo4_cap , abs = 1e-3 )
73
- assert self .lifepo4 .get_max_capvol (remove = False ) == 0
74
- assert self .lifepo4 .get_max_capvol (insert = False ) == approx (lifepo4_cap , abs = 1e-3 )
72
+ assert self .li_fe_p_o4 .get_max_capvol () == approx (li_fe_p_o4_cap , abs = 1e-3 )
73
+ assert self .li_fe_p_o4 .get_max_capvol (remove = False ) == 0
74
+ assert self .li_fe_p_o4 .get_max_capvol (insert = False ) == approx (li_fe_p_o4_cap , abs = 1e-3 )
75
75
76
- assert self .nafepo4 .get_max_capvol () == approx (nafepo4_cap , abs = 1e-3 )
77
- assert self .nafepo4 .get_max_capvol (remove = False ) == 0
78
- assert self .nafepo4 .get_max_capvol (insert = False ) == approx (nafepo4_cap , abs = 1e-3 )
76
+ assert self .na_fe_p_o4 .get_max_capvol () == approx (na_fe_p_o4_cap , abs = 1e-3 )
77
+ assert self .na_fe_p_o4 .get_max_capvol (remove = False ) == 0
78
+ assert self .na_fe_p_o4 .get_max_capvol (insert = False ) == approx (na_fe_p_o4_cap , abs = 1e-3 )
79
79
80
- assert self .fepo4 .get_max_capvol () == approx (fepo4_cap , abs = 1e-3 )
81
- assert self .fepo4 .get_max_capvol (remove = False ) == approx (fepo4_cap , abs = 1e-3 )
82
- assert self .fepo4 .get_max_capvol (insert = False ) == 0
80
+ assert self .fe_p_o4 .get_max_capvol () == approx (fe_p_o4_cap , abs = 1e-3 )
81
+ assert self .fe_p_o4 .get_max_capvol (remove = False ) == approx (fe_p_o4_cap , abs = 1e-3 )
82
+ assert self .fe_p_o4 .get_max_capvol (insert = False ) == 0
83
83
84
84
# give the lifepo4 volume, should get lifepo4 capacity
85
- assert self .fepo4 .get_max_capvol (volume = self .lifepo4 .struc_oxid .volume ) == approx (lifepo4_cap , abs = 1e-3 )
85
+ assert self .fe_p_o4 .get_max_capvol (volume = self .li_fe_p_o4 .struc_oxid .volume ) == approx (li_fe_p_o4_cap , abs = 1e-3 )
86
86
87
87
def test_ion_removal (self ):
88
88
assert self .lifemnpo4 .get_removals_int_oxid () == {1 , 2 , 3 , 4 }
0 commit comments