Skip to content

Commit

Permalink
Merge pull request #1531 from pyiron/dependabot/pip/pyiron-base-0.10.0
Browse files Browse the repository at this point in the history
Bump pyiron-base from 0.9.12 to 0.10.0
  • Loading branch information
jan-janssen authored Aug 24, 2024
2 parents 03d6153 + 29ce793 commit e906a41
Show file tree
Hide file tree
Showing 16 changed files with 89 additions and 96 deletions.
2 changes: 1 addition & 1 deletion .ci_support/environment-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencies:
- pandas =2.2.2
- phonopy =2.26.6
- pint =0.24.3
- pyiron_base =0.9.12
- pyiron_base =0.10.0
- pyiron_snippets =0.1.4
- pylammpsmpi =0.2.23
- pyscal3 =3.2.7
Expand Down
2 changes: 1 addition & 1 deletion .ci_support/environment-old.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies:
- pandas =2.0.3
- phonopy =2.20.0
- pint =0.18
- pyiron_base =0.9.12
- pyiron_base =0.10.0
- pyiron_snippets =0.1.3
- pylammpsmpi =0.2.18
- pyscal3 =3.2.5
Expand Down
2 changes: 1 addition & 1 deletion .ci_support/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dependencies:
- pandas =2.2.2
- phonopy =2.26.6
- pint =0.24.3
- pyiron_base =0.9.12
- pyiron_base =0.10.0
- pyiron_snippets =0.1.4
- pylammpsmpi =0.2.23
- pyscal3 =3.2.7
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unittests_old.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v2
with:
python-version: '3.9'
python-version: '3.10'
miniforge-variant: Mambaforge
channels: conda-forge
channel-priority: strict
Expand Down
2 changes: 1 addition & 1 deletion binder/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies:
- pandas =2.2.2
- phonopy =2.26.6
- pint =0.24.3
- pyiron_base =0.9.12
- pyiron_base =0.10.0
- pyiron_snippets =0.1.4
- pylammpsmpi =0.2.23
- pyscal3 =3.2.7
Expand Down
16 changes: 7 additions & 9 deletions pyiron_atomistics/atomistics/job/atomistic.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,9 @@ def calc_md(
self._generic_input["time_step"] = int(time_step)
self._generic_input.remove_keys(["max_iter"])

def from_dict(self, job_dict):
super().from_dict(job_dict=job_dict)
self._generic_input.from_dict(obj_dict=job_dict["input"]["generic"])
def from_dict(self, obj_dict):
super().from_dict(obj_dict=obj_dict)
self._generic_input.from_dict(obj_dict=obj_dict["input"]["generic"])

def to_dict(self):
job_dict = super(AtomisticGenericJob, self).to_dict()
Expand Down Expand Up @@ -818,14 +818,12 @@ def _structure_to_dict(self):
else:
return None

def _structure_from_dict(self, job_dict):
def _structure_from_dict(self, obj_dict):
if (
"structure" in job_dict["input"].keys()
"structure" in obj_dict["input"].keys()
and self._generic_input["structure"] == "atoms"
):
self.structure = Atoms().from_dict(
atoms_dict=job_dict["input"]["structure"]
)
self.structure = Atoms().from_dict(obj_dict=obj_dict["input"]["structure"])

def _structure_to_hdf(self):
data_dict = self._structure_to_dict()
Expand All @@ -840,7 +838,7 @@ def _structure_from_hdf(self):
):
with self.project_hdf5.open("input/structure") as hdf5_input:
self.structure = Atoms().from_dict(
hdf5_input.read_dict_from_hdf(recursive=True)
obj_dict=hdf5_input.read_dict_from_hdf(recursive=True)
)

def _write_chemical_formular_to_database(self):
Expand Down
63 changes: 30 additions & 33 deletions pyiron_atomistics/atomistics/structure/atoms.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,46 +500,43 @@ def to_dict(self):
hdf_structure["calculator"] = calc_dict
return hdf_structure

def from_dict(self, atoms_dict):
if "new_species" in atoms_dict.keys():
self._pse.from_dict(pse_dict=atoms_dict["new_species"])
def from_dict(self, obj_dict):
if "new_species" in obj_dict.keys():
self._pse.from_dict(obj_dict=obj_dict["new_species"])

