Skip to content

Commit 58263c4

Browse files
JaGeojanosh
andauthored
Add citations for Lobster modules and tiny addition to DOSCAR processing (#3114)
* Update citations * Add lobster automation citations * add more flexibility for dos * prefer np.allclose over for loops for frac_coords assertion --------- Co-authored-by: Janosh Riebesell <[email protected]>
1 parent 9d0461f commit 58263c4

File tree

14 files changed

+81
-38
lines changed

14 files changed

+81
-38
lines changed

pymatgen/analysis/chemenv/coordination_environments/coordination_geometry_finder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
This module contains the main object used to identify the coordination environments in a given structure.
3-
If you use this module, please cite the following:
3+
If you use this module, please cite:
44
David Waroquiers, Xavier Gonze, Gian-Marco Rignanese, Cathrin Welker-Nieuwoudt, Frank Rosowski,
55
Michael Goebel, Stephan Schenk, Peter Degelmann, Rute Andre, Robert Glaum, and Geoffroy Hautier,
66
"Statistical analysis of coordination environments in oxides",

pymatgen/command_line/bader_caller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Please download the library at http://theory.cm.utexas.edu/henkelman/code/bader/
77
and follow the instructions to compile the executable.
88
9-
If you use this module, please cite the following:
9+
If you use this module, please cite:
1010
1111
G. Henkelman, A. Arnaldsson, and H. Jonsson, "A fast and robust algorithm for
1212
Bader decomposition of charge density", Comput. Mater. Sci. 36, 254-360 (2006).

pymatgen/command_line/critic2_caller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
a bond critical point)
2727
* critic2 can do many other things besides
2828
29-
If you use this module, please cite the following:
29+
If you use this module, please cite:
3030
3131
A. Otero-de-la-Roza, E. R. Johnson and V. Luaña,
3232
Comput. Phys. Communications 185, 1007-1018 (2014)

pymatgen/command_line/enumlib_caller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
https://github.com/msg-byu/enumlib and follow the instructions in the README to
88
compile these two executables accordingly.
99
10-
If you use this module, please cite the following:
10+
If you use this module, please cite:
1111
1212
Gus L. W. Hart and Rodney W. Forcade, "Algorithm for generating derivative
1313
structures," Phys. Rev. B 77 224115 (26 June 2008)

pymatgen/command_line/vampire_caller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Please download at https://vampire.york.ac.uk/download/ and
77
follow the instructions to compile the executable.
88
9-
If you use this module, please cite the following:
9+
If you use this module, please cite:
1010
1111
"Atomistic spin model simulations of magnetic nanomaterials."
1212
R. F. L. Evans, W. J. Fan, P. Chureemart, T. A. Ostler, M. O. A. Ellis

pymatgen/electronic_structure/cohp.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
"""
22
This module defines classes to represent crystal orbital Hamilton
33
populations (COHP) and integrated COHP (ICOHP), but can also be used
4-
for crystal orbital overlap populations (COOP).
4+
for crystal orbital overlap populations (COOP) or crystal orbital bond indices (COBIs).
5+
If you use this module, please cite:
6+
J. George, G. Petretto, A. Naik, M. Esters, A. J. Jackson, R. Nelson, R. Dronskowski, G.-M. Rignanese, G. Hautier,
7+
"Automated Bonding Analysis with Crystal Orbital Hamilton Populations",
8+
ChemPlusChem 2022, e202200123,
9+
DOI: 10.1002/cplu.202200123.
510
"""
611

712
from __future__ import annotations
@@ -20,15 +25,21 @@
2025
from pymatgen.io.lmto import LMTOCopl
2126
from pymatgen.io.lobster import Cohpcar
2227
from pymatgen.util.coord import get_linear_interpolated_value
28+
from pymatgen.util.due import Doi, due
2329
from pymatgen.util.num import round_to_sigfigs
2430

2531
__author__ = "Marco Esters, Janine George"
2632
__copyright__ = "Copyright 2017, The Materials Project"
2733
__version__ = "0.2"
28-
__maintainer__ = "Marco Esters, Janine George"
29-
34+
__maintainer__ = "Janine George"
35+
__email__ = "[email protected]"
3036
__date__ = "Dec 13, 2017"
3137

38+
due.cite(
39+
Doi("10.1002/cplu.202200123"),
40+
description="Automated Bonding Analysis with Crystal Orbital Hamilton Populations",
41+
)
42+
3243

3344
class Cohp(MSONable):
3445
"""Basic COHP object."""

