Skip to content

Commit 4e25547

Browse files
authored
Fix test_valid_magmom_struct() error message regex (#3276)
* psps->PSPs in doc strings * fix typo * try fix test_valid_magmom_struct() err msg regex * revert pymatgen/io/abinit/pseudos.py
1 parent 5a1a9d2 commit 4e25547

File tree

12 files changed

+81
-93
lines changed

12 files changed

+81
-93
lines changed

pymatgen/analysis/piezo_sensitivity.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def __init__(self, structure: Structure, bec, pointops, tol: float = 1e-3):
5151
if np.sum(self.bec) >= tol:
5252
warnings.warn("Input born effective charge tensor does not satisfy charge neutrality")
5353

54-
def get_BEC_operations(self, eigtol=1e-05, opstol=1e-03):
54+
def get_BEC_operations(self, eigtol=1e-5, opstol=1e-3):
5555
"""
5656
Returns the symmetry operations which maps the tensors
5757
belonging to equivalent sites onto each other in the form
@@ -187,7 +187,7 @@ def __init__(self, structure: Structure, ist, pointops, tol: float = 1e-3):
187187
if not (obj - np.transpose(obj, (0, 1, 3, 2)) < tol).all():
188188
warnings.warn("Input internal strain tensor does not satisfy standard symmetries")
189189

190-
def get_IST_operations(self, opstol=1e-03):
190+
def get_IST_operations(self, opstol=1e-3):
191191
"""
192192
Returns the symmetry operations which maps the tensors
193193
belonging to equivalent sites onto each other in the form
@@ -278,7 +278,7 @@ def __init__(self, structure: Structure, fcm, pointops, sharedops, tol: float =
278278
self.sharedops = sharedops
279279
self.FCM_operations = None
280280

281-
def get_FCM_operations(self, eigtol=1e-05, opstol=1e-05):
281+
def get_FCM_operations(self, eigtol=1e-5, opstol=1e-5):
282282
"""
283283
Returns the symmetry operations which maps the tensors
284284
belonging to equivalent sites onto each other in the form
@@ -497,7 +497,7 @@ def get_stable_FCM(self, fcm, fcmasum=10):
497497
maxeig = np.max(-1 * eigs)
498498
eigsort = np.argsort(np.abs(eigs))
499499
for i in range(3, len(eigs)):
500-
if eigs[eigsort[i]] > 1e-06:
500+
if eigs[eigsort[i]] > 1e-6:
501501
eigs[eigsort[i]] = -1 * maxeig * np.random.rand()
502502
diag = np.real(np.eye(len(fcm)) * eigs)
503503

@@ -508,7 +508,7 @@ def get_stable_FCM(self, fcm, fcmasum=10):
508508
unstable_modes = 0
509509
eigsort = np.argsort(np.abs(eigs))
510510
for i in range(3, len(eigs)):
511-
if eigs[eigsort[i]] > 1e-06:
511+
if eigs[eigsort[i]] > 1e-6:
512512
unstable_modes = 1
513513
if unstable_modes == 1:
514514
count = count + 1

pymatgen/analysis/structure_prediction/volume_predictor.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,12 @@ def predict(self, structure: Structure, icsd_vol=False):
171171
172172
Args:
173173
structure (Structure) : a crystal structure with an unknown volume.
174-
icsd_vol (bool) : True if the input structure's volume comes from
175-
ICSD.
174+
icsd_vol (bool) : True if the input structure's volume comes from ICSD.
176175
177176
Returns:
178177
a float value of the predicted volume.
179178
"""
180-
# Get standard deviation of electronnegativity in the structure.
179+
# Get standard deviation of electronegativity in the structure.
181180
std_x = np.std([site.specie.X for site in structure])
182181
# Sites that have atomic radii
183182
sub_sites = []

pymatgen/cli/pmg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def main():
123123
"--add",
124124
dest="var_spec",
125125
nargs="+",
126-
help="Variables to add in the form of space separated key value pairs. E.g., PMG_VASP_PSP_DIR ~/psps",
126+
help="Variables to add in the form of space separated key value pairs. E.g., PMG_VASP_PSP_DIR ~/PSPs",
127127
)
128128

129129
groups.add_argument(

pymatgen/core/structure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2553,7 +2553,7 @@ def as_dataframe(self):
25532553
Example:
25542554
Species a b c x y z magmom
25552555
0 (Si) 0.0 0.0 0.000000e+00 0.0 0.000000e+00 0.000000e+00 5
2556-
1 (Si) 0.0 0.0 1.000000e-07 0.0 -2.217138e-07 3.135509e-07 -5
2556+
1 (Si) 0.0 0.0 1.000000e-7 0.0 -2.217138e-7 3.135509e-7 -5
25572557
"""
25582558
data = []
25592559
site_properties = self.site_properties

pymatgen/electronic_structure/boltztrap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ def get_symm_bands(self, structure: Structure, efermi, kpt_line=None, labels_dic
862862
_idx_list: list[tuple[int, ArrayLike]] = []
863863
for idx, kp in enumerate(kpt_line):
864864
w: list[bool] = []
865-
prec = 1e-05
865+
prec = 1e-5
866866
while len(w) == 0:
867867
w = np.where(np.all(np.abs(kp - self._bz_kpoints) < [prec] * 3, axis=1))[0] # type: ignore
868868
prec *= 10

pymatgen/io/abinit/netcdf.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ def __init__(self, name, doc, etsf_name=None):
368368
_H("ntypat", "input variable", etsf_name="number_of_atom_species"),
369369
_H("occopt", "input variable"),
370370
_H("pertcase", "the index of the perturbation, 0 if GS calculation"),
371-
_H("usepaw", "input variable (0=norm-conserving psps, 1=paw)"),
371+
_H("usepaw", "input variable (0=norm-conserving PSPs, 1=paw)"),
372372
_H("usewvl", "input variable (0=plane-waves, 1=wavelets)"),
373373
_H("kptopt", "input variable (defines symmetries used for k-point sampling)"),
374374
_H("pawcpxocc", "input variable"),
@@ -379,7 +379,7 @@ def __init__(self, name, doc, etsf_name=None):
379379
_H("nshiftk", "number of shifts after inkpts."),
380380
_H("icoulomb", "input variable."),
381381
_H("ecut", "input variable", etsf_name="kinetic_energy_cutoff"),
382-
_H("ecutdg", "input variable (ecut for NC psps, pawecutdg for paw)"),
382+
_H("ecutdg", "input variable (ecut for NC PSPs, pawecutdg for paw)"),
383383
_H("ecutsm", "input variable"),
384384
_H("ecut_eff", "ecut*dilatmx**2 (dilatmx is an input variable)"),
385385
_H("etot", "EVOLVING variable"),
@@ -398,17 +398,17 @@ def __init__(self, name, doc, etsf_name=None):
398398
_H("kptrlatt_orig", "kptrlatt_orig(3,3) Original kptrlatt"),
399399
_H("kptrlatt", "kptrlatt(3,3) kptrlatt after inkpts."),
400400
_H("istwfk", "input variable istwfk(nkpt)"),
401-
_H("lmn_size", "lmn_size(npsp) from psps"),
401+
_H("lmn_size", "lmn_size(npsp) from PSPs"),
402402
_H("nband", "input variable nband(nkpt*nsppol)", etsf_name="number_of_states"),
403403
_H(
404404
"npwarr",
405405
"npwarr(nkpt) array holding npw for each k point",
406406
etsf_name="number_of_coefficients",
407407
),
408-
_H("pspcod", "pscod(npsp) from psps"),
409-
_H("pspdat", "psdat(npsp) from psps"),
410-
_H("pspso", "pspso(npsp) from psps"),
411-
_H("pspxc", "pspxc(npsp) from psps"),
408+
_H("pspcod", "pscod(npsp) from PSPs"),
409+
_H("pspdat", "psdat(npsp) from PSPs"),
410+
_H("pspso", "pspso(npsp) from PSPs"),
411+
_H("pspxc", "pspxc(npsp) from PSPs"),
412412
_H("so_psp", "input variable so_psp(npsp)"),
413413
_H("symafm", "input variable symafm(nsym)"),
414414
# _H(symrel="input variable symrel(3,3,nsym)", etsf_name="reduced_symmetry_matrices"),
@@ -429,14 +429,14 @@ def __init__(self, name, doc, etsf_name=None):
429429
_H("shiftk", "shiftk(3,nshiftk), shiftks after inkpts"),
430430
_H("amu", "amu(ntypat) ! EVOLVING variable"),
431431
# _H("xred", "EVOLVING variable xred(3,natom)", etsf_name="reduced_atom_positions"),
432-
_H("zionpsp", "zionpsp(npsp) from psps"),
432+
_H("zionpsp", "zionpsp(npsp) from PSPs"),
433433
_H(
434434
"znuclpsp",
435-
"znuclpsp(npsp) from psps. Note the difference between (znucl|znucltypat) and znuclpsp",
435+
"znuclpsp(npsp) from PSPs. Note the difference between (znucl|znucltypat) and znuclpsp",
436436
),
437437
_H("znucltypat", "znucltypat(ntypat) from alchemy", etsf_name="atomic_numbers"),
438438
_H("codvsn", "version of the code"),
439-
_H("title", "title(npsp) from psps"),
439+
_H("title", "title(npsp) from PSPs"),
440440
_H(
441441
"md5_pseudos",
442442
"md5pseudos(npsp), md5 checksums associated to pseudos (read from file)",

pymatgen/io/vasp/outputs.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ class Vasprun(MSONable):
248248
'e_wo_entrp': -525.07195568,
249249
'kinetic': 3.17809233,
250250
'lattice kinetic': 0.0,
251-
'nosekinetic': 1.323e-05,
251+
'nosekinetic': 1.323e-5,
252252
'nosepot': 0.0,
253253
'total': -521.89385012
254254
},
@@ -2241,10 +2241,12 @@ def _parse_sci_notation(line):
22412241
Method to parse lines with values in scientific notation and potentially
22422242
without spaces in between the values. This assumes that the scientific
22432243
notation always lists two digits for the exponent, e.g. 3.535E-02
2244+
22442245
Args:
22452246
line: line to parse.
22462247
2247-
Returns: an array of numbers if found, or empty array if not
2248+
Returns:
2249+
list[float]: numbers if found, empty ist if not
22482250
"""
22492251
m = re.findall(r"[\.\-\d]+E[\+\-]\d{2}", line)
22502252
if m:

pymatgen/io/vasp/sets.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ class MPRelaxSet(DictSet):
870870
Implementation of VaspInputSet utilizing parameters in the public
871871
Materials Project. Typically, the pseudopotentials chosen contain more
872872
electrons than the MIT parameters, and the k-point grid is ~50% more dense.
873-
The LDAUU parameters are also different due to the different psps used,
873+
The LDAUU parameters are also different due to the different PSPs used,
874874
which result in different fitted values.
875875
"""
876876

@@ -1264,8 +1264,7 @@ def __init__(self, structure: Structure, bandgap=0, prev_incar=None, lepsilon=Fa
12641264
Args:
12651265
structure (Structure): Structure from previous run.
12661266
bandgap (float): Bandgap of the structure in eV. The bandgap is used to
1267-
compute the appropriate k-point density and determine the
1268-
smearing settings.
1267+
compute the appropriate k-point density and determine the smearing settings.
12691268
prev_incar (Incar): Incar file from previous run.
12701269
lepsilon (bool): Whether to add static dielectric calculation
12711270
lcalcpol (bool): Whether to turn on evaluation of the Berry phase approximations
@@ -2742,7 +2741,7 @@ def __init__(self, structure: Structure, **kwargs):
27422741

27432742
updates = {
27442743
"ADDGRID": True,
2745-
"EDIFF": 1e-05,
2744+
"EDIFF": 1e-5,
27462745
"EDIFFG": -0.05,
27472746
"LASPH": True,
27482747
"LDAU": False,

tests/analysis/test_interface_reactions.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -169,42 +169,42 @@ def test_get_entry_energy(self):
169169
) as warns:
170170
energy = InterfacialReactivity._get_entry_energy(self.pd, comp)
171171
assert len(warns) == 1
172-
test1 = np.isclose(energy, -30, atol=1e-03)
172+
test1 = np.isclose(energy, -30, atol=1e-3)
173173
assert test1, f"_get_entry_energy: energy for {comp.reduced_formula} is wrong!"
174174
# Test normal functionality
175175
comp = Composition("MnO2")
176-
test2 = np.isclose(InterfacialReactivity._get_entry_energy(self.pd, comp), -30, atol=1e-03)
176+
test2 = np.isclose(InterfacialReactivity._get_entry_energy(self.pd, comp), -30, atol=1e-3)
177177
assert test2, f"_get_entry_energy: energy for {comp.reduced_formula} is wrong!"
178178

179179
def test_get_grand_potential(self):
180180
comp = Composition("LiMnO2")
181181
# Test non-normalized case
182-
test1 = np.isclose(self.irs[1]._get_grand_potential(comp), -27, atol=1e-03)
182+
test1 = np.isclose(self.irs[1]._get_grand_potential(comp), -27, atol=1e-3)
183183
assert test1, "_get_grand_potential: Non-normalized case gets error!"
184184

185185
# Test normalized case
186-
test2 = np.isclose(self.irs[2]._get_grand_potential(comp), -9, atol=1e-03)
186+
test2 = np.isclose(self.irs[2]._get_grand_potential(comp), -9, atol=1e-3)
187187
assert test2, "_get_grand_potential: Normalized case gets error!"
188188

189189
comp2 = Composition("Li2O2")
190190
# Test use_hull_energy option.
191-
test3 = np.isclose(self.irs[8]._get_grand_potential(comp2), -4, atol=1e-03)
191+
test3 = np.isclose(self.irs[8]._get_grand_potential(comp2), -4, atol=1e-3)
192192
assert test3, "_get_grand_potential: get hull energy gets error!"
193193

194-
test4 = np.isclose(self.irs[9]._get_grand_potential(comp2), -2, atol=1e-03)
194+
test4 = np.isclose(self.irs[9]._get_grand_potential(comp2), -2, atol=1e-3)
195195
assert test4, f"_get_grand_potential: gets error for {comp2.reduced_formula}!"
196196

197197
def test_get_energy(self):
198-
test1 = np.isclose(self.irs[0]._get_energy(0.5), -15, atol=1e-03)
198+
test1 = np.isclose(self.irs[0]._get_energy(0.5), -15, atol=1e-3)
199199
assert test1, "_get_energy: phase diagram gets error!"
200200

201-
test2 = np.isclose(self.irs[3]._get_energy(0.6666666), -7.333333, atol=1e-03)
201+
test2 = np.isclose(self.irs[3]._get_energy(0.6666666), -7.333333, atol=1e-3)
202202
assert test2, "_get_energy: grand canonical phase diagram gets error!"
203203

204-
test3 = np.isclose(self.irs[6]._get_energy(0.3333333), -3.333333, atol=1e-03)
204+
test3 = np.isclose(self.irs[6]._get_energy(0.3333333), -3.333333, atol=1e-3)
205205
assert test3, "_get_energy: convex hull energy gets error. "
206206

207-
test4 = np.isclose(self.irs[7]._get_energy(0.3333333), -4, atol=1e-03)
207+
test4 = np.isclose(self.irs[7]._get_energy(0.3333333), -4, atol=1e-3)
208208
assert test4, "_get_energy: gets error. "
209209

210210
def test_get_reaction(self):

tests/analysis/test_molecule_matcher.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -392,14 +392,14 @@ def test_fit(self):
392392
mm = HungarianOrderMatcher(mol1)
393393

394394
_, rmsd = mm.fit(mol2)
395-
assert rmsd == approx(1.4171601659148593e-05, abs=1e-6)
395+
assert rmsd == approx(1.4171601659148593e-5, abs=1e-6)
396396

397397
mol1 = Molecule.from_file(f"{test_dir}/c1.xyz")
398398
mol2 = Molecule.from_file(f"{test_dir}/c2.xyz")
399399
mm = HungarianOrderMatcher(mol1)
400400

401401
_, rmsd = mm.fit(mol2)
402-
assert rmsd == approx(9.479012116064961e-05, abs=1e-6)
402+
assert rmsd == approx(9.479012116064961e-5, abs=1e-6)
403403

404404
mol1 = Molecule.from_file(f"{test_dir}/t3.xyz")
405405
mol2 = Molecule.from_file(f"{test_dir}/t4.xyz")
@@ -413,7 +413,7 @@ def test_fit(self):
413413
mm = HungarianOrderMatcher(mol1)
414414

415415
_, rmsd = mm.fit(mol2)
416-
assert rmsd == approx(9.28245597473488e-05, abs=1e-6)
416+
assert rmsd == approx(9.28245597473488e-5, abs=1e-6)
417417

418418
mol1 = Molecule.from_file(f"{test_dir}/ethene1.xyz")
419419
mol2 = Molecule.from_file(f"{test_dir}/ethene2.xyz")
@@ -497,14 +497,14 @@ def test_fit(self):
497497
mm = GeneticOrderMatcher(mol1, threshold=0.01)
498498

499499
_, rmsd = mm.fit(mol2)[0]
500-
assert rmsd == approx(7.061017534055039e-05, abs=1e-6)
500+
assert rmsd == approx(7.061017534055039e-5, abs=1e-6)
501501

502502
mol1 = Molecule.from_file(f"{test_dir}/c1.xyz")
503503
mol2 = Molecule.from_file(f"{test_dir}/c2.xyz")
504504
mm = GeneticOrderMatcher(mol1, threshold=0.01)
505505

506506
_, rmsd = mm.fit(mol2)[0]
507-
assert rmsd == approx(9.459575146593829e-05, abs=1e-6)
507+
assert rmsd == approx(9.459575146593829e-5, abs=1e-6)
508508

509509
mol1 = Molecule.from_file(f"{test_dir}/t3.xyz")
510510
mol2 = Molecule.from_file(f"{test_dir}/t4.xyz")
@@ -518,7 +518,7 @@ def test_fit(self):
518518
mm = GeneticOrderMatcher(mol1, threshold=0.01)
519519

520520
_, rmsd = mm.fit(mol2)[0]
521-
assert rmsd == approx(9.28245597473488e-05, abs=1e-6)
521+
assert rmsd == approx(9.28245597473488e-5, abs=1e-6)
522522

523523
mol1 = Molecule.from_file(f"{test_dir}/ethene1.xyz")
524524
mol2 = Molecule.from_file(f"{test_dir}/ethene2.xyz")

0 commit comments

Comments
 (0)