Skip to content

Commit 930f352

Browse files
authored
Merge pull request #60 from pyiron/clean
[nit] More cleaning
2 parents 0491578 + 03bfa69 commit 930f352

File tree

2 files changed

+13
-33
lines changed

2 files changed

+13
-33
lines changed

pyiron_rdm/classic.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,6 @@ def upload_classic_pyiron(
323323
# --------------------------------------UPLOAD-------------------------------------------------
324324
from pyiron_rdm.ob_upload import openbis_upload_validated
325325

326-
# Structure
327326
ob_structure_id = openbis_upload_validated(
328327
o=o,
329328
space=space,
@@ -373,7 +372,6 @@ def upload_classic_pyiron(
373372

374373
link_children(o, ob_job_id, ob_children_ids)
375374

376-
# Final structure upload (already included as equilibrium for murn)
377375
elif "final_structure" in validated_to_upload:
378376
ob_final_structure_id = openbis_upload_validated(
379377
o=o,
@@ -383,6 +381,3 @@ def upload_classic_pyiron(
383381
**validated_to_upload["final_structure"],
384382
parent_ids=[ob_structure_id, ob_job_id],
385383
)
386-
387-
388-
# ---------------------------------------------------------------------------------------------

pyiron_rdm/ob_cfg_sfb1394.py

Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import ast
12
import json
23

34

@@ -252,15 +253,11 @@ def map_cdict_to_ob(user_name, cdict, concept_dict):
252253
)
253254

254255
if "kpoint_Monkhorst_Pack" in cdict.keys():
255-
kpoint_algo = "KPOINTS_MP"
256-
kpts_x = int(cdict["kpoint_Monkhorst_Pack"].split()[0])
257-
kpts_y = int(cdict["kpoint_Monkhorst_Pack"].split()[1])
258-
kpts_z = int(cdict["kpoint_Monkhorst_Pack"].split()[2])
259256
props |= {
260-
"atom_kpoint_type": kpoint_algo,
261-
"atomistic_n_kpt_x": kpts_x,
262-
"atomistic_n_kpt_y": kpts_y,
263-
"atomistic_n_kpt_z": kpts_z,
257+
"atom_kpoint_type": "KPOINTS_MP",
258+
"atomistic_n_kpt_x": int(cdict["kpoint_Monkhorst_Pack"].split()[0]),
259+
"atomistic_n_kpt_y": int(cdict["kpoint_Monkhorst_Pack"].split()[1]),
260+
"atomistic_n_kpt_z": int(cdict["kpoint_Monkhorst_Pack"].split()[2]),
264261
}
265262

266263
else:
@@ -296,14 +293,11 @@ def map_struct_to_ob(
296293
props["composition_desc"] = "ATOMIC_FRACTION"
297294
sorted_atoms = sorted_atoms[:max_num_atoms]
298295
for i, species in enumerate(sorted_atoms, 1):
299-
prop_el = f"element_{i}"
300-
prop_el_pct = f"element_{i}_at_percent"
301-
prop_el_num = f"element_{i}_number"
302-
props[prop_el] = species["label"]
303-
props[prop_el_pct] = np.round(
296+
props[f"element_{i}"] = species["label"]
297+
props[f"element_{i}_at_percent"] = np.round(
304298
species["value"] * 100 / cdict["total_number_atoms"], decimals
305299
)
306-
props[prop_el_num] = species["value"]
300+
props[f"element_{i}_number"] = species["value"]
307301

308302
if "simulation_cell_lengths" in cdict.keys():
309303
dim_list = [
@@ -361,31 +355,22 @@ def dataset_atom_struct_h5(
361355
)
362356
items = list(sorted_atoms.items())[:max_num_atoms]
363357
for i, (species, count) in enumerate(items, 1):
364-
prop_el = f"element_{i}"
365-
prop_el_pct = f"element_{i}_at_percent"
366-
prop_el_num = f"element_{i}_number"
367-
ds_props[prop_el] = species
368-
ds_props[prop_el_pct] = np.round(
358+
ds_props[f"element_{i}"] = species
359+
ds_props[f"element_{i}_at_percent"] = np.round(
369360
count * 100 / cdict["total_number_atoms"], decimals
370361
)
371-
ds_props[prop_el_num] = count
362+
ds_props[f"element_{i}_number"] = count
372363

373364
ds_props["number_of_atoms"] = cdict["total_number_atoms"]
374365
ds_props["number_of_species"] = len(sorted_atoms.keys())
375366
ds_props["list_of_species"] = ", ".join(sorted_atoms.keys())
376367
if "simulation_cell_angles" in cdict.keys():
377-
angles = [
378-
float(x) for x in cdict["simulation_cell_angles"].strip("[]").split(",")
379-
]
380368
ds_props["angle_alpha"], ds_props["angle_beta"], ds_props["angle_gamma"] = (
381-
angles
369+
ast.literal_eval(cdict["simulation_cell_angles"])
382370
)
383371
if "simulation_cell_lengths" in cdict.keys():
384-
lengths = [
385-
float(x) for x in cdict["simulation_cell_lengths"].strip("[]").split(",")
386-
]
387372
ds_props["box_length_a"], ds_props["box_length_b"], ds_props["box_length_c"] = (
388-
lengths
373+
ast.literal_eval(cdict["simulation_cell_lengths"])
389374
)
390375
if "space_group_number" in cdict.keys():
391376
ds_props["space_group"] = cdict["space_group_number"]

0 commit comments

Comments
 (0)