pymatgen/io/lmto.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Distributed under the terms of the MIT License
2-
31
"""
42
Module for implementing a CTRL file object class for the Stuttgart
53
LMTO-ASA code. It will primarily be used to generate a pymatgen

pymatgen/io/lobster/inputs.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
# Distributed under the terms of the MIT License
2-
31
"""
42
Module for reading Lobster input files. For more information
53
on LOBSTER see www.cohp.de.
4+
If you use this module, please cite:
5+
J. George, G. Petretto, A. Naik, M. Esters, A. J. Jackson, R. Nelson, R. Dronskowski, G.-M. Rignanese, G. Hautier,
6+
"Automated Bonding Analysis with Crystal Orbital Hamilton Populations",
7+
ChemPlusChem 2022, e202200123,
8+
DOI: 10.1002/cplu.202200123.
69
"""
710

811
from __future__ import annotations
@@ -22,6 +25,7 @@
2225
from pymatgen.io.vasp import Vasprun
2326
from pymatgen.io.vasp.inputs import Incar, Kpoints, Potcar
2427
from pymatgen.symmetry.bandstructure import HighSymmKpath
28+
from pymatgen.util.due import Doi, due
2529

2630
if TYPE_CHECKING:
2731
from pymatgen.core.composition import Composition
@@ -30,13 +34,19 @@
3034
__author__ = "Janine George, Marco Esters"
3135
__copyright__ = "Copyright 2017, The Materials Project"
3236
__version__ = "0.2"
33-
__maintainer__ = "Janine George, Marco Esters"
34-
37+
__maintainer__ = "Janine George"
38+
__email__ = "[email protected]"
3539
__date__ = "Dec 13, 2017"
3640

3741
MODULE_DIR = os.path.dirname(os.path.abspath(__file__))
3842

3943

44+
due.cite(
45+
Doi("10.1002/cplu.202200123"),
46+
description="Automated Bonding Analysis with Crystal Orbital Hamilton Populations",
47+
)
48+
49+
4050
class Lobsterin(dict, MSONable):
4151
"""
4252
This class can handle and generate lobsterin files

pymatgen/io/lobster/lobsterenv.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
the local environments (e.g., finding near neighbors)
44
of single sites in molecules and structures based on
55
bonding analysis with Lobster.
6+
If you use this module, please cite:
7+
J. George, G. Petretto, A. Naik, M. Esters, A. J. Jackson, R. Nelson, R. Dronskowski, G.-M. Rignanese, G. Hautier,
8+
"Automated Bonding Analysis with Crystal Orbital Hamilton Populations",
9+
ChemPlusChem 2022, e202200123,
10+
DOI: 10.1002/cplu.202200123.
611
"""
712
from __future__ import annotations
813

@@ -23,6 +28,7 @@
2328
from pymatgen.electronic_structure.core import Spin
2429
from pymatgen.electronic_structure.plotter import CohpPlotter
2530
from pymatgen.io.lobster import Charge, Icohplist
31+
from pymatgen.util.due import Doi, due
2632

2733
if TYPE_CHECKING:
2834
from pymatgen.core import Structure
@@ -35,6 +41,11 @@
3541
__status__ = "Production"
3642
__date__ = "February 2, 2021"
3743

44+
due.cite(
45+
Doi("10.1002/cplu.202200123"),
46+
description="Automated Bonding Analysis with Crystal Orbital Hamilton Populations",
47+
)
48+
3849

3950
class LobsterNeighbors(NearNeighbors):
4051
"""

pymatgen/io/lobster/outputs.py

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
# Distributed under the terms of the MIT License
2-
31
"""
42
Module for reading Lobster output files. For more information
53
on LOBSTER see www.cohp.de.
4+
If you use this module, please cite:
5+
J. George, G. Petretto, A. Naik, M. Esters, A. J. Jackson, R. Nelson, R. Dronskowski, G.-M. Rignanese, G. Hautier,
6+
"Automated Bonding Analysis with Crystal Orbital Hamilton Populations",
7+
ChemPlusChem 2022, e202200123,
8+
DOI: 10.1002/cplu.202200123.
69
"""
710

811
from __future__ import annotations
@@ -13,7 +16,7 @@
1316
import re
1417
import warnings
1518
from collections import defaultdict
16-
from typing import Any
19+
from typing import TYPE_CHECKING, Any
1720

1821
import numpy as np
1922
from monty.io import zopen
@@ -24,16 +27,25 @@
2427
from pymatgen.electronic_structure.dos import Dos, LobsterCompleteDos
2528
from pymatgen.io.vasp.inputs import Kpoints
2629
from pymatgen.io.vasp.outputs import Vasprun, VolumetricData
30+
from pymatgen.util.due import Doi, due
31+
32+
if TYPE_CHECKING:
33+
from pymatgen.core.structure import IStructure
2734

2835
__author__ = "Janine George, Marco Esters"
2936
__copyright__ = "Copyright 2017, The Materials Project"
3037
__version__ = "0.2"
31-
__maintainer__ = "Janine George, Marco Esters "
32-
38+
__maintainer__ = "Janine George "
39+
__email__ = "[email protected]"
3340
__date__ = "Dec 13, 2017"
3441

3542
MODULE_DIR = os.path.dirname(os.path.abspath(__file__))
3643

44+
due.cite(
45+
Doi("10.1002/cplu.202200123"),
46+
description="Automated Bonding Analysis with Crystal Orbital Hamilton Populations",
47+
)
48+
3749