el_object_list = [
self.convert_element(el, self._pse) for el in atoms_dict["species"]
self.convert_element(el, self._pse) for el in obj_dict["species"]
]
self.arrays["indices"] = atoms_dict["indices"]
self.arrays["indices"] = obj_dict["indices"]

self.set_species(el_object_list)
self.bonds = None

tr_dict = {1: True, 0: False}
self.dimension = atoms_dict["dimension"]
self.units = atoms_dict["units"]
self.dimension = obj_dict["dimension"]
self.units = obj_dict["units"]

if "cell" in atoms_dict.keys():
self.cell = atoms_dict["cell"]["cell"]
self.pbc = atoms_dict["cell"]["pbc"]
if "cell" in obj_dict.keys():
self.cell = obj_dict["cell"]["cell"]
self.pbc = obj_dict["cell"]["pbc"]

# Backward compatibility
position_tag = "positions"
if position_tag not in atoms_dict.keys():
if position_tag not in obj_dict.keys():
position_tag = "coordinates"
self.arrays["positions"] = atoms_dict[position_tag]
if (
"is_absolute" in atoms_dict.keys()
and not tr_dict[atoms_dict["is_absolute"]]
):
self.arrays["positions"] = obj_dict[position_tag]
if "is_absolute" in obj_dict.keys() and not tr_dict[obj_dict["is_absolute"]]:
self.set_scaled_positions(self.arrays["positions"])

self.arrays["numbers"] = self.get_atomic_numbers()

if "explicit_bonds" in atoms_dict.keys():
if "explicit_bonds" in obj_dict.keys():
# print "bonds: "
self.bonds = atoms_dict["explicit_bonds"]
if "spins" in atoms_dict.keys():
self.spins = atoms_dict["spins"]
if "tags" in atoms_dict.keys():
tags_dict = atoms_dict["tags"]
self.bonds = obj_dict["explicit_bonds"]
if "spins" in obj_dict.keys():
self.spins = obj_dict["spins"]
if "tags" in obj_dict.keys():
tags_dict = obj_dict["tags"]
for tag, tag_item in tags_dict.items():
if tag in ["initial_magmoms"]:
continue
Expand All @@ -550,20 +547,20 @@ def from_dict(self, atoms_dict):
raise NotImplementedError()
self.set_array(tag, np.asarray(my_list))

if "bonds" in atoms_dict.keys():
self.bonds = atoms_dict["explicit_bonds"]
if "bonds" in obj_dict.keys():
self.bonds = obj_dict["explicit_bonds"]

self._high_symmetry_points = None
if "high_symmetry_points" in atoms_dict.keys():
self._high_symmetry_points = atoms_dict["high_symmetry_points"]
if "high_symmetry_points" in obj_dict.keys():
self._high_symmetry_points = obj_dict["high_symmetry_points"]

