Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install optional boltztrap, vampire and openbabel in CI #3985

Merged
merged 94 commits into from
Sep 6, 2024

Conversation

DanielYang59
Copy link
Contributor

@DanielYang59 DanielYang59 commented Aug 9, 2024

Summary

Installed

Caution

[Need help] Broken unit tests revealed

Future PR

@@ -317,7 +317,7 @@ def test_plot_complexity_factor_mu(self):

def test_plot_conductivity_dop(self):
ax = self.plotter.plot_conductivity_dop()
assert len(ax.get_lines()) == 8, "wrong number of lines"
assert len(ax.get_lines()) == 16, f"wrong number of lines, got {len(ax.get_lines())}"
Copy link
Contributor Author

@DanielYang59 DanielYang59 Aug 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@janosh Perhaps you could help me verify eb7978d and f6a3fc7? #3237 seems to have broken some tests, and these commits just "fix" those tests, but I'm not sure if it's done properly.

Copy link
Contributor Author

@DanielYang59 DanielYang59 Aug 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I missed some, a8d04f9 and 1d104cb might need a closer look as well (changes made to electronic_structure.plotter).

Copy link
Member

@janosh janosh Aug 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's definitely something broken here but probably older and not caused by you. just tried running plot_seebeck_dop. looks like the lines aren't applied to the right axes

plot_seebeck_dop

Copy link
Contributor Author

@DanielYang59 DanielYang59 Aug 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for validation!

