Skip to content

Commit 658cda0

Browse files
committed
Fix isses with circular import of pymatgen.
1 parent f51f5c6 commit 658cda0

5 files changed

Lines changed: 47 additions & 133 deletions

File tree

pymatgen-test-files

pyproject.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,10 @@ matcalc = [
102102
mlp = ["matgl>=2.0.4 ; python_version<'3.13'"]
103103
numba = ["numba>=0.55"]
104104
optional = [
105-
"pymatgen[abinit,ase,matcalc,mlp,tblite,zeopp]",
105+
"netcdf4>=1.7.2",
106+
"ase>=3.23.0",
106107
"beautifulsoup4",
107-
"pymatgen-analysis-alloys",
108+
#"pymatgen-analysis-alloys",
108109
# PR4347: BoltzTraP2 needs to bump cmake version for spglib build
109110
# "BoltzTraP2>=24.9.4",
110111
"chemview>=0.6",
@@ -114,10 +115,11 @@ optional = [
114115
"hiphive>=1.3.1",
115116
"phonopy>=2.33.3",
116117
"seekpath>=2.0.1",
118+
"tblite[ase]>=0.3.0; platform_system=='Linux' and python_version<'3.12'"
117119
]
118120
prototypes = ["pyxtal>=1.0", "pymatgen[symmetry]"]
119121
# moyopy[interface] includes ase
120-
symmetry = ["moyopy[interface]>=0.3", "spglib>=2.5"]
122+
symmetry = ["moyopy[interface]>=0.3"]
121123
# tblite only support Python 3.12+ through conda-forge
122124
# https://github.com/tblite/tblite/issues/175
123125
tblite = ["tblite[ase]>=0.3.0; platform_system=='Linux' and python_version<'3.12'"]

src/pymatgen/io/lammps/data.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,12 @@ def map_charges(q) -> str:
418418
"Dihedral Coeffs",
419419
"Improper Coeffs",
420420
]:
421-
dfs: list[pd.DataFrame] = [val.iloc[i : i + 1] for i in range(len(val.index))]
421+
# Split into one-row DataFrames (avoid np.array_split: it returns ndarrays)
422+
dfs = [val.iloc[i : i + 1] for i in range(len(val))]
422423
df_string = ""
423424
for idx, df in enumerate(dfs):
425+
if not isinstance(df, pd.DataFrame):
426+
df = pd.DataFrame(np.atleast_2d(df), columns=val.columns)
424427
if isinstance(df.iloc[0]["coeff1"], str):
425428
try:
426429
formatters = {

tests/core/test_tensors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ def test_tensor_mapping(self):
299299
assert empty[tkey] == 1
300300

301301
def test_populate(self):
302-
toec_path = TEST_FILES_DIR / "analysis" / "elasticity" / "test_toec_data.json"
302+
toec_path = TEST_FILES_DIR / "core" / "elasticity" / "test_toec_data.json"
303303
if not toec_path.exists():
304304
pytest.skip("test_toec_data.json not found (pymatgen-test-files)")
305305
test_data = loadfn(str(toec_path))

0 commit comments

Comments
 (0)