self._high_symmetry_path = None
if "high_symmetry_path" in atoms_dict.keys():
self._high_symmetry_path = atoms_dict["high_symmetry_path"]
if "info" in atoms_dict.keys():
self.info = atoms_dict["info"]
if "calculator" in atoms_dict.keys():
calc_dict = atoms_dict["calculator"]
if "high_symmetry_path" in obj_dict.keys():
self._high_symmetry_path = obj_dict["high_symmetry_path"]
if "info" in obj_dict.keys():
self.info = obj_dict["info"]
if "calculator" in obj_dict.keys():
calc_dict = obj_dict["calculator"]
class_path = calc_dict.pop("class")
calc_module = importlib.import_module(".".join(class_path.split(".")[:-1]))
calc_class = getattr(calc_module, class_path.split(".")[-1])
Expand Down Expand Up @@ -595,7 +592,7 @@ def from_hdf(self, hdf, group_name="structure"):
"""
return self.from_dict(
atoms_dict=hdf.open(group_name).read_dict_from_hdf(recursive=True)
obj_dict=hdf.open(group_name).read_dict_from_hdf(recursive=True)
)

def select_index(self, el):
Expand Down
20 changes: 10 additions & 10 deletions pyiron_atomistics/atomistics/structure/periodic_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,11 @@ def to_dict(self):
hdf_el.update({"tagData/" + key: self.tags[key] for key in self.tags.keys()})
return hdf_el

def from_dict(self, element_dict):
def from_dict(self, obj_dict):
pse = PeriodicTable()
elname = self.sub.name
if "elementData" in element_dict.keys():
element_data = element_dict["elementData"]
if "elementData" in obj_dict.keys():
element_data = obj_dict["elementData"]
for key, val in zip(element_data["Parameter"], element_data["Value"]):
if key in "Parent":
self.sub = pse.dataframe.loc[val]
Expand All @@ -291,8 +291,8 @@ def from_dict(self, element_dict):
self.sub["Parent"] = None
self._element_str = elname
self.sub.name = elname
if "tagData" in element_dict.keys():
self.sub["tags"] = element_dict["tagData"]
if "tagData" in obj_dict.keys():
self.sub["tags"] = obj_dict["tagData"]

def to_hdf(self, hdf):
"""
Expand All @@ -312,7 +312,7 @@ def from_hdf(self, hdf):
"""
elname = self.sub.name
with hdf.open(elname) as hdf_el:
self.from_dict(hdf_el.read_dict_from_hdf(recursive=True))
self.from_dict(obj_dict=hdf_el.read_dict_from_hdf(recursive=True))


class PeriodicTable:
Expand Down Expand Up @@ -356,12 +356,12 @@ def __getstate__(self):
# https://docs.python.org/release/3.11.2/library/pickle.html#object.__getstate__
return self.__dict__

def from_dict(self, pse_dict):
for el, el_dict in pse_dict.items():
def from_dict(self, obj_dict):
for el, el_dict in obj_dict.items():
sub = pandas.Series(dtype=object)
new_element = ChemicalElement(sub)
new_element.sub.name = el
new_element.from_dict(element_dict=el_dict)
new_element.from_dict(obj_dict=el_dict)
new_element.sub["Abbreviation"] = el

if "sub_tags" in new_element.tags:
Expand Down Expand Up @@ -399,7 +399,7 @@ def from_hdf(self, hdf):
Returns:
"""
self.from_dict(hdf.read_dict_from_hdf(recursive=True))
self.from_dict(obj_dict=hdf.read_dict_from_hdf(recursive=True))

def element(self, arg, **qwargs):
"""
Expand Down
20 changes: 10 additions & 10 deletions pyiron_atomistics/lammps/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,10 +696,10 @@ def to_dict(self):
data_dict.update({"input/" + k: v for k, v in lammps_dict.items()})
return data_dict

def from_dict(self, job_dict):
super().from_dict(job_dict=job_dict)
self._structure_from_dict(job_dict=job_dict)
self.input.from_dict(data_dict=job_dict["input"])
def from_dict(self, obj_dict):
super().from_dict(obj_dict=obj_dict)
self._structure_from_dict(obj_dict=obj_dict)
self.input.from_dict(obj_dict=obj_dict["input"])

def write_restart_file(self, filename="restart.out"):
"""
Expand Down Expand Up @@ -1034,11 +1034,11 @@ def _load_default_bond_params(self):
self.bond_dict["O"]["bond_type_list"] = [1]
self.bond_dict["O"]["angle_type_list"] = [1]

def from_dict(self, data_dict):
self.control.from_dict(data_dict[self.control.table_name])
self.potential.from_dict(data_dict[self.potential.table_name])
if "bond_dict" in data_dict.keys():
self.bond_dict = data_dict["bond_dict"]
def from_dict(self, obj_dict):
self.control.from_dict(obj_dict=obj_dict[self.control.table_name])
self.potential.from_dict(obj_dict=obj_dict[self.potential.table_name])
if "bond_dict" in obj_dict.keys():
self.bond_dict = obj_dict["bond_dict"]