3850
class Cohpcar:
3951
"""
@@ -469,18 +481,19 @@ class Doscar:
469481
def __init__(
470482
self,
471483
doscar: str = "DOSCAR.lobster",
472-
structure_file: str = "POSCAR",
473-
dftprogram: str = "Vasp",
484+
structure_file: str | None = "POSCAR",
485+
structure: IStructure | Structure | None = None,
474486
):
475487
"""
476488
Args:
477489
doscar: DOSCAR filename, typically "DOSCAR.lobster"
478490
structure_file: for vasp, this is typically "POSCAR"
479-
dftprogram: so far only "vasp" is implemented.
491+
structure: instead of a structure file, the structure can be given
492+
directly. structure_file will be preferred.
480493
"""
481494
self._doscar = doscar
482-
if dftprogram == "Vasp":
483-
self._final_structure = Structure.from_file(structure_file)
495+
496+
self._final_structure = Structure.from_file(structure_file) if structure_file is not None else structure
484497

485498
self._parse_doscar()
486499

pymatgen/io/lobster/tests/test_lobster.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,10 @@ def setUp(self):
692692

693693
self.structure = Structure.from_dict(data)
694694

695-
def test_completedos(self):
695+
# test structure argument
696+
self.DOSCAR_spin_pol2 = Doscar(doscar=doscar, structure_file=None, structure=Structure.from_file(poscar))
697+
698+
def test_complete_dos(self):
696699
# first for spin polarized version
697700
energies_spin = [-11.25000, -7.50000, -3.75000, 0.00000, 3.75000, 7.50000]
698701
tdos_up = [0.00000, 0.79999, 0.00000, 0.79999, 0.00000, 0.02577]
@@ -712,12 +715,15 @@ def test_completedos(self):
712715
assert tdos_up == self.DOSCAR_spin_pol.completedos.densities[Spin.up].tolist()
713716
assert tdos_down == self.DOSCAR_spin_pol.completedos.densities[Spin.down].tolist()
714717
assert fermi == approx(self.DOSCAR_spin_pol.completedos.efermi)
715-
for coords, coords2 in zip(
718+
719+
assert np.allclose(
716720
self.DOSCAR_spin_pol.completedos.structure.frac_coords,
717721
self.structure.frac_coords,
718-
):
719-
for xyz, xyz2 in zip(coords, coords2):
720-
assert xyz == approx(xyz2)
722+
)
723+
assert np.allclose(
724+
self.DOSCAR_spin_pol2.completedos.structure.frac_coords,
725+
self.structure.frac_coords,
726+
)
721727
assert self.DOSCAR_spin_pol.completedos.pdos[self.structure[0]]["2s"][Spin.up].tolist() == PDOS_F_2s_up
722728
assert self.DOSCAR_spin_pol.completedos.pdos[self.structure[0]]["2s"][Spin.down].tolist() == PDOS_F_2s_down
723729
assert self.DOSCAR_spin_pol.completedos.pdos[self.structure[0]]["2p_y"][Spin.up].tolist() == PDOS_F_2py_up
@@ -2308,12 +2314,10 @@ def test_structure_with_grosspop(self):
23082314
],
23092315
}
23102316

2311-
newstructure = self.grosspop1.get_structure_with_total_grosspop(
2317+
new_structure = self.grosspop1.get_structure_with_total_grosspop(
23122318
os.path.join(PymatgenTest.TEST_FILES_DIR, "cohp", "POSCAR.SiO2")
23132319
)
2314-
for coords, coords2 in zip(newstructure.frac_coords, Structure.from_dict(struct_dict).frac_coords):
2315-
for xyz, xyz2 in zip(coords, coords2):
2316-
assert xyz == approx(xyz2)
2320+
assert np.allclose(new_structure.frac_coords, Structure.from_dict(struct_dict).frac_coords)
23172321

23182322

23192323
class TestUtils(PymatgenTest):

pymatgen/io/shengbte.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Distributed under the terms of the MIT License
2-
31
"""This module implements reading and writing of ShengBTE CONTROL files."""
42

53
from __future__ import annotations

pymatgen/util/convergence.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Distributed under the terms of the MIT License.import string
2-
31
"""
42
function for calculating the convergence of an x, y data set
53
main api:

test_files/.pytest-split-durations

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1657,7 +1657,7 @@
16571657
"pymatgen/io/lobster/tests/test_lobster.py::CohpcarTest::test_cohp_data": 0.07920433301478624,
16581658
"pymatgen/io/lobster/tests/test_lobster.py::CohpcarTest::test_energies": 0.07907520799199119,
16591659
"pymatgen/io/lobster/tests/test_lobster.py::CohpcarTest::test_orbital_resolved_cohp": 0.08125483398907818,
1660-
"pymatgen/io/lobster/tests/test_lobster.py::DoscarTest::test_completedos": 0.002467168014845811,
1660+
"pymatgen/io/lobster/tests/test_lobster.py::DoscarTest::test_complete_dos": 0.002467168014845811,
16611661
"pymatgen/io/lobster/tests/test_lobster.py::DoscarTest::test_energies": 0.0008928750030463561,
16621662
"pymatgen/io/lobster/tests/test_lobster.py::DoscarTest::test_is_spin_polarized": 0.0008428330183960497,
16631663
"pymatgen/io/lobster/tests/test_lobster.py::DoscarTest::test_itdensities": 0.0008630430093035102,

0 commit comments

Comments
 (0)