File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed
Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change 1414
1515import numpy as np
1616import pandas as pd
17- from mendeleev import element
17+
18+ try :
19+ from mendeleev import element
20+ except ImportError :
21+ element = None
22+ from monty .dev import requires
1823from numpy import ndarray
1924from pymatgen .core .structure import Structure
2025from pymatgen .electronic_structure .cohp import CompleteCohp
@@ -875,6 +880,10 @@ def get_summarized_coxx_df(
875880 return df
876881
877882
883+ @requires (
884+ element is not None ,
885+ "FeaturizeCharges requires mendeleev. Reinstall package with `pip install lobsterpy[featurizer]`." ,
886+ )
878887class FeaturizeCharges :
879888 """
880889 Class to compute Ionicity from CHARGE.lobster data.
Original file line number Diff line number Diff line change 99from typing import NamedTuple
1010from warnings import warn
1111
12+ try :
13+ from mendeleev import element
14+ except ImportError :
15+ element = None
16+
1217import numpy as np
13- from mendeleev import element
18+ from monty . dev import requires
1419from monty .os .path import zpath
1520
1621POSCAR_WARNING = (
@@ -130,6 +135,10 @@ def get_structure_path(lobster_path: Path) -> Path:
130135 raise Exception
131136
132137
138+ @requires (
139+ element is not None ,
140+ "get_reduced_mass requires mendeleev. Reinstall package with `pip install lobsterpy[featurizer]`." ,
141+ )
133142def get_reduced_mass (atom_pair : list [str ]) -> float :
134143 """
135144 Compute reduced mass between a pair of atoms.
@@ -143,6 +152,10 @@ def get_reduced_mass(atom_pair: list[str]) -> float:
143152 return (atom1 .atomic_weight * atom2 .atomic_weight ) / (atom1 .atomic_weight + atom2 .atomic_weight )
144153
145154
155+ @requires (
156+ element is not None ,
157+ "get_electronegativities requires mendeleev. Reinstall package with `pip install lobsterpy[featurizer]`." ,
158+ )
146159def get_electronegativities (atom_pair : list [str ]) -> list [float ]:
147160 """
148161 Get Allen electronegativities for a pair of atoms.
You can’t perform that action at this time.
0 commit comments