The tests were completely broken at feaadc0 (you have to fix the path in test file see a8d04f9 to get the following error log). changes on electronic_structure.plotter (not unit test) in this PR were made to get them back to run without any guarantee to generate proper plots :( I assume they were broken by #3237 (fig -> ax) 🙈 .

Looks like we got quite some work to do.

Full run log:

........F......FFFFF.FFFFFFFFFFFFF.....                                                                                                       [100%]
===================================================================== FAILURES ======================================================================
___________________________________________________________ TestBSPlotter.test_get_ticks ____________________________________________________________

self = <electronic_structure.test_plotter.TestBSPlotter testMethod=test_get_ticks>

    def test_get_ticks(self):
        assert self.plotter.get_ticks()["label"][5] == "K", "wrong tick label"
>       assert self.plotter.get_ticks()["distance"][5] == 2.406607625322699, "wrong tick distance"
E       AssertionError: wrong tick distance

/Users/yang/developer/pymatgen/tests/electronic_structure/test_plotter.py:156: AssertionError
______________________________________________________ TestBoltztrapPlotter.test_plot_carriers ______________________________________________________

self = <electronic_structure.test_plotter.TestBoltztrapPlotter testMethod=test_plot_carriers>

    def test_plot_carriers(self):
>       ax = self.plotter.plot_carriers()

tests/electronic_structure/test_plotter.py:305: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/pymatgen/electronic_structure/plotter.py:3644: in plot_carriers
    ax.set_xticks(fontsize=25)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Axes: xlabel='E-E$_f$ (eV)', ylabel='carrier concentration (cm-3)'>, args = (), kwargs = {'fontsize': 25}

    def wrapper(self, *args, **kwargs):
>       return get_method(self)(*args, **kwargs)
E       TypeError: Axis.set_ticks() missing 1 required positional argument: 'ticks'

venv/lib/python3.12/site-packages/matplotlib/axes/_base.py:74: TypeError
________________________________________________ TestBoltztrapPlotter.test_plot_complexity_factor_mu ________________________________________________

eta = array([1.]), Lambda = 0.5

    def seebeck_spb(eta, Lambda=0.5):
        """Seebeck analytic formula in the single parabolic model."""
        try:
>           from fdint import fdk
E           ModuleNotFoundError: No module named 'fdint'

src/pymatgen/electronic_structure/boltztrap.py:2257: ModuleNotFoundError

During handling of the above exception, another exception occurred:

self = <electronic_structure.test_plotter.TestBoltztrapPlotter testMethod=test_plot_complexity_factor_mu>

    def test_plot_complexity_factor_mu(self):
>       ax = self.plotter.plot_complexity_factor_mu()

tests/electronic_structure/test_plotter.py:312: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/pymatgen/electronic_structure/plotter.py:2924: in plot_complexity_factor_mu
    cmplx_fact = self._bz.get_complexity_factor(output=output, temp=T, Lambda=Lambda)
src/pymatgen/electronic_structure/boltztrap.py:1401: in get_complexity_factor
    sbk_mass = self.get_seebeck_eff_mass(output, temp, doping_levels=False, Lambda=Lambda)
src/pymatgen/electronic_structure/boltztrap.py:1345: in get_seebeck_eff_mass
    sbk_mass.append(seebeck_eff_mass_from_seebeck_carr(abs(seebeck[idx]), concen, temp, Lambda))
src/pymatgen/electronic_structure/boltztrap.py:2302: in seebeck_eff_mass_from_seebeck_carr
    eta = eta_from_seebeck(seeb, Lambda)
src/pymatgen/electronic_structure/boltztrap.py:2277: in eta_from_seebeck
    out = fsolve(lambda x: (seebeck_spb(x, Lambda) - abs(seeb)) ** 2, 1.0, full_output=True)
venv/lib/python3.12/site-packages/scipy/optimize/_minpack_py.py:170: in fsolve
    res = _root_hybr(_wrapped_func, x0, args, jac=fprime, **options)
venv/lib/python3.12/site-packages/scipy/optimize/_minpack_py.py:238: in _root_hybr
    shape, dtype = _check_func('fsolve', 'func', func, x0, args, n, (n,))
venv/lib/python3.12/site-packages/scipy/optimize/_minpack_py.py:23: in _check_func
    res = atleast_1d(thefunc(*((x0[:numinputs],) + args)))
venv/lib/python3.12/site-packages/scipy/optimize/_minpack_py.py:158: in _wrapped_func
    return func(*fargs)
src/pymatgen/electronic_structure/boltztrap.py:2277: in <lambda>
    out = fsolve(lambda x: (seebeck_spb(x, Lambda) - abs(seeb)) ** 2, 1.0, full_output=True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

eta = array([1.]), Lambda = 0.5

    def seebeck_spb(eta, Lambda=0.5):
        """Seebeck analytic formula in the single parabolic model."""
        try:
            from fdint import fdk
        except ImportError:
>           raise BoltztrapError(
                "fdint module not found. Please, install it.\nIt is needed to calculate Fermi integral quickly."
            )
E           pymatgen.electronic_structure.boltztrap.BoltztrapError: fdint module not found. Please, install it.
E           It is needed to calculate Fermi integral quickly.

src/pymatgen/electronic_structure/boltztrap.py:2259: BoltztrapError
__________________________________________________ TestBoltztrapPlotter.test_plot_conductivity_dop __________________________________________________

self = <electronic_structure.test_plotter.TestBoltztrapPlotter testMethod=test_plot_conductivity_dop>

    def test_plot_conductivity_dop(self):
>       ax = self.plotter.plot_conductivity_dop()

tests/electronic_structure/test_plotter.py:319: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/pymatgen/electronic_structure/plotter.py:3450: in plot_conductivity_dop
    ax.set_xticks(fontsize=25)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Axes: title={'center': 'n-type'}, xlabel='Doping concentration ($cm^{-3}$)', ylabel='conductivity $\\sigma$ (1/($\\Omega$ m))'>, args = ()
kwargs = {'fontsize': 25}

    def wrapper(self, *args, **kwargs):
>       return get_method(self)(*args, **kwargs)
E       TypeError: Axis.set_ticks() missing 1 required positional argument: 'ticks'

venv/lib/python3.12/site-packages/matplotlib/axes/_base.py:74: TypeError
__________________________________________________ TestBoltztrapPlotter.test_plot_conductivity_mu ___________________________________________________

self = <electronic_structure.test_plotter.TestBoltztrapPlotter testMethod=test_plot_conductivity_mu>

    def test_plot_conductivity_mu(self):
>       ax = self.plotter.plot_conductivity_mu()

tests/electronic_structure/test_plotter.py:326: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/pymatgen/electronic_structure/plotter.py:3025: in plot_conductivity_mu
    ax.set_xticks(fontsize=25)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Axes: xlabel='E-E$_f$ (eV)', ylabel='conductivity,\n $\\Sigma$ (1/($\\Omega$ m))'>, args = (), kwargs = {'fontsize': 25}

    def wrapper(self, *args, **kwargs):
>       return get_method(self)(*args, **kwargs)
E       TypeError: Axis.set_ticks() missing 1 required positional argument: 'ticks'

venv/lib/python3.12/site-packages/matplotlib/axes/_base.py:74: TypeError
_________________________________________________ TestBoltztrapPlotter.test_plot_conductivity_temp __________________________________________________

self = <electronic_structure.test_plotter.TestBoltztrapPlotter testMethod=test_plot_conductivity_temp>

    def test_plot_conductivity_temp(self):
>       ax = self.plotter.plot_conductivity_temp()

tests/electronic_structure/test_plotter.py:333: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/pymatgen/electronic_structure/plotter.py:3202: in plot_conductivity_temp
    ax.set_xticks(fontsize=25)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Axes: title={'center': 'n-type'}, xlabel='Temperature (K)', ylabel='conductivity $\\sigma$ (1/($\\Omega$ m))'>, args = ()
kwargs = {'fontsize': 25}

    def wrapper(self, *args, **kwargs):
>       return get_method(self)(*args, **kwargs)
E       TypeError: Axis.set_ticks() missing 1 required positional argument: 'ticks'

venv/lib/python3.12/site-packages/matplotlib/axes/_base.py:74: TypeError
____________________________________________________ TestBoltztrapPlotter.test_plot_eff_mass_dop ____________________________________________________

self = <electronic_structure.test_plotter.TestBoltztrapPlotter testMethod=test_plot_eff_mass_dop>

    def test_plot_eff_mass_dop(self):
>       ax = self.plotter.plot_eff_mass_dop()

tests/electronic_structure/test_plotter.py:347: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/pymatgen/electronic_structure/plotter.py:3606: in plot_eff_mass_dop
    ax.set_xticks(fontsize=25)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Axes: title={'center': 'n-type'}, xlabel='Doping concentration ($cm^{-3}$)', ylabel='Effective mass (m$_e$)'>, args = ()
kwargs = {'fontsize': 25}

    def wrapper(self, *args, **kwargs):
>       return get_method(self)(*args, **kwargs)
E       TypeError: Axis.set_ticks() missing 1 required positional argument: 'ticks'

venv/lib/python3.12/site-packages/matplotlib/axes/_base.py:74: TypeError
___________________________________________________ TestBoltztrapPlotter.test_plot_eff_mass_temp ____________________________________________________

self = <electronic_structure.test_plotter.TestBoltztrapPlotter testMethod=test_plot_eff_mass_temp>

    def test_plot_eff_mass_temp(self):
        ax = self.plotter.plot_eff_mass_temp()
>       assert len(ax.get_lines()) == 6, "wrong number of lines"
E       AssertionError: wrong number of lines

tests/electronic_structure/test_plotter.py:355: AssertionError
___________________________________________________ TestBoltztrapPlotter.test_plot_hall_carriers ____________________________________________________

self = <electronic_structure.test_plotter.TestBoltztrapPlotter testMethod=test_plot_hall_carriers>

    def test_plot_hall_carriers(self):
>       ax = self.plotter.plot_hall_carriers()

tests/electronic_structure/test_plotter.py:361: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/pymatgen/electronic_structure/plotter.py:3667: in plot_hall_carriers
    ax.set_xticks(fontsize=25)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Axes: xlabel='E-E$_f$ (eV)', ylabel='Hall carrier concentration (cm-3)'>, args = (), kwargs = {'fontsize': 25}

    def wrapper(self, *args, **kwargs):
>       return get_method(self)(*args, **kwargs)
E       TypeError: Axis.set_ticks() missing 1 required positional argument: 'ticks'

venv/lib/python3.12/site-packages/matplotlib/axes/_base.py:74: TypeError
__________________________________________________ TestBoltztrapPlotter.test_plot_power_factor_dop __________________________________________________

self = <electronic_structure.test_plotter.TestBoltztrapPlotter testMethod=test_plot_power_factor_dop>

    def test_plot_power_factor_dop(self):
>       ax = self.plotter.plot_power_factor_dop()

tests/electronic_structure/test_plotter.py:368: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/pymatgen/electronic_structure/plotter.py:3498: in plot_power_factor_dop
    ax.set_xticks(fontsize=25)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Axes: title={'center': 'n-type'}, xlabel='Doping concentration ($cm^{-3}$)', ylabel='Power Factor  ($\\mu$W/(mK$^2$))'>, args = ()
kwargs = {'fontsize': 25}

    def wrapper(self, *args, **kwargs):
>       return get_method(self)(*args, **kwargs)
E       TypeError: Axis.set_ticks() missing 1 required positional argument: 'ticks'

venv/lib/python3.12/site-packages/matplotlib/axes/_base.py:74: TypeError
__________________________________________________ TestBoltztrapPlotter.test_plot_power_factor_mu ___________________________________________________

self = <electronic_structure.test_plotter.TestBoltztrapPlotter testMethod=test_plot_power_factor_mu>

    def test_plot_power_factor_mu(self):
>       ax = self.plotter.plot_power_factor_mu()

tests/electronic_structure/test_plotter.py:375: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/pymatgen/electronic_structure/plotter.py:3064: in plot_power_factor_mu
    ax.set_xticks(fontsize=25)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Axes: xlabel='E-E$_f$ (eV)', ylabel='Power factor, ($\\mu$W/(mK$^2$))'>, args = (), kwargs = {'fontsize': 25}

    def wrapper(self, *args, **kwargs):
>       return get_method(self)(*args, **kwargs)
E       TypeError: Axis.set_ticks() missing 1 required positional argument: 'ticks'

venv/lib/python3.12/site-packages/matplotlib/axes/_base.py:74: TypeError
_________________________________________________ TestBoltztrapPlotter.test_plot_power_factor_temp __________________________________________________

self = <electronic_structure.test_plotter.TestBoltztrapPlotter testMethod=test_plot_power_factor_temp>

    def test_plot_power_factor_temp(self):
>       ax = self.plotter.plot_power_factor_temp()

tests/electronic_structure/test_plotter.py:382: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/pymatgen/electronic_structure/plotter.py:3257: in plot_power_factor_temp
    ax.set_xticks(fontsize=25)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Axes: title={'center': 'n-type'}, xlabel='Temperature (K)', ylabel='Power Factor ($\\mu$W/(mK$^2$))'>, args = (), kwargs = {'fontsize': 25}

    def wrapper(self, *args, **kwargs):
>       return get_method(self)(*args, **kwargs)
E       TypeError: Axis.set_ticks() missing 1 required positional argument: 'ticks'

venv/lib/python3.12/site-packages/matplotlib/axes/_base.py:74: TypeError
____________________________________________________ TestBoltztrapPlotter.test_plot_seebeck_dop _____________________________________________________

self = <electronic_structure.test_plotter.TestBoltztrapPlotter testMethod=test_plot_seebeck_dop>

    def test_plot_seebeck_dop(self):
>       ax = self.plotter.plot_seebeck_dop()

tests/electronic_structure/test_plotter.py:389: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/pymatgen/electronic_structure/plotter.py:3397: in plot_seebeck_dop
    ax.set_xticks(fontsize=25)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Axes: title={'center': 'n-type'}, xlabel='Doping concentration (cm$^{-3}$)', ylabel='Seebeck coefficient ($\\mu$V/K)'>, args = ()
kwargs = {'fontsize': 25}

    def wrapper(self, *args, **kwargs):
>       return get_method(self)(*args, **kwargs)
E       TypeError: Axis.set_ticks() missing 1 required positional argument: 'ticks'

venv/lib/python3.12/site-packages/matplotlib/axes/_base.py:74: TypeError
________________________________________________ TestBoltztrapPlotter.test_plot_seebeck_eff_mass_mu _________________________________________________

eta = array([1.]), Lambda = 0.5

    def seebeck_spb(eta, Lambda=0.5):
        """Seebeck analytic formula in the single parabolic model."""
        try:
>           from fdint import fdk
E           ModuleNotFoundError: No module named 'fdint'

src/pymatgen/electronic_structure/boltztrap.py:2257: ModuleNotFoundError

During handling of the above exception, another exception occurred:

self = <electronic_structure.test_plotter.TestBoltztrapPlotter testMethod=test_plot_seebeck_eff_mass_mu>

    def test_plot_seebeck_eff_mass_mu(self):
>       ax = self.plotter.plot_seebeck_eff_mass_mu()

tests/electronic_structure/test_plotter.py:396: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/pymatgen/electronic_structure/plotter.py:2864: in plot_seebeck_eff_mass_mu
    sbk_mass = self._bz.get_seebeck_eff_mass(output=output, temp=temp, Lambda=0.5)
src/pymatgen/electronic_structure/boltztrap.py:1345: in get_seebeck_eff_mass
    sbk_mass.append(seebeck_eff_mass_from_seebeck_carr(abs(seebeck[idx]), concen, temp, Lambda))
src/pymatgen/electronic_structure/boltztrap.py:2302: in seebeck_eff_mass_from_seebeck_carr
    eta = eta_from_seebeck(seeb, Lambda)
src/pymatgen/electronic_structure/boltztrap.py:2277: in eta_from_seebeck
    out = fsolve(lambda x: (seebeck_spb(x, Lambda) - abs(seeb)) ** 2, 1.0, full_output=True)
venv/lib/python3.12/site-packages/scipy/optimize/_minpack_py.py:170: in fsolve
    res = _root_hybr(_wrapped_func, x0, args, jac=fprime, **options)
venv/lib/python3.12/site-packages/scipy/optimize/_minpack_py.py:238: in _root_hybr
    shape, dtype = _check_func('fsolve', 'func', func, x0, args, n, (n,))
venv/lib/python3.12/site-packages/scipy/optimize/_minpack_py.py:23: in _check_func
    res = atleast_1d(thefunc(*((x0[:numinputs],) + args)))
venv/lib/python3.12/site-packages/scipy/optimize/_minpack_py.py:158: in _wrapped_func
    return func(*fargs)
src/pymatgen/electronic_structure/boltztrap.py:2277: in <lambda>
    out = fsolve(lambda x: (seebeck_spb(x, Lambda) - abs(seeb)) ** 2, 1.0, full_output=True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

eta = array([1.]), Lambda = 0.5

    def seebeck_spb(eta, Lambda=0.5):
        """Seebeck analytic formula in the single parabolic model."""
        try:
            from fdint import fdk
        except ImportError:
>           raise BoltztrapError(
                "fdint module not found. Please, install it.\nIt is needed to calculate Fermi integral quickly."
            )
E           pymatgen.electronic_structure.boltztrap.BoltztrapError: fdint module not found. Please, install it.
E           It is needed to calculate Fermi integral quickly.

src/pymatgen/electronic_structure/boltztrap.py:2259: BoltztrapError
_____________________________________________________ TestBoltztrapPlotter.test_plot_seebeck_mu _____________________________________________________

self = <electronic_structure.test_plotter.TestBoltztrapPlotter testMethod=test_plot_seebeck_mu>

    def test_plot_seebeck_mu(self):
>       ax = self.plotter.plot_seebeck_mu()

tests/electronic_structure/test_plotter.py:403: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/pymatgen/electronic_structure/plotter.py:2987: in plot_seebeck_mu
    ax.set_xticks(fontsize=25)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Axes: xlabel='E-E$_f$ (eV)', ylabel='Seebeck \n coefficient  ($\\mu$V/K)'>, args = (), kwargs = {'fontsize': 25}

    def wrapper(self, *args, **kwargs):
>       return get_method(self)(*args, **kwargs)
E       TypeError: Axis.set_ticks() missing 1 required positional argument: 'ticks'

venv/lib/python3.12/site-packages/matplotlib/axes/_base.py:74: TypeError
____________________________________________________ TestBoltztrapPlotter.test_plot_seebeck_temp ____________________________________________________

self = <electronic_structure.test_plotter.TestBoltztrapPlotter testMethod=test_plot_seebeck_temp>

    def test_plot_seebeck_temp(self):
>       ax = self.plotter.plot_seebeck_temp()

tests/electronic_structure/test_plotter.py:410: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/pymatgen/electronic_structure/plotter.py:3148: in plot_seebeck_temp
    ax.set_xticks(fontsize=25)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Axes: title={'center': 'n-type'}, xlabel='Temperature (K)', ylabel='Seebeck \n coefficient  ($\\mu$V/K)'>, args = ()
kwargs = {'fontsize': 25}

    def wrapper(self, *args, **kwargs):
>       return get_method(self)(*args, **kwargs)
E       TypeError: Axis.set_ticks() missing 1 required positional argument: 'ticks'

venv/lib/python3.12/site-packages/matplotlib/axes/_base.py:74: TypeError
_______________________________________________________ TestBoltztrapPlotter.test_plot_zt_dop _______________________________________________________

self = <electronic_structure.test_plotter.TestBoltztrapPlotter testMethod=test_plot_zt_dop>

    def test_plot_zt_dop(self):
>       ax = self.plotter.plot_zt_dop()

tests/electronic_structure/test_plotter.py:417: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/pymatgen/electronic_structure/plotter.py:3552: in plot_zt_dop
    ax.set_xticks(fontsize=25)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Axes: title={'center': 'n-type'}, xlabel='Doping concentration ($cm^{-3}$)', ylabel='zT'>, args = (), kwargs = {'fontsize': 25}

    def wrapper(self, *args, **kwargs):
>       return get_method(self)(*args, **kwargs)
E       TypeError: Axis.set_ticks() missing 1 required positional argument: 'ticks'

venv/lib/python3.12/site-packages/matplotlib/axes/_base.py:74: TypeError
_______________________________________________________ TestBoltztrapPlotter.test_plot_zt_mu ________________________________________________________

self = <electronic_structure.test_plotter.TestBoltztrapPlotter testMethod=test_plot_zt_mu>

    def test_plot_zt_mu(self):
>       ax = self.plotter.plot_zt_mu()

tests/electronic_structure/test_plotter.py:424: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/pymatgen/electronic_structure/plotter.py:3101: in plot_zt_mu
    ax.set_xticks(fontsize=25)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Axes: xlabel='E-E$_f$ (eV)', ylabel='ZT'>, args = (), kwargs = {'fontsize': 25}

    def wrapper(self, *args, **kwargs):
>       return get_method(self)(*args, **kwargs)
E       TypeError: Axis.set_ticks() missing 1 required positional argument: 'ticks'

venv/lib/python3.12/site-packages/matplotlib/axes/_base.py:74: TypeError
______________________________________________________ TestBoltztrapPlotter.test_plot_zt_temp _______________________________________________________

self = <electronic_structure.test_plotter.TestBoltztrapPlotter testMethod=test_plot_zt_temp>

    def test_plot_zt_temp(self):
>       ax = self.plotter.plot_zt_temp()

tests/electronic_structure/test_plotter.py:431: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/pymatgen/electronic_structure/plotter.py:3311: in plot_zt_temp
    ax.set_xticks(fontsize=25)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Axes: title={'center': 'n-type'}, xlabel='Temperature (K)', ylabel='zT'>, args = (), kwargs = {'fontsize': 25}

    def wrapper(self, *args, **kwargs):
>       return get_method(self)(*args, **kwargs)
E       TypeError: Axis.set_ticks() missing 1 required positional argument: 'ticks'

venv/lib/python3.12/site-packages/matplotlib/axes/_base.py:74: TypeError
=============================================================== slowest 30 durations ================================================================
10.97s call     tests/electronic_structure/test_plotter.py::TestBSPlotterProjected::test_methods
4.33s call     tests/electronic_structure/test_plotter.py::TestBoltztrapPlotter::test_plot_conductivity_mu
2.23s call     tests/electronic_structure/test_plotter.py::TestBSDOSPlotter::test_methods
2.18s call     tests/electronic_structure/test_plotter.py::TestBSPlotter::test_get_plot
0.61s call     tests/electronic_structure/test_plotter.py::TestBoltztrapPlotter::test_plot_zt_mu
0.57s call     tests/electronic_structure/test_plotter.py::TestBSPlotter::test_add_bs
0.56s call     tests/electronic_structure/test_plotter.py::TestBSPlotter::test_get_ticks
0.54s call     tests/electronic_structure/test_plotter.py::TestBoltztrapPlotter::test_plot_hall_carriers
0.53s call     tests/electronic_structure/test_plotter.py::TestBoltztrapPlotter::test_plot_eff_mass_temp
0.52s call     tests/electronic_structure/test_plotter.py::TestBoltztrapPlotter::test_plot_power_factor_mu
0.52s call     tests/electronic_structure/test_plotter.py::TestBoltztrapPlotter::test_plot_seebeck_eff_mass_mu
0.51s call     tests/electronic_structure/test_plotter.py::TestBSPlotter::test_bs_plot_data
0.51s call     tests/electronic_structure/test_plotter.py::TestBoltztrapPlotter::test_plot_zt_dop
0.51s call     tests/electronic_structure/test_plotter.py::TestBoltztrapPlotter::test_plot_zt_temp
0.50s call     tests/electronic_structure/test_plotter.py::TestBoltztrapPlotter::test_plot_seebeck_mu
0.50s call     tests/electronic_structure/test_plotter.py::TestBSPlotter::test_get_branch_steps
0.49s call     tests/electronic_structure/test_plotter.py::TestBSPlotter::test_rescale_distances
0.48s call     tests/electronic_structure/test_plotter.py::TestBSPlotter::test_interpolate_bands
0.47s call     tests/electronic_structure/test_plotter.py::TestBoltztrapPlotter::test_plot_power_factor_temp
0.46s call     tests/electronic_structure/test_plotter.py::TestBoltztrapPlotter::test_plot_seebeck_dop
0.45s call     tests/electronic_structure/test_plotter.py::TestBoltztrapPlotter::test_plot_seebeck_temp
0.45s call     tests/electronic_structure/test_plotter.py::TestBoltztrapPlotter::test_plot_power_factor_dop
0.45s call     tests/electronic_structure/test_plotter.py::TestBoltztrapPlotter::test_plot_conductivity_temp
0.44s call     tests/electronic_structure/test_plotter.py::TestBoltztrapPlotter::test_plot_dos
0.42s call     tests/electronic_structure/test_plotter.py::TestBoltztrapPlotter::test_plot_eff_mass_dop
0.34s call     tests/electronic_structure/test_plotter.py::TestDosPlotter::test_get_plot_limits
0.33s call     tests/electronic_structure/test_plotter.py::TestBoltztrapPlotter::test_plot_complexity_factor_mu
0.32s call     tests/electronic_structure/test_plotter.py::TestBoltztrapPlotter::test_plot_conductivity_dop
0.32s call     tests/electronic_structure/test_plotter.py::TestBoltztrapPlotter::test_plot_carriers
0.28s call     tests/electronic_structure/test_plotter.py::TestDosPlotter::test_get_plot
19 failed, 20 passed in 34.70s

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for checking, i suspected the same! the only good news is the fix shouldn't require much code changes...

@DanielYang59

This comment was marked as resolved.

@DanielYang59 DanielYang59 changed the title Install more optional dependencies in CI Install optional boltztrap and vampire in CI Aug 13, 2024
@janosh janosh added ci Continuous integration help wanted Help wanted labels Aug 22, 2024
.github/workflows/test.yml Outdated Show resolved Hide resolved
@@ -317,7 +317,7 @@ def test_plot_complexity_factor_mu(self):

def test_plot_conductivity_dop(self):
ax = self.plotter.plot_conductivity_dop()
assert len(ax.get_lines()) == 8, "wrong number of lines"
assert len(ax.get_lines()) == 16, f"wrong number of lines, got {len(ax.get_lines())}"
Copy link
Member

@janosh janosh Aug 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's definitely something broken here but probably older and not caused by you. just tried running plot_seebeck_dop. looks like the lines aren't applied to the right axes

plot_seebeck_dop

@DanielYang59
Copy link
Contributor Author

@janosh I decide to separate the BoltztrapPlotter issue (it's not broken by this PR), and all changed made on BoltztrapPlotter in this PR has been reverted. It would take some effort to manually inspect the generated plot, instead of relying on passing of unit test.

@janosh janosh removed the help wanted Help wanted label Sep 6, 2024
Copy link
Member

@janosh janosh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks so much for this PR @DanielYang59! anything that increases coverage is super useful! 👍

one minor nitpick

@@ -110,6 +111,7 @@ def test_get_all_functional_groups(self):
assert len(all_func) == (len(link) + len(basics))
assert sorted(all_func) == sorted(link + basics)

@pytest.mark.skipif(os.name == "nt", reason="Tests for openbabel failing on Win")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think sys.platform == 'windows' is more readable and seems to be generally preferred to os.name

Copy link
Contributor Author

@DanielYang59 DanielYang59 Sep 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonderful! Would do that.

I'm sure it's a typo, sys.platform should return win32, and platform.system() would return Windows

Perhaps just use platform.system() because sys.platform also returns win32 in 64-bit machines, which is a bit misleading.

Side note, just looked into the source code, and it turns out platform.system() is "almost" an alias to os.uname (when there is uname recording):

def uname():

    """ Fairly portable uname interface. Returns a tuple
        of strings (system, node, release, version, machine, processor)
        identifying the underlying platform.

        Note that unlike the os.uname function this also returns
        possible processor information as an additional tuple entry.

        Entries which cannot be determined are set to ''.

    """
    global _uname_cache

    if _uname_cache is not None:
        return _uname_cache

    # Get some infos from the builtin os.uname API...
    try:
        system, node, release, version, machine = infos = os.uname()
    except AttributeError:
        system = sys.platform
        node = _node()
        release = version = machine = ''
        infos = ()

    if not any(infos):
        # uname is not available

        # Try win32_ver() on win32 platforms
        if system == 'win32':
            release, version, csd, ptype = win32_ver()
            machine = machine or _get_machine_win32()

        # Try the 'ver' system command available on some
        # platforms
        if not (release and version):
            system, release, version = _syscmd_ver(system)
            # Normalize system to what win32_ver() normally returns
            # (_syscmd_ver() tends to return the vendor name as well)
            if system == 'Microsoft Windows':
                system = 'Windows'
            elif system == 'Microsoft' and release == 'Windows':
                # Under Windows Vista and Windows Server 2008,
                # Microsoft changed the output of the ver command. The
                # release is no longer printed.  This causes the
                # system and release to be misidentified.
                system = 'Windows'
                if '6.0' == version[:3]:
                    release = 'Vista'
                else:
                    release = ''

        # In case we still don't know anything useful, we'll try to
        # help ourselves
        if system in ('win32', 'win16'):
            if not version:
                if system == 'win32':
                    version = '32bit'
                else:
                    version = '16bit'
            system = 'Windows'

        elif system[:4] == 'java':
            release, vendor, vminfo, osinfo = java_ver()
            system = 'Java'
            version = ', '.join(vminfo)
            if not version:
                version = vendor

    # System specific extensions
    if system == 'OpenVMS':
        # OpenVMS seems to have release and version mixed up
        if not release or release == '0':
            release = version
            version = ''

    #  normalize name
    if system == 'Microsoft' and release == 'Windows':
        system = 'Windows'
        release = 'Vista'

    vals = system, node, release, version, machine
    # Replace 'unknown' values with the more portable ''
    _uname_cache = uname_result(*map(_unknown_as_blank, vals))
    return _uname_cache

Copy link
Member

@janosh janosh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great work @DanielYang59! 👍 🧪

@janosh janosh merged commit 5e208f4 into materialsproject:master Sep 6, 2024
43 checks passed
@DanielYang59 DanielYang59 deleted the install-more-opt-ci-deps branch September 6, 2024 13:04
@DanielYang59
Copy link
Contributor Author

Thanks for reviewing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Continuous integration dependencies Dependency issues and PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants