Skip to content

Commit f12cc42

Browse files
committed
flynt atomate (auto f-string conversion just to trigger CI run with latest pmg fixes)
1 parent f6fed94 commit f12cc42

File tree

18 files changed

+27
-52
lines changed

18 files changed

+27
-52
lines changed

atomate/lammps/firetasks/run_calc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def run_task(self, fw_spec):
9595
output_file=self.get("output_file", "packed_mol.xyz"),
9696
bin=self["packmol_cmd"],
9797
)
98-
logger.info("Running {}".format(self["packmol_cmd"]))
98+
logger.info(f"Running {self['packmol_cmd']}")
9999
packed_mol = pmr.run(site_property=self.get("site_property", None))
100100
logger.info("Packmol finished running.")
101101
return FWAction(mod_spec=[{"_set": {"packed_mol": packed_mol}}])

atomate/qchem/workflows/base/FF_and_critic.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,7 @@ def get_wf_FFopt_and_critic(
6262
# FFopt
6363
fw1 = FrequencyFlatteningOptimizeFW(
6464
molecule=molecule,
65-
name="{}:{}".format(
66-
molecule.composition.alphabetical_formula, "FFopt_" + suffix
67-
),
65+
name=f"{molecule.composition.alphabetical_formula}:{'FFopt_' + suffix}",
6866
qchem_cmd=">>qchem_cmd<<",
6967
max_cores=">>max_cores<<",
7068
qchem_input_params=qchem_input_params,
@@ -74,7 +72,7 @@ def get_wf_FFopt_and_critic(
7472

7573
# Critic
7674
fw2 = CubeAndCritic2FW(
77-
name="{}:{}".format(molecule.composition.alphabetical_formula, "CC2_" + suffix),
75+
name=f"{molecule.composition.alphabetical_formula}:{'CC2_' + suffix}",
7876
qchem_cmd=">>qchem_cmd<<",
7977
max_cores=">>max_cores<<",
8078
qchem_input_params=qchem_input_params,
@@ -83,8 +81,6 @@ def get_wf_FFopt_and_critic(
8381
)
8482
fws = [fw1, fw2]
8583

86-
wfname = "{}:{}".format(
87-
molecule.composition.alphabetical_formula, "FFopt_CC2_WF_" + suffix
88-
)
84+
wfname = f"{molecule.composition.alphabetical_formula}:{'FFopt_CC2_WF_' + suffix}"
8985

9086
return Workflow(fws, name=wfname, **kwargs)

atomate/utils/database.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,21 +145,17 @@ def insert(self, d, update_duplicates=True):
145145
{"$inc": {"c": 1}},
146146
return_document=ReturnDocument.AFTER,
147147
)["c"]
148-
logger.info(
149-
"Inserting {} with taskid = {}".format(d["dir_name"], d["task_id"])
150-
)
148+
logger.info(f"Inserting {d['dir_name']} with taskid = {d['task_id']}")
151149
elif update_duplicates:
152150
d["task_id"] = result["task_id"]
153-
logger.info(
154-
"Updating {} with taskid = {}".format(d["dir_name"], d["task_id"])
155-
)
151+
logger.info(f"Updating {d['dir_name']} with taskid = {d['task_id']}")
156152
d = jsanitize(d, allow_bson=True)
157153
self.collection.update_one(
158154
{"dir_name": d["dir_name"]}, {"$set": d}, upsert=True
159155
)
160156
return d["task_id"]
161157
else:
162-
logger.info("Skipping duplicate {}".format(d["dir_name"]))
158+
logger.info(f"Skipping duplicate {d['dir_name']}")
163159
return None
164160

165161
@abstractmethod

atomate/utils/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ def process_params(d):
273273
fws.append(cls_(structure=structure, **params))
274274

275275
wfname = (
276-
"{}:{}".format(structure.composition.reduced_formula, wfspec["name"])
276+
f"{structure.composition.reduced_formula}:{wfspec['name']}"
277277
if wfspec.get("name")
278278
else structure.composition.reduced_formula
279279
)

atomate/vasp/builders/fix_tasks.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def run(self):
2222
for t in self._tasks.find(
2323
{"output.spacegroup.number": {"$type": 2}}, {"task_id": 1, "output": 1}
2424
):
25-
logger.info("Fixing string spacegroup, tid: {}".format(t["task_id"]))
25+
logger.info(f"Fixing string spacegroup, tid: {t['task_id']}")
2626
sg = int(t["output"]["spacegroup"]["number"])
2727
self._tasks.update_one(
2828
{"task_id": t["task_id"]}, {"$set": {"output.spacegroup.number": sg}}
@@ -33,7 +33,7 @@ def run(self):
3333
{"tags": {"$exists": True}, "tags.0": {"$exists": False}},
3434
{"task_id": 1, "tags": 1},
3535
):
36-
logger.info("Fixing tag (converting to list), tid: {}".format(t["task_id"]))
36+
logger.info(f"Fixing tag (converting to list), tid: {t['task_id']}")
3737
self._tasks.update_one(
3838
{"task_id": t["task_id"]}, {"$set": {"tags": [t["tags"]]}}
3939
)
@@ -71,7 +71,7 @@ def run(self):
7171
},
7272
{"task_id": 1},
7373
):
74-
logger.info("Removing delta_volume_percent, tid: {}".format(t["task_id"]))
74+
logger.info(f"Removing delta_volume_percent, tid: {t['task_id']}")
7575
self._tasks.update_one(
7676
{"task_id": t["task_id"]},
7777
{"$unset": {"analysis.delta_volume_percent": 1}},

atomate/vasp/builders/materials_descriptor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def run(self):
3535

3636
pbar = tqdm(mats)
3737
for m in pbar:
38-
pbar.set_description("Processing materials_id: {}".format(m["material_id"]))
38+
pbar.set_description(f"Processing materials_id: {m['material_id']}")
3939
struct = Structure.from_dict(m["structure"])
4040
d = {"descriptors": {}}
4141
d["descriptors"]["dimensionality"] = get_dimensionality(struct)

atomate/vasp/builders/tags.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def run(self):
4949
pbar = tqdm(tasks)
5050
for t in pbar:
5151
try:
52-
pbar.set_description("Processing task_id: {}".format(t["task_id"]))
52+
pbar.set_description(f"Processing task_id: {t['task_id']}")
5353

5454
# get the corresponding materials id
5555
m = self._materials.find_one(
@@ -85,7 +85,7 @@ def run(self):
8585

8686
logger.exception("<---")
8787
logger.exception(
88-
"There was an error processing task_id: {}".format(t["task_id"])
88+
f"There was an error processing task_id: {t['task_id']}"
8989
)
9090
logger.exception(traceback.format_exc())
9191
logger.exception("--->")

atomate/vasp/builders/tasks_materials.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -314,15 +314,9 @@ def _update_material(self, m_id, taskdoc):
314314
# figure out where the property data lives in the materials doc and
315315
# in the task doc
316316
materials_key = (
317-
"{}.{}".format(x["materials_key"], p)
318-
if x.get("materials_key")
319-
else p
320-
)
321-
tasks_key = (
322-
"{}.{}".format(x["tasks_key"], p)
323-
if x.get("tasks_key")
324-
else p
317+
f"{x['materials_key']}.{p}" if x.get("materials_key") else p
325318
)
319+
tasks_key = f"{x['tasks_key']}.{p}" if x.get("tasks_key") else p
326320

327321
# insert property data AND metadata about this task
328322
self._materials.update_one(

atomate/vasp/database.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,7 @@ def get_band_structure(self, task_id):
337337
elif obj_dict["@class"] == "BandStructureSymmLine":
338338
return BandStructureSymmLine.from_dict(obj_dict)
339339
else:
340-
raise ValueError(
341-
"Unknown class for band structure! {}".format(obj_dict["@class"])
342-
)
340+
raise ValueError(f"Unknown class for band structure! {obj_dict['@class']}")
343341

344342
def get_dos(self, task_id):
345343
"""

atomate/vasp/drones.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -560,9 +560,7 @@ def process_vasprun(self, dir_name, taskname, filename):
560560
d[file] = data.as_dict()
561561
except Exception:
562562
raise ValueError(
563-
"Failed to parse {} at {}.".format(
564-
file, d["output_file_paths"][file]
565-
)
563+
f"Failed to parse {file} at {d['output_file_paths'][file]}."
566564
)
567565

568566
# parse force constants

0 commit comments

Comments
 (0)