File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 11
11
from emmet .core .openff import MoleculeSpec
12
12
from pymatgen .core import Element , Molecule
13
13
from pymatgen .io .openff import create_openff_mol
14
- from scipy .units import Avogadro
14
+ from scipy .constants import Avogadro
15
15
16
16
if TYPE_CHECKING :
17
17
import pathlib
18
18
19
+ DEFAULT_ATOMIC_MASSES = {el .Z : el .atomic_mass for el in Element }
20
+
19
21
20
22
def create_mol_spec (
21
23
smiles : str ,
@@ -191,7 +193,7 @@ def calculate_elyte_composition(
191
193
}
192
194
193
195
# Calculate the molecular weights of the solvent
194
- atomic_masses = atomic_masses or { el . Z : el . atomic_mass for el in Element }
196
+ atomic_masses = atomic_masses or DEFAULT_ATOMIC_MASSES
195
197
salt_mws = {}
196
198
for smile in salts :
197
199
mol = tk .Molecule .from_smiles (smile , allow_undefined_stereo = True )
@@ -232,7 +234,7 @@ def counts_from_masses(
232
234
numpy.ndarray
233
235
n_mols: Number of each SMILES needed for the given mass ratio.
234
236
"""
235
- atomic_masses = atomic_masses or { el . Z : el . atomic_mass for el in Element }
237
+ atomic_masses = atomic_masses or DEFAULT_ATOMIC_MASSES
236
238
237
239
mol_weights = []
238
240
for smile in species :
@@ -272,7 +274,7 @@ def counts_from_box_size(
272
274
dict of str, float
273
275
Number of each species needed to fill the box with the given density.
274
276
"""
275
- atomic_masses = atomic_masses or { el . Z : el . atomic_mass for el in Element }
277
+ atomic_masses = atomic_masses or DEFAULT_ATOMIC_MASSES
276
278
277
279
volume = (side_length * 1e-7 ) ** 3 # Convert from nm3 to cm^3
278
280
total_mass = volume * density # grams
You can’t perform that action at this time.
0 commit comments