def to_dict(self):
return {
Expand All @@ -1065,7 +1065,7 @@ def from_hdf(self, hdf5):
Returns:
"""
with hdf5.open("input") as hdf_input:
self.from_dict(data_dict=hdf_input.read_dict_from_hdf(recursive=True))
self.from_dict(obj_dict=hdf_input.read_dict_from_hdf(recursive=True))


def resolve_hierachical_dict(data_dict, group_name=""):
Expand Down
2 changes: 1 addition & 1 deletion pyiron_atomistics/lammps/lammps.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def lammps_function(
job.cutoff_radius = cutoff_radius
server_dict = job.server.to_dict()
server_dict.update(server_kwargs)
job.server.from_dict(server_dict=server_dict)
job.server.from_dict(obj_dict=server_dict)
job.units = units
if calc_mode == "static":
job.calc_static()
Expand Down
26 changes: 12 additions & 14 deletions pyiron_atomistics/vasp/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -738,14 +738,12 @@ def to_dict(self):
job_dict["input/potential_dict"] = self._potential.to_dict()
return job_dict

def from_dict(self, job_dict):
super().from_dict(job_dict=job_dict)
self._structure_from_dict(job_dict=job_dict)
self.input.from_dict(input_dict=job_dict["input"])
if "potential_dict" in job_dict["input"].keys():
self._potential.from_dict(
potential_dict=job_dict["input"]["potential_dict"]
)
def from_dict(self, obj_dict):
super().from_dict(obj_dict=obj_dict)
self._structure_from_dict(obj_dict=obj_dict)
self.input.from_dict(obj_dict=obj_dict["input"])
if "potential_dict" in obj_dict["input"].keys():
self._potential.from_dict(obj_dict=obj_dict["input"]["potential_dict"])

def to_hdf(self, hdf=None, group_name=None):
"""
Expand Down Expand Up @@ -1953,13 +1951,13 @@ def to_dict(self):
input_dict.update({"potcar/" + k: v for k, v in self.potcar.to_dict().items()})
return input_dict

def from_dict(self, input_dict):
self.incar.from_dict(obj_dict=input_dict["incar"])
self.kpoints.from_dict(obj_dict=input_dict["kpoints"])
self.potcar.from_dict(obj_dict=input_dict["potcar"])
def from_dict(self, obj_dict):
self.incar.from_dict(obj_dict=obj_dict["incar"])
self.kpoints.from_dict(obj_dict=obj_dict["kpoints"])
self.potcar.from_dict(obj_dict=obj_dict["potcar"])
self._eddrmm = "ignore"
if "vasp_dict" in input_dict.keys():
vasp_dict = input_dict["vasp_dict"]
if "vasp_dict" in obj_dict.keys():
vasp_dict = obj_dict["vasp_dict"]
if "eddrmm_handling" in vasp_dict.keys():
self._eddrmm = self._eddrmm_backwards_compatibility(
vasp_dict["eddrmm_handling"]
Expand Down
4 changes: 2 additions & 2 deletions pyiron_atomistics/vasp/potential.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ def __setattr__(self, key, value):
def to_dict(self):
return self._potential_dict

def from_dict(self, potential_dict):
for key, value in potential_dict.items():
def from_dict(self, obj_dict):
for key, value in obj_dict.items():
self._potential_dict[key] = value

def __repr__(self):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ dependencies = [
"pandas==2.2.2",
"phonopy==2.26.6",
"pint==0.24.3",
"pyiron_base==0.9.12",
"pyiron_base==0.10.0",
"pyiron_snippets==0.1.4",
"pylammpsmpi==0.2.23",
"pyscal3==3.2.7",
Expand Down
2 changes: 1 addition & 1 deletion tests/atomic/job/test_atomistic.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def test_get_structure(self):
cwd,
)
shutil.copy(os.path.join(tests_loc, "static/lammps_test_files/export.csv"), cwd)
self.project.unpack("get_structure_test")
self.project.unpack("get_structure_test.tar.gz")
job = self.project.load("inter_calculator")
os.unlink("export.csv")
os.unlink("get_structure_test.tar.gz")
Expand Down
2 changes: 1 addition & 1 deletion tests/atomic/job/test_transform_trajectory.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_transform_trajectory(self):
cwd,
)
shutil.copy(os.path.join(tests_loc, "static/lammps_test_files/export.csv"), cwd)
self.project.unpack("get_structure_test")
self.project.unpack("get_structure_test.tar.gz")
traj = self.job.trajectory()
self.assertIsInstance(traj, Trajectory)
self.assertEqual(len(traj), len(self.job.output.positions))
Expand Down
Loading

0 comments on commit e906a41

Please sign in to comment.