Repository: hackingmaterials/atomate (language: python)

Issue:
Pyupgrade
Changes from `pyupgrade --py37-plus **/*.py + black`.


Discussion / hints:

Fix patch:
diff --git a/.circleci/config.yml b/.circleci/config.yml
index a451c88e4..fc35ea639 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -4,7 +4,7 @@ jobs:
     working_directory: ~/atomate
     docker:
       - image: materialsvirtuallab/circle-ci-pmg-py3:3.7.3
-      - image: circleci/mongo:3.4.15
+      - image: circleci/mongo:latest
     steps:
       - checkout
       - restore_cache:
@@ -37,7 +37,7 @@ jobs:
     working_directory: ~/atomate
     docker:
       - image: materialsvirtuallab/circle-ci-pmg-py3:3.7.3
-      - image: circleci/mongo:3.4.15
+      - image: circleci/mongo:latest
     steps:
       - checkout
       - restore_cache:
@@ -56,9 +56,6 @@ jobs:
             tar -zxvf vampire-5.0-linux.tar.gz
             export PATH=/root/atomate/linux/:$PATH
             pip install --quiet -r requirements.txt -r requirements-ci.txt
-            pip install git+https://github.com/materialsproject/pymatgen.git --upgrade
-            pip install git+https://github.com/materialsproject/custodian.git --upgrade
-            pip install git+https://github.com/materialsproject/fireworks.git --upgrade
             # Add executables and path.
             for EXEPATH in `pwd`/cmd_line/*/Linux_64bit; do export PATH=$PATH:$EXEPATH; done
             pip install --quiet -e .
@@ -80,5 +77,3 @@ workflows:
               branches:
                   ignore:
                       main
-
-
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 80c5954d3..18733ec42 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -2,13 +2,13 @@ repos:
   - repo: https://github.com/myint/autoflake
     rev: v1.4
     hooks:
-    - id: autoflake
-      args: [--in-place, --remove-all-unused-imports, --remove-unused-variable, --ignore-init-module-imports]
+      - id: autoflake
+        args: [--in-place, --remove-all-unused-imports, --remove-unused-variable, --ignore-init-module-imports]
 
   - repo: https://github.com/psf/black
     rev: 21.11b1
     hooks:
-    - id: black
+      - id: black
 
   - repo: https://github.com/pycqa/flake8
     rev: 4.0.1
@@ -22,3 +22,9 @@ repos:
       - id: check-yaml
       - id: end-of-file-fixer
       - id: trailing-whitespace
+
+  - repo: https://github.com/asottile/pyupgrade
+    rev: v2.31.0
+    hooks:
+      - id: pyupgrade
+        args: [--py37-plus]
diff --git a/atomate/feff/firetasks/__init__.py b/atomate/feff/firetasks/__init__.py
index 341ce4c3c..54c2ce542 100644
--- a/atomate/feff/firetasks/__init__.py
+++ b/atomate/feff/firetasks/__init__.py
@@ -1,4 +1,4 @@
-from .glue_tasks import *
-from .parse_outputs import *
-from .run_calc import *
-from .write_inputs import *
+from .glue_tasks import CopyFeffOutputs
+from .parse_outputs import AddPathsToFilepadTask, SpectrumToDbTask
+from .run_calc import RunFeffDirect
+from .write_inputs import WriteEXAFSPaths, WriteFeffFromIOSet, get_feff_input_set_obj
diff --git a/atomate/feff/firetasks/parse_outputs.py b/atomate/feff/firetasks/parse_outputs.py
index 076821697..95a978e67 100644
--- a/atomate/feff/firetasks/parse_outputs.py
+++ b/atomate/feff/firetasks/parse_outputs.py
@@ -4,17 +4,14 @@
 from glob import glob
 
 import numpy as np
-
-from pymatgen.io.feff.inputs import Tags, Atoms
-
 from fireworks import FiretaskBase, FWAction, explicit_serialize
-from fireworks.utilities.fw_serializers import DATETIME_HANDLER
 from fireworks.user_objects.firetasks.filepad_tasks import get_fpad
+from fireworks.utilities.fw_serializers import DATETIME_HANDLER
+from pymatgen.io.feff.inputs import Atoms, Tags
 
-from atomate.utils.utils import env_chk
 from atomate.common.firetasks.glue_tasks import get_calc_loc
-from atomate.utils.utils import get_logger
 from atomate.feff.database import FeffCalcDb
+from atomate.utils.utils import env_chk, get_logger
 
 __author__ = "Kiran Mathew"
 __email__ = "kmathew@lbl.gov"
@@ -117,10 +114,10 @@ def run_task(self, fw_spec):
         fpad = get_fpad(self.get("filepad_file", None))
         labels = self.get("labels", None)
         for i, p in enumerate(paths):
-            l = labels[i] if labels is not None else None
+            label = labels[i] if labels is not None else None
             fpad.add_file(
                 p,
-                label=l,
+                label=label,
                 metadata=self.get("metadata", None),
                 compress=self.get("compress", True),
             )
diff --git a/atomate/feff/fireworks/__init__.py b/atomate/feff/fireworks/__init__.py
index bb67a43fa..3ab4d8712 100644
--- a/atomate/feff/fireworks/__init__.py
+++ b/atomate/feff/fireworks/__init__.py
@@ -1,1 +1,1 @@
-from .core import *
+from .core import EELSFW, XASFW, EXAFSPathsFW
diff --git a/atomate/feff/workflows/__init__.py b/atomate/feff/workflows/__init__.py
index 48b070f57..2c7d9917a 100644
--- a/atomate/feff/workflows/__init__.py
+++ b/atomate/feff/workflows/__init__.py
@@ -1,2 +1,8 @@
-from .core import *
-from .presets import *
+from .core import (
+    get_absorbing_atom_indices,
+    get_unique_site_indices,
+    get_wf_eels,
+    get_wf_exafs_paths,
+    get_wf_xas,
+)
+from .presets import wf_Xanes_K_edge
diff --git a/atomate/lammps/drones.py b/atomate/lammps/drones.py
index 21df5ff8f..f1acb97be 100644
--- a/atomate/lammps/drones.py
+++ b/atomate/lammps/drones.py
@@ -6,13 +6,13 @@
 from datetime import datetime
 
 from pymatgen.apps.borg.hive import AbstractDrone
+from pymatgen.io.lammps.inputs import LammpsRun
+from pymatgen.io.lammps.outputs import LammpsDump
 
-# from pymatgen.io.lammps.output import LammpsLog, LammpsDump, LammpsRun
-# from pymatgen.io.lammps.sets import LammpsInputSet
+from atomate.utils.utils import get_logger, get_uri
 
-from atomate.utils.utils import get_uri
+# from pymatgen.io.lammps.output import LammpsLog, LammpsDump
 
-from atomate.utils.utils import get_logger
 
 __author__ = "Brandon Wood, Kiran Mathew"
 __email__ = "b.wood@berkeley.edu"
@@ -154,7 +154,7 @@ def generate_doc(self, dir_name, lmps_input, log, dumps):
             }
             return d
 
-        except:
+        except Exception:
             import traceback
 
             logger.error(traceback.format_exc())
diff --git a/atomate/lammps/firetasks/__init__.py b/atomate/lammps/firetasks/__init__.py
index 598df7aa0..8107986cd 100644
--- a/atomate/lammps/firetasks/__init__.py
+++ b/atomate/lammps/firetasks/__init__.py
@@ -1,4 +1,4 @@
-# from .write_inputs import *
-# from .run_calc import *
-# from .parse_outputs import *
-# from .glue_tasks import *
+# from .glue_tasks import CopyPackmolOutputs
+# from .parse_outputs import LammpsToDB
+# from .run_calc import RunLammpsDirect, RunLammpsFake, RunPackmol
+# from .write_inputs import WriteInputFromForceFieldAndTopology, WriteInputFromIOSet
diff --git a/atomate/lammps/firetasks/run_calc.py b/atomate/lammps/firetasks/run_calc.py
index 5de64cb3b..32485025d 100644
--- a/atomate/lammps/firetasks/run_calc.py
+++ b/atomate/lammps/firetasks/run_calc.py
@@ -5,9 +5,8 @@
 import os
 import shutil
 
-# from pymatgen.io.lammps.utils import PackmolRunner, LammpsRunner
-
-from fireworks import explicit_serialize, FiretaskBase, FWAction
+from fireworks import FiretaskBase, FWAction, explicit_serialize
+from pymatgen.io.lammps.utils import LammpsRunner, PackmolRunner
 
 from atomate.utils.utils import get_logger
 
diff --git a/atomate/lammps/firetasks/write_inputs.py b/atomate/lammps/firetasks/write_inputs.py
index b73a0510f..29bc0da08 100644
--- a/atomate/lammps/firetasks/write_inputs.py
+++ b/atomate/lammps/firetasks/write_inputs.py
@@ -3,13 +3,12 @@
 parameters file)
 """
 
+from fireworks import FiretaskBase, explicit_serialize
 from pymatgen.core import Molecule
+from pymatgen.io.lammps.data import LammpsData
 
-# from pymatgen.io.lammps.data import LammpsData
 # from pymatgen.io.lammps.sets import LammpsInputSet
 
-from fireworks import FiretaskBase, explicit_serialize
-
 __author__ = "Kiran Mathew, Brandon Wood"
 __email__ = "kmathew@lbl.gov, b.wood@berkeley.edu"
 
diff --git a/atomate/lammps/fireworks/__init__.py b/atomate/lammps/fireworks/__init__.py
index 94ea25e3f..ab4172e2a 100644
--- a/atomate/lammps/fireworks/__init__.py
+++ b/atomate/lammps/fireworks/__init__.py
@@ -1,1 +1,1 @@
-# from .core import *
+# from .core import LammpsForceFieldFW, LammpsFW, PackmolFW
diff --git a/atomate/lammps/fireworks/core.py b/atomate/lammps/fireworks/core.py
index 29e766a77..b730b2e16 100644
--- a/atomate/lammps/fireworks/core.py
+++ b/atomate/lammps/fireworks/core.py
@@ -2,16 +2,15 @@
 Defines fireworks to be incorporated into workflows.
 """
 
-# from pymatgen.io.lammps.data import Topology
-
 from fireworks import Firework
+from pymatgen.io.lammps.data import Topology
 
 from atomate.common.firetasks.glue_tasks import PassCalcLocs
-from atomate.lammps.firetasks.run_calc import RunLammpsDirect, RunPackmol
 from atomate.lammps.firetasks.parse_outputs import LammpsToDB
+from atomate.lammps.firetasks.run_calc import RunLammpsDirect, RunPackmol
 from atomate.lammps.firetasks.write_inputs import (
-    WriteInputFromIOSet,
     WriteInputFromForceFieldAndTopology,
+    WriteInputFromIOSet,
 )
 
 __author__ = "Brandon Wood, Kiran Mathew"
diff --git a/atomate/lammps/workflows/__init__.py b/atomate/lammps/workflows/__init__.py
index 94ea25e3f..bc54b8dab 100644
--- a/atomate/lammps/workflows/__init__.py
+++ b/atomate/lammps/workflows/__init__.py
@@ -1,1 +1,1 @@
-# from .core import *
+# from .core import get_packmol_wf, get_wf_basic
diff --git a/atomate/lammps/workflows/core.py b/atomate/lammps/workflows/core.py
index b57b59905..27c9504bd 100644
--- a/atomate/lammps/workflows/core.py
+++ b/atomate/lammps/workflows/core.py
@@ -5,9 +5,9 @@
 from fireworks import Workflow
 
 # from pymatgen.io.lammps.sets import LammpsInputSet
-# from pymatgen.io.lammps.data import Topology
+from pymatgen.io.lammps.data import Topology
 
-from atomate.lammps.fireworks.core import LammpsFW, PackmolFW, LammpsForceFieldFW
+from atomate.lammps.fireworks.core import LammpsForceFieldFW, LammpsFW, PackmolFW
 
 __author__ = "Kiran Mathew"
 __email__ = "kmathew@lbl.gov"
diff --git a/atomate/qchem/drones.py b/atomate/qchem/drones.py
index bd791bb58..a5a8d6b3e 100644
--- a/atomate/qchem/drones.py
+++ b/atomate/qchem/drones.py
@@ -1,24 +1,24 @@
-import os
+import copy
 import datetime
-from fnmatch import fnmatch
-from collections import OrderedDict
-import json
 import glob
+import json
+import os
 import traceback
+from collections import OrderedDict
+from fnmatch import fnmatch
 from itertools import chain
-import copy
 
 from monty.io import zopen
 from monty.json import jsanitize
-from pymatgen.core import Molecule
-from pymatgen.io.qchem.outputs import QCOutput
-from pymatgen.io.qchem.inputs import QCInput
 from pymatgen.apps.borg.hive import AbstractDrone
+from pymatgen.core import Molecule
 from pymatgen.io.babel import BabelMolAdaptor
+from pymatgen.io.qchem.inputs import QCInput
+from pymatgen.io.qchem.outputs import QCOutput
 from pymatgen.symmetry.analyzer import PointGroupAnalyzer
 
-from atomate.utils.utils import get_logger
 from atomate import __version__ as atomate_version
+from atomate.utils.utils import get_logger
 
 __author__ = "Samuel Blau"
 __copyright__ = "Copyright 2018, The Materials Project"
@@ -95,7 +95,8 @@ def assimilate(self, path, input_file, output_file, multirun):
             if len(qcinput_files) > len(qcoutput_files):
                 if list(qcinput_files.items())[0][0] != "orig":
                     raise AssertionError(
-                        "Can only have inequal number of input and output files when there is a saved copy of the original input!"
+                        "Can only have unequal number of input and output files when there is a saved copy "
+                        "of the original input!"
                     )
             else:
                 raise AssertionError("Inequal number of input and output files!")
@@ -268,7 +269,7 @@ def generate_doc(self, dir_name, qcinput_files, qcoutput_files, multirun):
                 d["opt_trajectory"] = opt_trajectory
 
             if "final_energy" not in d["output"]:
-                if d_calc_final["final_energy"] != None:
+                if d_calc_final["final_energy"] is not None:
                     d["output"]["final_energy"] = d_calc_final["final_energy"]
                 else:
                     d["output"]["final_energy"] = d_calc_final["SCF"][-1][-1][0]
@@ -292,7 +293,7 @@ def generate_doc(self, dir_name, qcinput_files, qcoutput_files, multirun):
             d["formula_anonymous"] = comp.anonymized_formula
             d["formula_alphabetical"] = comp.alphabetical_formula
             d["chemsys"] = "-".join(sorted(set(d_calc_final["species"])))
-            if d_calc_final["point_group"] != None:
+            if d_calc_final["point_group"] is not None:
                 d["pointgroup"] = d_calc_final["point_group"]
             else:
                 try:
@@ -375,7 +376,8 @@ def process_qchem_multirun(dir_name, input_files, output_files):
         """
         if len(input_files) != 1:
             raise ValueError(
-                "ERROR: The drone can only process a directory containing a single input/output pair when each include multiple calculations."
+                "ERROR: The drone can only process a directory containing a single input/output pair when each "
+                "include multiple calculations."
             )
         else:
             for key in input_files:
diff --git a/atomate/qchem/firetasks/critic2.py b/atomate/qchem/firetasks/critic2.py
index 20f8f7891..0a9cac574 100644
--- a/atomate/qchem/firetasks/critic2.py
+++ b/atomate/qchem/firetasks/critic2.py
@@ -43,7 +43,7 @@ def run_task(self, fw_spec):
             molecule = fw_spec.get("prev_calc_molecule")
         else:
             molecule = self.get("molecule")
-        if molecule == None:
+        if molecule is None:
             raise ValueError(
                 "No molecule passed and no prev_calc_molecule found in spec! Exiting..."
             )
@@ -90,7 +90,7 @@ def run_task(self, fw_spec):
             molecule = fw_spec.get("prev_calc_molecule")
         else:
             molecule = self.get("molecule")
-        if molecule == None:
+        if molecule is None:
             raise ValueError(
                 "No molecule passed and no prev_calc_molecule found in spec! Exiting..."
             )
diff --git a/atomate/qchem/firetasks/run_calc.py b/atomate/qchem/firetasks/run_calc.py
index f69aacb01..1578ef244 100644
--- a/atomate/qchem/firetasks/run_calc.py
+++ b/atomate/qchem/firetasks/run_calc.py
@@ -116,7 +116,7 @@ def run_task(self, fw_spec):
         # initialize variables
         qchem_cmd = env_chk(self["qchem_cmd"], fw_spec)
         multimode = env_chk(self.get("multimode"), fw_spec)
-        if multimode == None:
+        if multimode is None:
             multimode = "openmp"
         """
         Note that I'm considering hardcoding openmp in the future
diff --git a/atomate/qchem/workflows/base/fragmentation.py b/atomate/qchem/workflows/base/fragmentation.py
index 1fbb94183..9a09887bc 100644
--- a/atomate/qchem/workflows/base/fragmentation.py
+++ b/atomate/qchem/workflows/base/fragmentation.py
@@ -101,7 +101,7 @@ def get_fragmentation_wf(
 
     qchem_input_params = qchem_input_params or {}
     additional_charges = additional_charges or []
-    if pcm_dielectric != None:
+    if pcm_dielectric is not None:
         qchem_input_params["pcm_dielectric"] = pcm_dielectric
 
     if do_optimization:
diff --git a/atomate/utils/database.py b/atomate/utils/database.py
index 3b995ba37..d6ac215c6 100644
--- a/atomate/utils/database.py
+++ b/atomate/utils/database.py
@@ -5,8 +5,7 @@
 import datetime
 from abc import ABCMeta, abstractmethod
 
-from maggma.stores import MongoStore
-from maggma.stores import S3Store, MongoURIStore
+from maggma.stores import MongoStore, MongoURIStore, S3Store
 from monty.json import jsanitize
 from monty.serialization import loadfn
 from pymongo import MongoClient, ReturnDocument
@@ -119,7 +118,7 @@ def __init__(
         self.collection = self.db[collection]
 
         # set counter collection
-        if  self.db.counter.count_documents({"_id": "taskid"}) == 0:
+        if self.db.counter.count_documents({"_id": "taskid"}) == 0:
             self.db.counter.insert_one({"_id": "taskid", "c": 0})
             self.build_indexes()
 
diff --git a/atomate/utils/utils.py b/atomate/utils/utils.py
index c06c12a7a..cb22da915 100644
--- a/atomate/utils/utils.py
+++ b/atomate/utils/utils.py
@@ -70,7 +70,7 @@ def get_mongolike(d, key):
     lead_key = key.split(".", 1)[0]
     try:
         lead_key = int(lead_key)  # for searching array data
-    except:
+    except Exception:
         pass
 
     if "." in key:
@@ -334,7 +334,7 @@ def get_uri(dir_name):
     fullpath = os.path.abspath(dir_name)
     try:
         hostname = socket.gethostbyaddr(socket.gethostname())[0]
-    except:
+    except Exception:
         hostname = socket.gethostname()
     return f"{hostname}:{fullpath}"
 
diff --git a/atomate/vasp/analysis/linear_response.py b/atomate/vasp/analysis/linear_response.py
index 61108f4f6..f9fe55cce 100644
--- a/atomate/vasp/analysis/linear_response.py
+++ b/atomate/vasp/analysis/linear_response.py
@@ -1,14 +1,19 @@
-
-from pymatgen.core.structure import Structure
+import numpy as np
 from pymatgen.analysis.magnetism import CollinearMagneticStructureAnalyzer
 
-import numpy as np
 
 def procure_response_dict(
-    struct_final, num_perturb_sites,
-    incar_dict, outcar_dict,
-    inv_block_dict, response_dict, perturb_dict,
-    rkey, keys, ldaul_vals, analyzer_gs,
+    struct_final,
+    num_perturb_sites,
+    incar_dict,
+    outcar_dict,
+    inv_block_dict,
+    response_dict,
+    perturb_dict,
+    rkey,
+    ldaul_vals,
+    analyzer_gs,
+    calcs_skipped,
 ):
     """
     Function to gather response data, in preparation for linear regression.
@@ -16,49 +21,48 @@ def procure_response_dict(
     """
 
     # perform magnetic ordering analysis
-    analyzer_output = CollinearMagneticStructureAnalyzer(
-        struct_final, threshold=0.61)
+    analyzer_output = CollinearMagneticStructureAnalyzer(struct_final, threshold=0.61)
     magnet_order = analyzer_output.ordering.value
-    if rkey == keys[0]: # store ground state ordering
-        magnet_order_gs = magnet_order
 
     # check if ordering matches ground state configuration
     if analyzer_gs:
         if not analyzer_gs.matches_ordering(struct_final):
-            use_calc = False
-            calcs_skipped.append({'ICHARG': incar_dict.get("ICHARG", 0), 
-                                  'ISPIN': incar_dict.get("ISPIN", 1),
-                                  'LDAUU': incar_dict['LDAUU'].copy(), 
-                                  'LDAUJ': incar_dict['LDAUJ'].copy()})
+            calcs_skipped.append(
+                {
+                    "ICHARG": incar_dict.get("ICHARG", 0),
+                    "ISPIN": incar_dict.get("ISPIN", 1),
+                    "LDAUU": incar_dict["LDAUU"].copy(),
+                    "LDAUJ": incar_dict["LDAUJ"].copy(),
+                }
+            )
 
     for i in range(num_perturb_sites):
         specie = struct_final[i].specie
         ldaul = ldaul_vals[i]
 
         orbital = inv_block_dict[str(ldaul)]
-        perturb_dict.update(
-            {"site"+str(i): {"specie": str(specie),
-                             "orbital": orbital}})
+        perturb_dict.update({f"site{i}": {"specie": str(specie), "orbital": orbital}})
 
         # Obtain occupancy values
-        n_tot = float(outcar_dict['charge'][i][orbital])
+        n_tot = float(outcar_dict["charge"][i][orbital])
         # FIXME: Adapt for noncollinear
-        m_z = float((outcar_dict['magnetization'][i][orbital]))
-        n_up = 0.5*(n_tot + m_z)
-        n_dn = 0.5*(n_tot - m_z)
+        m_z = float(outcar_dict["magnetization"][i][orbital])
+        n_up = 0.5 * (n_tot + m_z)
+        n_dn = 0.5 * (n_tot - m_z)
+
+        v_up = float(incar_dict["LDAUU"][i])
+        v_dn = float(incar_dict["LDAUJ"][i])
 
-        v_up = float(incar_dict['LDAUU'][i])
-        v_dn = float(incar_dict['LDAUJ'][i])
+        response_dict[rkey][f"site{i}"]["Nup"].append(n_up)
+        response_dict[rkey][f"site{i}"]["Ndn"].append(n_dn)
+        response_dict[rkey][f"site{i}"]["Ntot"].append(n_tot)
+        response_dict[rkey][f"site{i}"]["Mz"].append(m_z)
 
-        response_dict[rkey]['site'+str(i)]['Nup'].append(n_up)
-        response_dict[rkey]['site'+str(i)]['Ndn'].append(n_dn)
-        response_dict[rkey]['site'+str(i)]['Ntot'].append(n_tot)
-        response_dict[rkey]['site'+str(i)]['Mz'].append(m_z)
+        response_dict[rkey][f"site{i}"]["Vup"].append(v_up)
+        response_dict[rkey][f"site{i}"]["Vdn"].append(v_dn)
 
-        response_dict[rkey]['site'+str(i)]['Vup'].append(v_up)
-        response_dict[rkey]['site'+str(i)]['Vdn'].append(v_dn)
+        response_dict[rkey]["magnetic order"].append(magnet_order)
 
-        response_dict[rkey]['magnetic order'].append(magnet_order)
 
 def response_fit(x, y):
     """
@@ -70,6 +74,7 @@ def response_fit(x, y):
 
     return p, perr
 
+
 def response_fit_stepped(x, y, tol=1.0e-6):
     """
     Function for fitting to response data
@@ -80,13 +85,12 @@ def response_fit_stepped(x, y, tol=1.0e-6):
     is_stepped = False
     step_id = -1
 
-    y_sort = [y for y,_ in sorted(zip(y,x))]
-    x_sort = [x for _,x in sorted(zip(y,x))]
+    y_sort = [y for y, _ in sorted(zip(y, x))]
+    x_sort = [x for _, x in sorted(zip(y, x))]
 
-    buff_size = 1 # must be gte three for first-order fit
-    for i in range(buff_size,len(y_sort)-buff_size+1):
-        if np.std(y_sort[0:i]) < tol \
-                and np.std(y_sort[i:]) < tol:
+    buff_size = 1  # must be gte three for first-order fit
+    for i in range(buff_size, len(y_sort) - buff_size + 1):
+        if np.std(y_sort[0:i]) < tol and np.std(y_sort[i:]) < tol:
             is_stepped = True
             step_id = i
             break
@@ -101,20 +105,23 @@ def response_fit_stepped(x, y, tol=1.0e-6):
             (p1, p1err) = response_fit(x_sort[0:step_id], y_sort[0:step_id])
             (p2, p2err) = response_fit(x_sort[step_id:], y_sort[step_id:])
             p = 0.5 * (np.array(p1) + np.array(p2))
-            perr = np.sqrt(0.5 * (np.array(p1err)**2 + np.array(p2err)**2))
+            perr = np.sqrt(0.5 * (np.array(p1err) ** 2 + np.array(p2err) ** 2))
         return p, perr
     else:
         (p, perr) = response_fit(x, y)
         return p, perr
 
+
 def obtain_response_matrices(
-    n_response, spin_polarized, 
-    response_dict, keys,
+    n_response,
+    spin_polarized,
+    response_dict,
+    keys,
 ):
     """
-    Function to compute self-consistent (SCF) and non-self-consistent (NSCF) 
-    linear response "chi" matrices; In addition to using linear regression 
-    to compute slopes about zero potential, the uncertainty associated 
+    Function to compute self-consistent (SCF) and non-self-consistent (NSCF)
+    linear response "chi" matrices; In addition to using linear regression
+    to compute slopes about zero potential, the uncertainty associated
     with these values are also stored for subsequent error quantification.
     Returns: chi_matrix_nscf, chi_matrix_scf, chi_nscf_err, chi_scf_err
     """
@@ -130,31 +137,35 @@ def obtain_response_matrices(
     for ii in range(n_response):
         for jj in range(n_response):
             if spin_polarized:
-                i, j = ii//2, jj//2
-                si, sj = 'up' if np.mod(ii,2)==0 else 'dn', \
-                    'up' if np.mod(jj,2)==0 else 'dn'
-                v_key = 'V'+sj
-                n_key = 'N'+si
+                i, j = ii // 2, jj // 2
+                si, sj = (
+                    "up" if np.mod(ii, 2) == 0 else "dn",
+                    "up" if np.mod(jj, 2) == 0 else "dn",
+                )
+                v_key = "V" + sj
+                n_key = "N" + si
             else:
                 i, j = ii, jj
-                v_key = 'Vup'
-                n_key = 'Ntot'
+                v_key = "Vup"
+                n_key = "Ntot"
 
-            if response_dict[keys[1]]['site'+str(i)][n_key] and response_dict[keys[2]]['site'+str(i)][n_key] and \
-               response_dict[keys[1]]['site'+str(j)][v_key] and response_dict[keys[2]]['site'+str(j)][v_key]:
+            if (
+                response_dict[keys[1]][f"site{i}"][n_key]
+                and response_dict[keys[2]][f"site{i}"][n_key]
+                and response_dict[keys[1]][f"site{j}"][v_key]
+                and response_dict[keys[2]][f"site{j}"][v_key]
+            ):
 
                 # gather NSCF & SCF response data
                 v_nscf, n_nscf = [], []
                 v_scf, n_scf = [], []
                 for ll in [1, 2]:
-                    for l in range(len(response_dict[keys[ll]]['site'+str(j)][v_key])):
+                    for idx in range(len(response_dict[keys[ll]][f"site{j}"][v_key])):
 
-                        v = response_dict[keys[ll]]['site'+str(j)][v_key][l]
-                        n = response_dict[keys[ll]]['site'+str(i)][n_key][l]
-                        order = response_dict[keys[ll]]['magnetic order'][l]
+                        v = response_dict[keys[ll]][f"site{j}"][v_key][idx]
+                        n = response_dict[keys[ll]][f"site{i}"][n_key][idx]
 
-                        #if order == magnet_order_gs:
-                        isolated_response = (v != 0.0)
+                        isolated_response = v != 0.0
 
                         if isolated_response:
                             if ll == 1:
@@ -165,10 +176,12 @@ def obtain_response_matrices(
                                 n_scf.append(n)
 
                 # Add ground state
-                if response_dict[keys[0]]['site'+str(j)][v_key] \
-                        and response_dict[keys[0]]['site'+str(i)][n_key]: 
-                    v = response_dict[keys[0]]['site'+str(j)][v_key][0]
-                    n = response_dict[keys[0]]['site'+str(i)][n_key][0]
+                if (
+                    response_dict[keys[0]][f"site{j}"][v_key]
+                    and response_dict[keys[0]][f"site{i}"][n_key]
+                ):
+                    v = response_dict[keys[0]][f"site{j}"][v_key][0]
+                    n = response_dict[keys[0]][f"site{i}"][n_key][0]
                     v_nscf.append(v)
                     n_nscf.append(n)
                     v_scf.append(v)
@@ -180,13 +193,13 @@ def obtain_response_matrices(
                     fit_scf = response_fit(v_scf, n_scf)
                     chi_scf, err_chi_scf = fit_scf[0][-2], fit_scf[1][-2]
                 except Exception as exc:
-                    chi_nscf, err_chi_nscf = float('nan'), float('nan')
-                    chi_scf, err_chi_scf = float('nan'), float('nan')
-                    logger.warning('Slope fitting fail',  exc)
+                    chi_nscf, err_chi_nscf = float("nan"), float("nan")
+                    chi_scf, err_chi_scf = float("nan"), float("nan")
+                    logger.warning("Slope fitting fail", exc)
 
             else:
-                chi_nscf, err_chi_nscf = float('nan'), float('nan')
-                chi_scf, err_chi_scf = float('nan'), float('nan')
+                chi_nscf, err_chi_nscf = float("nan"), float("nan")
+                chi_scf, err_chi_scf = float("nan"), float("nan")
 
             chi_matrix_nscf[ii, jj] = chi_nscf
             chi_matrix_scf[ii, jj] = chi_scf
@@ -195,32 +208,33 @@ def obtain_response_matrices(
 
     return chi_matrix_nscf, chi_matrix_scf, chi_nscf_err, chi_scf_err
 
+
 def inverse_matrix_uncertainty(matrix, matrix_covar):
     """
     Function to compute the element-wise error propagation in matrix inversion
     """
 
-    m,n = matrix.shape
+    m, n = matrix.shape
     if m != n:
         logger.warning("Matrix dimension error")
-        return float('nan')*matrix, float('nan')*matrix
+        return float("nan") * matrix, float("nan") * matrix
 
     matrixinv = np.linalg.inv(matrix)
-    matrixinv_var = np.zeros([m,n])
+    matrixinv_var = np.zeros([m, n])
 
     if m == 1 and n == 1:
-        jacobian = - 1 / matrix[0,0]**2
+        jacobian = -1 / matrix[0, 0] ** 2
         jacobians = [[jacobian]]
-        sigma_f = jacobian * matrix_covar[0,0] * jacobian
-        matrixinv_var[0,0] = sigma_f
+        sigma_f = jacobian * matrix_covar[0, 0] * jacobian
+        matrixinv_var[0, 0] = sigma_f
 
         return matrixinv, matrixinv_var, jacobians
 
     # Function to determine the symbolic partial derivative of the
     # determinant w.r.t. matrix element
-    def det_deriv(matrix,i,j):
-        mij = np.delete(np.delete(matrix,i,0),j,1)
-        partial = (-1)**(i+j) * np.linalg.det(mij)
+    def det_deriv(matrix, i, j):
+        mij = np.delete(np.delete(matrix, i, 0), j, 1)
+        partial = (-1) ** (i + j) * np.linalg.det(mij)
         return partial
 
     # Jacobians of each element of matrix inversion w.r.t.
@@ -230,36 +244,36 @@ def det_deriv(matrix,i,j):
     det = np.linalg.det(matrix)
     for i in range(m):
         for j in range(n):
-            mji = np.delete(np.delete(matrix,j,0),i,1)
-            minor = (-1)**(i+j) * np.linalg.det(mji)
+            mji = np.delete(np.delete(matrix, j, 0), i, 1)
+            minor = (-1) ** (i + j) * np.linalg.det(mji)
 
-            j_matrix = np.zeros([m,n])
+            j_matrix = np.zeros([m, n])
             for k in range(m):
                 for l in range(n):
-                    det_p = det_deriv(matrix,k,l)
+                    det_p = det_deriv(matrix, k, l)
 
-                    if k==j or l==i:
+                    if k == j or l == i:
                         minor_p = 0.0
                     else:
-                        kk, ll = k-1 if k>j else k, l-1 if l>i else l
-                        minor_p = (-1)**(i+j) * det_deriv(mji,kk,ll)
+                        kk, ll = k - 1 if k > j else k, l - 1 if l > i else l
+                        minor_p = (-1) ** (i + j) * det_deriv(mji, kk, ll)
 
-                    j_matrix[k,l] = (minor_p * det - minor * det_p) / det**2
+                    j_matrix[k, l] = (minor_p * det - minor * det_p) / det ** 2
 
             jacobians[i].append(j_matrix)
 
-            j_vec = np.reshape(j_matrix, [m*n, 1])
-            sigma_f = np.sum(
-                np.dot(np.transpose(j_vec), np.dot(matrix_covar, j_vec)))
-            matrixinv_var[i,j] = sigma_f
+            j_vec = np.reshape(j_matrix, [m * n, 1])
+            sigma_f = np.sum(np.dot(np.transpose(j_vec), np.dot(matrix_covar, j_vec)))
+            matrixinv_var[i, j] = sigma_f
 
     return matrixinv, matrixinv_var, jacobians
 
+
 def chi_inverse(chi, chi_err, method="full"):
     """
     Function to compute inverse of response matrix and associated
     element-wise uncertainty for point-wise, atom-wise,
-    and full matrix inversion    
+    and full matrix inversion
     """
 
     n_response = len(chi)
@@ -272,29 +286,34 @@ def chi_inverse(chi, chi_err, method="full"):
         for ii in range(n_response):
             for jj in range(n_response):
                 if ii != jj:
-                    chi_block[ii,jj], chi_err_block[ii,jj] = 0.0, 0.0
+                    chi_block[ii, jj], chi_err_block[ii, jj] = 0.0, 0.0
     elif method == "atom":
         # 2x2 block diagonal
         for ii in range(n_response):
             for jj in range(n_response):
-                i, j = ii//2, jj//2
+                i, j = ii // 2, jj // 2
                 if i != j:
-                    chi_block[ii,jj], chi_err_block[ii,jj] = 0.0, 0.0
+                    chi_block[ii, jj], chi_err_block[ii, jj] = 0.0, 0.0
     elif method != "full":
-        raise ValueError("Unsupported method, method must be point (diagonal 1x1 inversion), "
-                         "atom (block 2x2 inverse), or full (full inverse)")
+        raise ValueError(
+            "Unsupported method, method must be point (diagonal 1x1 inversion), "
+            "atom (block 2x2 inverse), or full (full inverse)"
+        )
 
     # Assume cross-covariances are zero
-    chi_covar = np.diag(np.reshape(chi_err_block**2, [n_response * n_response]))
+    chi_covar = np.diag(np.reshape(chi_err_block ** 2, [n_response * n_response]))
 
     (chi_inv, chi_inv_var, chi_inv_jacobs) = inverse_matrix_uncertainty(
-        chi_block, chi_covar)
+        chi_block, chi_covar
+    )
 
     return chi_block, chi_inv, chi_inv_var, chi_inv_jacobs
 
+
 def compute_u_pointwise(
     site_index,
-    f_matrix, f_matrix_err,
+    f_matrix,
+    f_matrix_err,
 ):
     """
     Function to compute Hubbard U value using point-wise (diagonal) inversion,
@@ -304,16 +323,18 @@ def compute_u_pointwise(
 
     i = site_index
 
-    umat = f_matrix[2*i:2*(i+1), 2*i:2*(i+1)]
-    umat_err = f_matrix_err[2*i:2*(i+1), 2*i:2*(i+1)]
+    umat = f_matrix[2 * i : 2 * (i + 1), 2 * i : 2 * (i + 1)]
+    umat_err = f_matrix_err[2 * i : 2 * (i + 1), 2 * i : 2 * (i + 1)]
     uval = 0.5 * np.sum(np.diag(umat))
-    uval_err = 0.5 * np.sqrt(np.sum(np.diag(umat_err)**2))
+    uval_err = 0.5 * np.sqrt(np.sum(np.diag(umat_err) ** 2))
 
     return uval, uval_err
 
+
 def compute_uj_simple_two_by_two(
     site_index,
-    f_matrix, f_matrix_err,
+    f_matrix,
+    f_matrix_err,
 ):
     """
     Function to compute Hubbard U and Hund J values using simple 2x2 formula,
@@ -323,24 +344,30 @@ def compute_uj_simple_two_by_two(
 
     i = site_index
 
-    umat = f_matrix[2*site_index:2*(i+1), 2*i:2*(i+1)]
-    umat_err = f_matrix_err[2*i:2*(i+1), 2*i:2*(i+1)]
+    umat = f_matrix[2 * site_index : 2 * (i + 1), 2 * i : 2 * (i + 1)]
+    umat_err = f_matrix_err[2 * i : 2 * (i + 1), 2 * i : 2 * (i + 1)]
 
     uval = 0.25 * np.sum(umat)
-    uval_err = 0.25 * np.sqrt(np.sum(umat_err**2))
+    uval_err = 0.25 * np.sqrt(np.sum(umat_err ** 2))
 
-    jmat = np.array([[-1,1],[1,-1]]) * umat.copy()
+    jmat = np.array([[-1, 1], [1, -1]]) * umat.copy()
     jmat_err = umat_err.copy()
     jval = 0.25 * np.sum(jmat)
-    jval_err = 0.25 * np.sqrt(np.sum(jmat_err**2))
+    jval_err = 0.25 * np.sqrt(np.sum(jmat_err ** 2))
 
     return uval, uval_err, jval, jval_err
 
+
 def compute_uj_scaled_two_by_two(
     site_index,
-    f_matrix, f_matrix_err,
-    chi_matrix_scf, chi_scf_err, chi_matrix_nscf, chi_nscf_err,
-    chi_scf_inv_jacobs, chi_nscf_inv_jacobs,
+    f_matrix,
+    f_matrix_err,
+    chi_matrix_scf,
+    chi_scf_err,
+    chi_matrix_nscf,
+    chi_nscf_err,
+    chi_scf_inv_jacobs,
+    chi_nscf_inv_jacobs,
 ):
     """
     Function to compute Hubbard U and Hund J values using scaled 2x2 formula,
@@ -348,96 +375,145 @@ def compute_uj_scaled_two_by_two(
     - based on the study by Linscott et. al.
     """
 
-    i = site_index
+    nx2 = 2 * site_index
+    np1x2 = nx2 + 2
 
     # helpful functions for computing derivatives of "f" (Dyson) matrix
-    def fmat_deriv_scf(kk,ll,k,l):
-        fd = chi_scf_inv_jacobs[2*i+kk][2*i+ll][2*i+k,2*i+l]
+    def fmat_deriv_scf(kk, ll, ik, il):
+        fd = chi_scf_inv_jacobs[nx2 + kk][nx2 + ll][nx2 + ik, nx2 + il]
         return fd
 
-    def fmat_deriv_nscf(kk,ll,k,l):
-        fd = - chi_nscf_inv_jacobs[2*i+kk][2*i+ll][2*i+k,2*i+l]
+    def fmat_deriv_nscf(kk, ll, ik, il):
+        fd = -chi_nscf_inv_jacobs[nx2 + kk][nx2 + ll][nx2 + ik, nx2 + il]
         return fd
 
-    fmat = f_matrix[2*i:2*(i+1), 2*i:2*(i+1)]
-    fmat_err = f_matrix_err[2*i:2*(i+1), 2*i:2*(i+1)]
+    fmat = f_matrix[nx2:np1x2, nx2:np1x2]
 
-    chi_sub_scf = chi_matrix_scf[2*i:2*(i+1), 2*i:2*(i+1)]
-    chi_sub_scf_err = chi_scf_err[2*i:2*(i+1), 2*i:2*(i+1)]
-    chi_sub_nscf = chi_matrix_nscf[2*i:2*(i+1), 2*i:2*(i+1)]
-    chi_sub_nscf_err = chi_nscf_err[2*i:2*(i+1), 2*i:2*(i+1)]
+    chi_sub_scf = chi_matrix_scf[nx2:np1x2, nx2:np1x2]
+    chi_sub_scf_err = chi_scf_err[nx2:np1x2, nx2:np1x2]
+    chi_sub_nscf_err = chi_nscf_err[nx2:np1x2, nx2:np1x2]
 
     # compute U value and error
-    lam = (chi_sub_scf[0,0] + chi_sub_scf[0,1]) / (chi_sub_scf[1,0] + chi_sub_scf[1,1])
-    lam_deriv = np.zeros([2,2])
-    lam_deriv[0,0] = 1.0 / (chi_sub_scf[1,0] + chi_sub_scf[1,1])
-    lam_deriv[0,1] = lam_deriv[0,0]
-    lam_deriv[1,1] = - lam / (chi_sub_scf[1,0] + chi_sub_scf[1,1])
-    lam_deriv[1,0] = lam_deriv[1,1]
-
-    uval = 0.5 * (lam*(fmat[0,0]+fmat[1,0]) + fmat[0,1]+fmat[1,1]) / (lam + 1.0)
+    lam = (chi_sub_scf[0, 0] + chi_sub_scf[0, 1]) / (
+        chi_sub_scf[1, 0] + chi_sub_scf[1, 1]
+    )
+    lam_deriv = np.zeros([2, 2])
+    lam_deriv[0, 0] = 1.0 / (chi_sub_scf[1, 0] + chi_sub_scf[1, 1])
+    lam_deriv[0, 1] = lam_deriv[0, 0]
+    lam_deriv[1, 1] = -lam / (chi_sub_scf[1, 0] + chi_sub_scf[1, 1])
+    lam_deriv[1, 0] = lam_deriv[1, 1]
+
+    uval = (
+        0.5 * (lam * (fmat[0, 0] + fmat[1, 0]) + fmat[0, 1] + fmat[1, 1]) / (lam + 1.0)
+    )
 
     uval_err = 0.0
     # scf component
-    u_deriv_scf = np.zeros([2,2])
-    for k in [0,1]:
-        for l in [0,1]:
-            u_deriv_scf[k,l] = 0.5/(lam+1.0)*(lam_deriv[k,l]*(fmat[0,0] + fmat[1,0]) \
-                + lam*(fmat_deriv_scf(0,0,k,l) + fmat_deriv_scf(1,0,k,l)) \
-                + fmat_deriv_scf(0,1,k,l) + fmat_deriv_scf(1,1,k,l)) \
-                - uval/(lam+1.0) * lam_deriv[k,l]
+    u_deriv_scf = np.zeros([2, 2])
+    for ik in [0, 1]:
+        for il in [0, 1]:
+            u_deriv_scf[ik, il] = (
+                0.5
+                / (lam + 1.0)
+                * (
+                    lam_deriv[ik, il] * (fmat[0, 0] + fmat[1, 0])
+                    + lam
+                    * (fmat_deriv_scf(0, 0, ik, il) + fmat_deriv_scf(1, 0, ik, il))
+                    + fmat_deriv_scf(0, 1, ik, il)
+                    + fmat_deriv_scf(1, 1, ik, il)
+                )
+                - uval / (lam + 1.0) * lam_deriv[ik, il]
+            )
     jacob_vec = np.reshape(u_deriv_scf, [4, 1])
     uval_err = uval_err + np.sum(
-        np.dot(np.transpose(jacob_vec), 
-               np.dot(np.diag(np.reshape(chi_sub_scf_err**2,[4])), jacob_vec)))
+        np.dot(
+            np.transpose(jacob_vec),
+            np.dot(np.diag(np.reshape(chi_sub_scf_err ** 2, [4])), jacob_vec),
+        )
+    )
     # nscf component
-    u_deriv_nscf = np.zeros([2,2])
-    for k in [0,1]:
-        for l in [0,1]:
-            u_deriv_nscf[k,l] = 0.5/(lam+1.0)*( \
-                + lam*(fmat_deriv_nscf(0,0,k,l) + fmat_deriv_nscf(1,0,k,l)) \
-                + fmat_deriv_nscf(0,1,k,l) + fmat_deriv_nscf(1,1,k,l))
+    u_deriv_nscf = np.zeros([2, 2])
+    for ik in [0, 1]:
+        for il in [0, 1]:
+            u_deriv_nscf[ik, il] = (
+                0.5
+                / (lam + 1.0)
+                * (
+                    +lam
+                    * (fmat_deriv_nscf(0, 0, ik, il) + fmat_deriv_nscf(1, 0, ik, il))
+                    + fmat_deriv_nscf(0, 1, ik, il)
+                    + fmat_deriv_nscf(1, 1, ik, il)
+                )
+            )
     jacob_vec = np.reshape(u_deriv_nscf, [4, 1])
     uval_err = uval_err + np.sum(
-        np.dot(np.transpose(jacob_vec),
-               np.dot(np.diag(np.reshape(chi_sub_nscf_err**2,[4])), jacob_vec)))
+        np.dot(
+            np.transpose(jacob_vec),
+            np.dot(np.diag(np.reshape(chi_sub_nscf_err ** 2, [4])), jacob_vec),
+        )
+    )
     # compute std
     uval_err = np.sqrt(uval_err)
 
     # compute J value and error
-    lam = (chi_sub_scf[0,0] - chi_sub_scf[0,1]) / (chi_sub_scf[1,0] - chi_sub_scf[1,1])
-    lam_deriv = np.zeros([2,2])
-    lam_deriv[0,0] = 1.0 / (chi_sub_scf[1,0] - chi_sub_scf[1,1])
-    lam_deriv[0,1] = - lam_deriv[0,0]
-    lam_deriv[1,1] = lam / (chi_sub_scf[1,0] - chi_sub_scf[1,1])
-    lam_deriv[1,0] = - lam_deriv[1,1]
-
-    jval = - 0.5 * (lam*(fmat[0,0]-fmat[1,0]) + fmat[0,1]-fmat[1,1]) / (lam - 1.0)
+    lam = (chi_sub_scf[0, 0] - chi_sub_scf[0, 1]) / (
+        chi_sub_scf[1, 0] - chi_sub_scf[1, 1]
+    )
+    lam_deriv = np.zeros([2, 2])
+    lam_deriv[0, 0] = 1.0 / (chi_sub_scf[1, 0] - chi_sub_scf[1, 1])
+    lam_deriv[0, 1] = -lam_deriv[0, 0]
+    lam_deriv[1, 1] = lam / (chi_sub_scf[1, 0] - chi_sub_scf[1, 1])
+    lam_deriv[1, 0] = -lam_deriv[1, 1]
+
+    jval = (
+        -0.5 * (lam * (fmat[0, 0] - fmat[1, 0]) + fmat[0, 1] - fmat[1, 1]) / (lam - 1.0)
+    )
 
     jval_err = 0.0
     # scf component
-    j_deriv_scf = np.zeros([2,2])
-    for k in [0,1]:
-        for l in [0,1]:
-            u_deriv_scf[k,l] = -0.5/(lam-1.0)*(lam_deriv[k,l]*(fmat[0,0] - fmat[1,0]) \
-                + lam*(fmat_deriv_scf(0,0,k,l) - fmat_deriv_scf(1,0,k,l)) \
-                + fmat_deriv_scf(0,1,k,l) - fmat_deriv_scf(1,1,k,l)) \
-                + uval/(lam-1.0) * lam_deriv[k,l]
+    j_deriv_scf = np.zeros([2, 2])
+    for ik in [0, 1]:
+        for il in [0, 1]:
+            u_deriv_scf[ik, il] = (
+                -0.5
+                / (lam - 1.0)
+                * (
+                    lam_deriv[ik, il] * (fmat[0, 0] - fmat[1, 0])
+                    + lam
+                    * (fmat_deriv_scf(0, 0, ik, il) - fmat_deriv_scf(1, 0, ik, il))
+                    + fmat_deriv_scf(0, 1, ik, il)
+                    - fmat_deriv_scf(1, 1, ik, il)
+                )
+                + uval / (lam - 1.0) * lam_deriv[ik, il]
+            )
     jacob_vec = np.reshape(j_deriv_scf, [4, 1])
     jval_err = jval_err + np.sum(
-        np.dot(np.transpose(jacob_vec), 
-               np.dot(np.diag(np.reshape(chi_sub_scf_err**2,[4])), jacob_vec)))
+        np.dot(
+            np.transpose(jacob_vec),
+            np.dot(np.diag(np.reshape(chi_sub_scf_err ** 2, [4])), jacob_vec),
+        )
+    )
     # nscf component
-    j_deriv_nscf = np.zeros([2,2])
-    for k in [0,1]:
-        for l in [0,1]:
-            j_deriv_nscf[k,l] = -0.5/(lam-1.0)*( \
-                + lam*(fmat_deriv_nscf(0,0,k,l) - fmat_deriv_nscf(1,0,k,l)) \
-                + fmat_deriv_nscf(0,1,k,l) - fmat_deriv_nscf(1,1,k,l))
+    j_deriv_nscf = np.zeros([2, 2])
+    for ik in [0, 1]:
+        for il in [0, 1]:
+            j_deriv_nscf[ik, il] = (
+                -0.5
+                / (lam - 1.0)
+                * (
+                    +lam
+                    * (fmat_deriv_nscf(0, 0, ik, il) - fmat_deriv_nscf(1, 0, ik, il))
+                    + fmat_deriv_nscf(0, 1, ik, il)
+                    - fmat_deriv_nscf(1, 1, ik, il)
+                )
+            )
     jacob_vec = np.reshape(j_deriv_nscf, [4, 1])
     jval_err = jval_err + np.sum(
-        np.dot(np.transpose(jacob_vec),
-               np.dot(np.diag(np.reshape(chi_sub_nscf_err**2,[4])), jacob_vec)))
+        np.dot(
+            np.transpose(jacob_vec),
+            np.dot(np.diag(np.reshape(chi_sub_nscf_err ** 2, [4])), jacob_vec),
+        )
+    )
     # compute std
     jval_err = np.sqrt(jval_err)
 
diff --git a/atomate/vasp/builders/bandgap_estimation.py b/atomate/vasp/builders/bandgap_estimation.py
index a7cf0341c..d5573f3b3 100644
--- a/atomate/vasp/builders/bandgap_estimation.py
+++ b/atomate/vasp/builders/bandgap_estimation.py
@@ -59,7 +59,7 @@ def run(self):
                     {"material_id": m["material_id"]}, {"$set": d}
                 )
 
-            except:
+            except Exception:
                 import traceback
 
                 logger.exception(traceback.format_exc())
diff --git a/atomate/vasp/builders/boltztrap_materials.py b/atomate/vasp/builders/boltztrap_materials.py
index c8b35ae44..46bccefeb 100644
--- a/atomate/vasp/builders/boltztrap_materials.py
+++ b/atomate/vasp/builders/boltztrap_materials.py
@@ -52,7 +52,7 @@ def run(self):
                         f"Cannot find matching material for object_id: {o_id}"
                     )
                 self._update_material(m_id, doc)
-            except:
+            except Exception:
                 import traceback
 
                 logger.exception("<---")
@@ -156,7 +156,7 @@ def from_file(cls, db_file, m="materials", b="boltztrap", **kwargs):
         try:
             db_read = get_database(db_file, admin=False)
             db_read.collection_names()  # throw error if auth failed
-        except:
+        except Exception:
             print("Warning: could not get read-only database")
             db_read = get_database(db_file, admin=True)
 
diff --git a/atomate/vasp/builders/file_materials.py b/atomate/vasp/builders/file_materials.py
index b4a2d164c..5e5ef2e2e 100644
--- a/atomate/vasp/builders/file_materials.py
+++ b/atomate/vasp/builders/file_materials.py
@@ -56,7 +56,7 @@ def run(self):
                         val = line[2]
                         try:
                             val = float(val)
-                        except:
+                        except Exception:
                             pass
 
                         self._materials.update(
diff --git a/atomate/vasp/builders/materials_ehull.py b/atomate/vasp/builders/materials_ehull.py
index 53a5c876d..41f31be30 100644
--- a/atomate/vasp/builders/materials_ehull.py
+++ b/atomate/vasp/builders/materials_ehull.py
@@ -1,12 +1,9 @@
-from tqdm import tqdm
-
-from atomate.utils.utils import get_database
-
-from pymatgen.ext.matproj import MPRester
 from pymatgen.core import Structure
 from pymatgen.entries.computed_entries import ComputedEntry
+from pymatgen.ext.matproj import MPRester
+from tqdm import tqdm
 
-from atomate.utils.utils import get_logger
+from atomate.utils.utils import get_database, get_logger
 from atomate.vasp.builders.base import AbstractBuilder
 
 logger = get_logger(__name__)
@@ -18,7 +15,7 @@ class MaterialsEhullBuilder(AbstractBuilder):
     def __init__(self, materials_write, mapi_key=None, update_all=False):
         """
         Starting with an existing materials collection, adds stability information and
-        The Materials Project ID.
+        the Materials Project ID.
         Args:
             materials_write: mongodb collection for materials (write access needed)
             mapi_key: (str) Materials API key (if MAPI_KEY env. var. not set)
@@ -37,21 +34,14 @@ def run(self):
         if not self.update_all:
             q["stability"] = {"$exists": False}
 
-        mats = [
-            m
-            for m in self._materials.find(
-                q,
-                {
-                    "calc_settings": 1,
-                    "structure": 1,
-                    "thermo.energy": 1,
-                    "material_id": 1,
-                },
-            )
-        ]
+        mats = self._materials.find(
+            q, ["calc_settings", "structure", "thermo.energy", "material_id"]
+        )
+
         pbar = tqdm(mats)
         for m in pbar:
-            pbar.set_description("Processing materials_id: {}".format(m["material_id"]))
+            mat_id = m["material_id"]
+            pbar.set_description(f"Processing materials_id: {mat_id}")
             try:
                 params = {}
                 for x in ["is_hubbard", "hubbards", "potcar_spec"]:
@@ -66,7 +56,7 @@ def run(self):
                 # TODO: @computron This only calculates Ehull with respect to Materials Project.
                 # It should also account for the current database's results. -computron
                 self._materials.update_one(
-                    {"material_id": m["material_id"]},
+                    {"material_id": mat_id},
                     {"$set": {"stability": self.mpr.get_stability([my_entry])[0]}},
                 )
 
@@ -75,14 +65,12 @@ def run(self):
                 # TODO: @computron it's better to use PD tool or reaction energy calculator
                 # Otherwise the compatibility schemes might have issues...one strategy might be
                 # use MP only to retrieve entries but compute the PD locally -computron
-                for el, elx in my_entry.composition.items():
+                for el, amt in my_entry.composition.items():
                     entries = self.mpr.get_entries(el.symbol, compatible_only=True)
-                    min_e = min(
-                        entries, key=lambda x: x.energy_per_atom
-                    ).energy_per_atom
-                    energy -= elx * min_e
+                    min_e = min(x.energy_per_atom for x in entries)
+                    energy -= amt * min_e
                 self._materials.update_one(
-                    {"material_id": m["material_id"]},
+                    {"material_id": mat_id},
                     {
                         "$set": {
                             "thermo.formation_energy_per_atom": energy
@@ -93,14 +81,14 @@ def run(self):
 
                 mpids = self.mpr.find_structure(structure)
                 self._materials.update_one(
-                    {"material_id": m["material_id"]}, {"$set": {"mpids": mpids}}
+                    {"material_id": mat_id}, {"$set": {"mpids": mpids}}
                 )
 
-            except:
+            except Exception:
                 import traceback
 
                 logger.exception("<---")
-                logger.exception(f"There was an error processing material_id: {m}")
+                logger.exception(f"There was an error processing material: {m}")
                 logger.exception(traceback.format_exc())
                 logger.exception("--->")
 
diff --git a/atomate/vasp/builders/tags.py b/atomate/vasp/builders/tags.py
index f033899a0..eb5987d01 100644
--- a/atomate/vasp/builders/tags.py
+++ b/atomate/vasp/builders/tags.py
@@ -82,7 +82,7 @@ def run(self):
                         },
                     )
 
-            except:
+            except Exception:
                 import traceback
 
                 logger.exception("<---")
@@ -117,7 +117,7 @@ def from_file(cls, db_file, m="materials", t="tasks", **kwargs):
         try:
             db_read = get_database(db_file, admin=False)
             db_read.collection_names()  # throw error if auth failed
-        except:
+        except Exception:
             print("Warning: could not get read-only database; using write creds")
             db_read = get_database(db_file, admin=True)
         return cls(db_write[m], db_read[t], **kwargs)
diff --git a/atomate/vasp/builders/tasks_materials.py b/atomate/vasp/builders/tasks_materials.py
index 22d50b6a8..95bc609cf 100644
--- a/atomate/vasp/builders/tasks_materials.py
+++ b/atomate/vasp/builders/tasks_materials.py
@@ -1,16 +1,15 @@
 import os
 from datetime import datetime
 
+from monty.serialization import loadfn
+from pymatgen.analysis.structure_matcher import ElementComparator, StructureMatcher
+from pymatgen.core import Structure
 from pymongo import ReturnDocument
 from tqdm import tqdm
 
-from atomate.utils.utils import get_mongolike, get_logger
+from atomate.utils.utils import get_database, get_logger, get_mongolike
 from atomate.vasp.builders.base import AbstractBuilder
-from atomate.vasp.builders.utils import dbid_to_str, dbid_to_int
-from atomate.utils.utils import get_database
-from monty.serialization import loadfn
-from pymatgen.core import Structure
-from pymatgen.analysis.structure_matcher import StructureMatcher, ElementComparator
+from atomate.vasp.builders.utils import dbid_to_int, dbid_to_str
 
 logger = get_logger(__name__)
 
@@ -62,11 +61,11 @@ def __init__(
         self.properties_root = x.get("properties_root", [])
 
         self._materials = materials_write
-        if self._materials.count() == 0:
+        if self._materials.count_documents({}) == 0:
             self._build_indexes()
 
         self._counter = counter_write
-        if self._counter.find({"_id": "materialid"}).count() == 0:
+        if self._counter.count_documents({"_id": "materialid"}) == 0:
             self._counter.insert_one({"_id": "materialid", "c": 0})
 
         self._tasks = tasks_read
@@ -109,7 +108,7 @@ def run(self):
                     m_id = self._create_new_material(taskdoc)
                 self._update_material(m_id, taskdoc)
 
-            except:
+            except Exception:
                 import traceback
 
                 logger.exception("<---")
@@ -143,7 +142,7 @@ def from_file(cls, db_file, m="materials", c="counter", t="tasks", **kwargs):
         try:
             db_read = get_database(db_file, admin=False)
             db_read.collection_names()  # throw error if auth failed
-        except:
+        except Exception:
             logger.warning(
                 "Warning: could not get read-only database; using write creds"
             )
diff --git a/atomate/vasp/drones.py b/atomate/vasp/drones.py
index 2c85762dd..9cf501f58 100644
--- a/atomate/vasp/drones.py
+++ b/atomate/vasp/drones.py
@@ -4,41 +4,37 @@
 https://groups.google.com/forum/#!topic/pymatgen/pQ-emBpeV5U
 """
 
-import os
-import re
 import datetime
-from fnmatch import fnmatch
-from collections import OrderedDict
-import json
 import glob
+import json
+import os
+import re
 import traceback
 import warnings
+from collections import OrderedDict
+from fnmatch import fnmatch
 
+import numpy as np
 from monty.io import zopen
 from monty.json import jsanitize
 from monty.os.path import which
-
-import numpy as np
-
+from pymatgen.apps.borg.hive import AbstractDrone
+from pymatgen.command_line.bader_caller import bader_analysis_from_path
 from pymatgen.core.composition import Composition
-from pymatgen.core.structure import Structure
 from pymatgen.core.operations import SymmOp
+from pymatgen.core.structure import Structure
 from pymatgen.electronic_structure.bandstructure import BandStructureSymmLine
-from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
-from pymatgen.io.vasp import BSVasprun, Vasprun, Outcar, Locpot
-from pymatgen.io.vasp.inputs import Poscar, Potcar, Incar, Kpoints
+from pymatgen.io.vasp import BSVasprun, Locpot, Outcar, Vasprun
+from pymatgen.io.vasp.inputs import Incar, Kpoints, Poscar, Potcar
 from pymatgen.io.vasp.outputs import Chgcar
-from pymatgen.apps.borg.hive import AbstractDrone
-from pymatgen.command_line.bader_caller import bader_analysis_from_path
-
-from atomate.utils.utils import get_uri
+from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
 
-from atomate.utils.utils import get_logger
 from atomate import __version__ as atomate_version
+from atomate.utils.utils import get_logger, get_uri
 from atomate.vasp.config import (
-    STORE_VOLUMETRIC_DATA,
     STORE_ADDITIONAL_JSON,
     STORE_BADER,
+    STORE_VOLUMETRIC_DATA,
 )
 
 __author__ = "Kiran Mathew, Shyue Ping Ong, Shyam Dwaraknath, Anubhav Jain"
@@ -486,12 +482,12 @@ def process_vasprun(self, dir_name, taskname, filename):
             d["output"][k] = d["output"].pop(v)
 
         # Process bandstructure and DOS
-        if self.bandstructure_mode != False:  # noqa
+        if self.bandstructure_mode is not False:  # noqa
             bs = self.process_bandstructure(vrun)
             if bs:
                 d["bandstructure"] = bs
 
-        if self.parse_dos != False:  # noqa
+        if self.parse_dos is not False:  # noqa
             dos = self.process_dos(vrun)
             if dos:
                 d["dos"] = dos
diff --git a/atomate/vasp/firetasks/__init__.py b/atomate/vasp/firetasks/__init__.py
index 1bd9dff88..50a2c4766 100644
--- a/atomate/vasp/firetasks/__init__.py
+++ b/atomate/vasp/firetasks/__init__.py
@@ -1,5 +1,52 @@
-from .glue_tasks import *
-from .neb_tasks import *
-from .parse_outputs import *
-from .run_calc import *
-from .write_inputs import *
+from .glue_tasks import (
+    CheckBandgap,
+    CheckStability,
+    CopyVaspOutputs,
+    GetInterpolatedPOSCAR,
+    pass_vasp_result,
+)
+from .neb_tasks import (
+    VASP_NEB_OUTPUT_FILES,
+    VASP_NEB_OUTPUT_SUB_FILES,
+    RunNEBVaspFake,
+    TransferNEBTask,
+    WriteNEBFromEndpoints,
+    WriteNEBFromImages,
+)
+from .parse_outputs import (
+    BoltztrapToDb,
+    ElasticTensorToDb,
+    FitEOSToDb,
+    GibbsAnalysisToDb,
+    HubbardHundLinRespToDb,
+    JsonToDb,
+    MagneticDeformationToDb,
+    MagneticOrderingsToDb,
+    PolarizationToDb,
+    RamanTensorToDb,
+    ThermalExpansionCoeffToDb,
+    VaspToDb,
+)
+from .run_calc import (
+    RunBoltztrap,
+    RunNoVasp,
+    RunVaspCustodian,
+    RunVaspDirect,
+    RunVaspFake,
+)
+from .write_inputs import (
+    ModifyIncar,
+    ModifyKpoints,
+    ModifyPotcar,
+    WriteNormalmodeDisplacedPoscar,
+    WriteScanRelaxFromPrev,
+    WriteTransmutedStructureIOSet,
+    WriteVaspFromIOSet,
+    WriteVaspFromIOSetFromInterpolatedPOSCAR,
+    WriteVaspFromPMGObjects,
+    WriteVaspHSEBSFromPrev,
+    WriteVaspNMRFromPrev,
+    WriteVaspNSCFFromPrev,
+    WriteVaspSOCFromPrev,
+    WriteVaspStaticFromPrev,
+)
diff --git a/atomate/vasp/firetasks/approx_neb_tasks.py b/atomate/vasp/firetasks/approx_neb_tasks.py
index 4e92e4eb0..ca9ed699b 100644
--- a/atomate/vasp/firetasks/approx_neb_tasks.py
+++ b/atomate/vasp/firetasks/approx_neb_tasks.py
@@ -1,14 +1,15 @@
-from pymatgen.core import Element, Structure
-from pymatgen.analysis.path_finder import NEBPathfinder, ChgcarPotential
+from datetime import datetime
+from json import loads
+
 from fireworks import FiretaskBase, FWAction, explicit_serialize
-from atomate.utils.utils import env_chk
-from atomate.utils.utils import get_logger
-from atomate.vasp.database import VaspCalcDb
-from pymatgen.io.vasp.sets import MPRelaxSet
-from pydash import get
 from monty.json import MontyEncoder
-from json import loads
-from datetime import datetime
+from pydash import get
+from pymatgen.analysis.path_finder import ChgcarPotential, NEBPathfinder
+from pymatgen.core import Element, Structure
+from pymatgen.io.vasp.sets import MPRelaxSet
+
+from atomate.utils.utils import env_chk, get_logger
+from atomate.vasp.database import VaspCalcDb
 
 __author__ = "Ann Rutt"
 __email__ = "acrutt@lbl.gov"
@@ -55,7 +56,8 @@ def run_task(self, fw_spec):
         approx_neb_db = mmdb.db["approx_neb"]
         if approx_neb_db.count_documents({"wf_uuid": wf_uuid}) != 0:
             raise ValueError(
-                "Provided approx_neb_wf_uuid is not unique. A unique workflow id is required for querying in the approx_neb workflow."
+                "Provided approx_neb_wf_uuid is not unique. A unique workflow id is required "
+                "for querying in the approx_neb workflow."
             )
 
         # update host task doc (from host_task_id) with unique wf_uuid
@@ -337,12 +339,12 @@ def run_task(self, fw_spec):
             approx_neb_doc = mmdb.collection.find_one({"wf_uuid": wf_uuid})
             structure = Structure.from_dict(get(approx_neb_doc, structure_path))
 
-        except:
+        except Exception:
             raise ValueError("Error getting structure from approx_neb collection")
 
         # get vasp input set and write files
         override_default_vasp_params = self.get("override_default_vasp_params") or {}
-        if self["vasp_input_set"] == None or override_default_vasp_params != {}:
+        if self["vasp_input_set"] is None or override_default_vasp_params != {}:
             vis = MPRelaxSet(
                 structure, **override_default_vasp_params, sort_structure=False
             )
@@ -427,7 +429,7 @@ def run_task(self, fw_spec):
                 },
             },
         )
-        if task_doc == None:
+        if task_doc is None:
             raise ValueError(
                 f"Error updating approx neb end point with task_id: {t_id}"
             )
@@ -500,7 +502,7 @@ def run_task(self, fw_spec):
                 c = [int(combo[0]), int(combo[1])]
             else:
                 raise ValueError("NEBPathfinder requires exactly two end points")
-        except:
+        except Exception:
             raise ValueError(
                 f"{str(end_points_combo)} end_points_combo input is incorrect"
             )
@@ -682,7 +684,7 @@ def get_images_list(self, structure_docs, scheme, fixed_index, fixed_specie):
         Returns:
              list of structure objects
         """
-        if isinstance(structure_docs, (list)) == False:
+        if isinstance(structure_docs, (list)) is False:
             raise TypeError("list input required for structure_docs")
 
         if scheme == "fix_two_atom":
diff --git a/atomate/vasp/firetasks/glue_tasks.py b/atomate/vasp/firetasks/glue_tasks.py
index 24cfe195a..a6bcef7a0 100644
--- a/atomate/vasp/firetasks/glue_tasks.py
+++ b/atomate/vasp/firetasks/glue_tasks.py
@@ -1,39 +1,35 @@
-import glob
-import warnings
-
-from pymatgen.io.vasp import Vasprun
-from monty.os.path import zpath
-
 """
 This module defines tasks that acts as a glue between other vasp Firetasks to allow communication
 between different Firetasks and Fireworks. This module also contains tasks that affect the control
 flow of the workflow, e.g. tasks to check stability or the gap is within a certain range.
 """
-
-import shutil
+import glob
 import gzip
 import os
 import re
+import shutil
+import warnings
 
+from fireworks import FiretaskBase, FWAction, explicit_serialize
+from monty.os.path import zpath
+from pymatgen.core.structure import Structure
 from pymatgen.ext.matproj import MPRester
+from pymatgen.io.vasp import Vasprun
 from pymatgen.io.vasp.sets import get_vasprun_outcar
-from pymatgen.core.structure import Structure
 
-from fireworks import explicit_serialize, FiretaskBase, FWAction
-
-from atomate.utils.utils import env_chk, get_logger
 from atomate.common.firetasks.glue_tasks import (
-    get_calc_loc,
-    PassResult,
     CopyFiles,
     CopyFilesFromCalcLoc,
+    PassResult,
+    get_calc_loc,
 )
-
-logger = get_logger(__name__)
+from atomate.utils.utils import env_chk, get_logger
 
 __author__ = "Anubhav Jain, Kiran Mathew"
 __email__ = "ajain@lbl.gov, kmathew@lbl.gov"
 
+logger = get_logger(__name__)
+
 
 @explicit_serialize
 class CopyVaspOutputs(CopyFiles):
diff --git a/atomate/vasp/firetasks/lobster_tasks.py b/atomate/vasp/firetasks/lobster_tasks.py
index 92274337c..51b41bd35 100644
--- a/atomate/vasp/firetasks/lobster_tasks.py
+++ b/atomate/vasp/firetasks/lobster_tasks.py
@@ -271,7 +271,7 @@ def run_task(self, fw_spec):
             task_doc.update(additional_fields)
 
         task_doc.update(get_meta_from_structure(struct))
-        if vasp_calc_dir != None:
+        if vasp_calc_dir is not None:
             task_doc["vasp_dir_name"] = vasp_calc_dir
         else:
             task_doc["vasp_dir_name"] = vasp_calc_loc["path"]
diff --git a/atomate/vasp/firetasks/parse_outputs.py b/atomate/vasp/firetasks/parse_outputs.py
index 071e89e88..a9ec69037 100644
--- a/atomate/vasp/firetasks/parse_outputs.py
+++ b/atomate/vasp/firetasks/parse_outputs.py
@@ -6,26 +6,18 @@
 
 import numpy as np
 import scipy
-
-from monty.json import MontyEncoder, jsanitize
-from monty.os.path import zpath
-from pydash.objects import has, get
-
-from atomate.vasp.config import DEFUSE_UNSUCCESSFUL
 from fireworks import FiretaskBase, FWAction, explicit_serialize
 from fireworks.utilities.fw_serializers import DATETIME_HANDLER
-
-from pymatgen.core import Structure
+from monty.json import MontyEncoder, jsanitize
+from monty.os.path import zpath
+from pydash.objects import get, has
 from pymatgen.analysis.elasticity.elastic import ElasticTensor, ElasticTensorExpansion
-from pymatgen.analysis.elasticity.strain import Strain, Deformation
+from pymatgen.analysis.elasticity.strain import Deformation, Strain
 from pymatgen.analysis.elasticity.stress import Stress
-from pymatgen.electronic_structure.boltztrap import BoltztrapAnalyzer
-from pymatgen.io.vasp.sets import get_vasprun_outcar
-from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
 from pymatgen.analysis.ferroelectricity.polarization import (
+    EnergyTrend,
     Polarization,
     get_total_ionic_dipole,
-    EnergyTrend,
 )
 from pymatgen.analysis.magnetism import (
     CollinearMagneticStructureAnalyzer,
@@ -33,13 +25,16 @@
     magnetic_deformation,
 )
 from pymatgen.command_line.bader_caller import bader_analysis_from_path
+from pymatgen.core import Structure
+from pymatgen.electronic_structure.boltztrap import BoltztrapAnalyzer
+from pymatgen.io.vasp.sets import get_vasprun_outcar
+from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
 
 from atomate.common.firetasks.glue_tasks import get_calc_loc
-from atomate.utils.utils import env_chk, get_meta_from_structure
-from atomate.utils.utils import get_logger
+from atomate.utils.utils import env_chk, get_logger, get_meta_from_structure
+from atomate.vasp.config import DEFUSE_UNSUCCESSFUL, STORE_VOLUMETRIC_DATA
 from atomate.vasp.database import VaspCalcDb
-from atomate.vasp.drones import VaspDrone, BADER_EXE_EXISTS
-from atomate.vasp.config import STORE_VOLUMETRIC_DATA
+from atomate.vasp.drones import BADER_EXE_EXISTS, VaspDrone
 
 __author__ = "Anubhav Jain, Kiran Mathew, Shyam Dwaraknath"
 __email__ = "ajain@lbl.gov, kmathew@lbl.gov, shyamd@lbl.gov"
@@ -184,10 +179,10 @@ def run_task(self, fw_spec):
                         )
             else:
                 raise RuntimeError(
-                    "Inappropriate type {} for task_fields_to_push. It must be a "
+                    f"Inappropriate type {type(task_fields_to_push)} for task_fields_to_push. It must be a "
                     "dictionary of format: {key: path} where key refers to a field "
                     "in the spec and path is a full mongo-style path to a "
-                    "field in the task document".format(type(task_fields_to_push))
+                    "field in the task document"
                 )
 
         return FWAction(
@@ -685,7 +680,7 @@ def run_task(self, fw_spec):
                 gibbs_dict["success"] = True
 
         # quasi-harmonic analysis failed, set the flag to false
-        except:
+        except Exception:
             import traceback
 
             logger.warning("Quasi-harmonic analysis failed!")
@@ -890,6 +885,7 @@ def run_task(self, fw_spec):
         # a builder to put it into materials collection... -computron
         logger.info("Thermal expansion coefficient calculation complete.")
 
+
 @explicit_serialize
 class HubbardHundLinRespToDb(FiretaskBase):
     """
@@ -907,8 +903,13 @@ class HubbardHundLinRespToDb(FiretaskBase):
             used to make it easier to retrieve task docs
     """
 
-    required_params = ["num_perturb", "spin_polarized", "relax_nonmagnetic",
-                       "db_file", "wf_uuid"]
+    required_params = [
+        "num_perturb",
+        "spin_polarized",
+        "relax_nonmagnetic",
+        "db_file",
+        "wf_uuid",
+    ]
     optional_params = []
 
     summaries = []
@@ -916,17 +917,16 @@ class HubbardHundLinRespToDb(FiretaskBase):
     def run_task(self, fw_spec):
 
         from atomate.vasp.analysis.linear_response import (
-            procure_response_dict,
-            response_fit, response_fit_stepped,
-            obtain_response_matrices,
-            inverse_matrix_uncertainty, chi_inverse, 
-            compute_u_pointwise, compute_uj_simple_two_by_two, 
+            chi_inverse,
+            compute_u_pointwise,
             compute_uj_scaled_two_by_two,
+            compute_uj_simple_two_by_two,
+            obtain_response_matrices,
+            procure_response_dict,
         )
 
         uuid = self["wf_uuid"]
         db_file = env_chk(self.get("db_file"), fw_spec)
-        to_db = self.get("to_db", True)
 
         mmdb = VaspCalcDb.from_db_file(db_file, admin=True)
 
@@ -934,18 +934,16 @@ def run_task(self, fw_spec):
         spin_polarized = bool(self["spin_polarized"])
         relax_nonmagnetic = bool(self["relax_nonmagnetic"])
 
-        keys = ['ground_state', 'NSCF', 'SCF']
-        response_dict = {'ground_state': {}, 'NSCF': {}, 'SCF': {}}
+        keys = ["ground_state", "NSCF", "SCF"]
+        response_dict = {"ground_state": {}, "NSCF": {}, "SCF": {}}
         perturb_dict = {}
 
-        magnet_order_gs = None
-
         for key in keys:
             for i in range(num_perturb_sites):
-                response_dict[key].update({'site'+str(i): {}})
-                for qkey in ['Vup', 'Nup', 'Vdn', 'Ndn', 'Ntot', 'Mz']:
-                    response_dict[key]['site'+str(i)].update({qkey: []})
-            response_dict[key].update({'magnetic order': []})
+                response_dict[key].update({"site" + str(i): {}})
+                for qkey in ["Vup", "Nup", "Vdn", "Ndn", "Ntot", "Mz"]:
+                    response_dict[key]["site" + str(i)].update({qkey: []})
+            response_dict[key].update({"magnetic order": []})
 
         docs = list(mmdb.collection.find({"wf_meta.wf_uuid": uuid}))
 
@@ -955,7 +953,7 @@ def run_task(self, fw_spec):
         for i in range(num_perturb_sites):
             for d in docs:
                 try:
-                    ldaul = int(d['calcs_reversed'][0]['input']['incar']['LDAUL'][i])
+                    ldaul = int(d["calcs_reversed"][0]["input"]["incar"]["LDAUL"][i])
                     if ldaul > ldaul_vals[i]:
                         ldaul_vals[i] = ldaul
                         break
@@ -966,33 +964,36 @@ def run_task(self, fw_spec):
         analyzer_gs = None
         for d in docs:
             struct_final = Structure.from_dict(d["output"]["structure"])
-            incar_dict = d['calcs_reversed'][0]['input']['incar']
+            incar_dict = d["calcs_reversed"][0]["input"]["incar"]
 
-            use_calc = (int(incar_dict.get("ICHARG", 0)) != 11) \
-                        and ((not relax_nonmagnetic) or (relax_nonmagnetic \
-                        and int(incar_dict.get("ISPIN", 1)) == 2))
+            use_calc = (int(incar_dict.get("ICHARG", 0)) != 11) and (
+                (not relax_nonmagnetic)
+                or (relax_nonmagnetic and int(incar_dict.get("ISPIN", 1)) == 2)
+            )
             if use_calc:
                 is_gs = True
                 for i in range(num_perturb_sites):
-                    if incar_dict.get('LDAUU', False) \
-                            and incar_dict.get('LDAUJ', False):
-                        v_up = float(incar_dict['LDAUU'][i])
-                        v_dn = float(incar_dict['LDAUJ'][i])
+                    if incar_dict.get("LDAUU", False) and incar_dict.get(
+                        "LDAUJ", False
+                    ):
+                        v_up = float(incar_dict["LDAUU"][i])
+                        v_dn = float(incar_dict["LDAUJ"][i])
                     else:
                         v_up, v_dn = 0.0, 0.0
                     if v_up != 0.0 or v_dn != 0.0:
                         is_gs = False
                 if is_gs:
                     analyzer_gs = CollinearMagneticStructureAnalyzer(
-                                struct_final, threshold=0.61)
+                        struct_final, threshold=0.61
+                    )
 
-        # keep track of calculations skipped due to magnetic ordering 
+        # keep track of calculations skipped due to magnetic ordering
         calcs_skipped = []
         for d in docs:
 
             struct_final = Structure.from_dict(d["output"]["structure"])
-            incar_dict = d['calcs_reversed'][0]['input']['incar']
-            outcar_dict = d['calcs_reversed'][0]['output']['outcar']
+            incar_dict = d["calcs_reversed"][0]["input"]["incar"]
+            outcar_dict = d["calcs_reversed"][0]["output"]["outcar"]
 
             # Check if task is used in LR analysis
             use_calc = False
@@ -1001,16 +1002,18 @@ def run_task(self, fw_spec):
                 use_calc = True
                 rkey = keys[1]
             else:
-                use_calc = (not relax_nonmagnetic) or (relax_nonmagnetic \
-                            and int(incar_dict.get("ISPIN", 1)) == 2)
+                use_calc = (not relax_nonmagnetic) or (
+                    relax_nonmagnetic and int(incar_dict.get("ISPIN", 1)) == 2
+                )
 
                 if use_calc:
                     is_gs = True
                     for i in range(num_perturb_sites):
-                        if incar_dict.get('LDAUU', False) \
-                                and incar_dict.get('LDAUJ', False):
-                            v_up = float(incar_dict['LDAUU'][i])
-                            v_dn = float(incar_dict['LDAUJ'][i])
+                        if incar_dict.get("LDAUU", False) and incar_dict.get(
+                            "LDAUJ", False
+                        ):
+                            v_up = float(incar_dict["LDAUU"][i])
+                            v_dn = float(incar_dict["LDAUJ"][i])
                         else:
                             v_up, v_dn = 0.0, 0.0
                         if v_up != 0.0 or v_dn != 0.0:
@@ -1024,17 +1027,26 @@ def run_task(self, fw_spec):
 
             if use_calc:
                 procure_response_dict(
-                    struct_final, num_perturb_sites, 
-                    incar_dict, outcar_dict, 
-                    inv_block_dict, response_dict, perturb_dict,
-                    rkey, keys, ldaul_vals,
-                    analyzer_gs)
+                    struct_final,
+                    num_perturb_sites,
+                    incar_dict,
+                    outcar_dict,
+                    inv_block_dict,
+                    response_dict,
+                    perturb_dict,
+                    rkey,
+                    keys,
+                    ldaul_vals,
+                    analyzer_gs,
+                )
 
         for j in range(num_perturb_sites):
-            for qkey in ['Vup', 'Nup', 'Vdn', 'Ndn', 'Ntot', 'Mz']:
+            for qkey in ["Vup", "Nup", "Vdn", "Ndn", "Ntot", "Mz"]:
                 for i in [1, 2]:
-                    response_dict[keys[i]]['site'+str(j)][qkey].extend(response_dict[keys[0]]['site'+str(j)][qkey])
-        k = 'magnetic order'
+                    response_dict[keys[i]]["site" + str(j)][qkey].extend(
+                        response_dict[keys[0]]["site" + str(j)][qkey]
+                    )
+        k = "magnetic order"
         for i in [1, 2]:
             response_dict[keys[i]][k].extend(response_dict[keys[0]][k])
 
@@ -1044,8 +1056,12 @@ def run_task(self, fw_spec):
         else:
             n_response = num_perturb_sites
 
-        chi_matrix_nscf, chi_matrix_scf, chi_nscf_err, chi_scf_err = obtain_response_matrices(
-            n_response, spin_polarized, response_dict, keys)
+        (
+            chi_matrix_nscf,
+            chi_matrix_scf,
+            chi_nscf_err,
+            chi_scf_err,
+        ) = obtain_response_matrices(n_response, spin_polarized, response_dict, keys)
 
         # Functions to help serialize numpy matrices
         def array_to_list(a):
@@ -1071,17 +1087,21 @@ def nested_copy(a):
 
         for key, method in zip(inversion_keys, inversion_methods):
 
-            hubbard_hund_dict.update({key: {"values":{}, "matrices":{}}})
+            hubbard_hund_dict.update({key: {"values": {}, "matrices": {}}})
 
             try:
-                (chi_block_scf, chi_scf_inv, \
-                 chi_scf_inv_var, chi_scf_inv_jacobs) = chi_inverse(
-                     chi_matrix_scf, chi_scf_err, method
-                 )
-                (chi_block_nscf, chi_nscf_inv, \
-                 chi_nscf_inv_var, chi_nscf_inv_jacobs) = chi_inverse(
-                     chi_matrix_nscf, chi_nscf_err, method
-                 )
+                (
+                    chi_block_scf,
+                    chi_scf_inv,
+                    chi_scf_inv_var,
+                    chi_scf_inv_jacobs,
+                ) = chi_inverse(chi_matrix_scf, chi_scf_err, method)
+                (
+                    chi_block_nscf,
+                    chi_nscf_inv,
+                    chi_nscf_inv_var,
+                    chi_nscf_inv_jacobs,
+                ) = chi_inverse(chi_matrix_nscf, chi_nscf_err, method)
 
                 f_matrix = chi_scf_inv - chi_nscf_inv
                 f_matrix_err = np.sqrt(chi_scf_inv_var + chi_nscf_inv_var)
@@ -1092,90 +1112,143 @@ def nested_copy(a):
 
                             # point-wise (diagonal 2x2) formula
                             uval, uval_err = compute_u_pointwise(
-                                i, f_matrix, f_matrix_err,
+                                i,
+                                f_matrix,
+                                f_matrix_err,
                             )
 
-                            hubbard_hund_dict[key]["values"].update({
-                                "site"+str(i): perturb_dict["site"+str(i)].copy()})
-                            hubbard_hund_dict[key]["values"]["site"+str(i)].update({
-                                "U":{"value":uval, "error":uval_err}})
+                            hubbard_hund_dict[key]["values"].update(
+                                {"site" + str(i): perturb_dict["site" + str(i)].copy()}
+                            )
+                            hubbard_hund_dict[key]["values"]["site" + str(i)].update(
+                                {"U": {"value": uval, "error": uval_err}}
+                            )
                     else:
                         for i in range(num_perturb_sites):
 
                             # first "simple 2x2" formula
-                            uval, uval_err, jval, jval_err = compute_uj_simple_two_by_two(
-                                i, f_matrix, f_matrix_err,
+                            (
+                                uval,
+                                uval_err,
+                                jval,
+                                jval_err,
+                            ) = compute_uj_simple_two_by_two(
+                                i,
+                                f_matrix,
+                                f_matrix_err,
                             )
 
                             # update dictionary values
-                            hubbard_hund_dict[key]["values"].update({
-                                "site"+str(i): perturb_dict["site"+str(i)].copy()})
-                            hubbard_hund_dict[key]["values"]["site"+str(i)]["simple"] = {}
-                            hubbard_hund_dict[key]["values"]["site"+str(i)]["simple"].update({
-                                "U":{"value":uval, "error":uval_err}})
-                            hubbard_hund_dict[key]["values"]["site"+str(i)]["simple"].update({
-                                "J":{"value":jval, "error":jval_err}})
+                            hubbard_hund_dict[key]["values"].update(
+                                {"site" + str(i): perturb_dict["site" + str(i)].copy()}
+                            )
+                            hubbard_hund_dict[key]["values"]["site" + str(i)][
+                                "simple"
+                            ] = {}
+                            hubbard_hund_dict[key]["values"]["site" + str(i)][
+                                "simple"
+                            ].update({"U": {"value": uval, "error": uval_err}})
+                            hubbard_hund_dict[key]["values"]["site" + str(i)][
+                                "simple"
+                            ].update({"J": {"value": jval, "error": jval_err}})
 
                             try:
                                 # second "scaled 2x2" formula
-                                uval, uval_err, jval, jval_err = compute_uj_scaled_two_by_two(
-                                    i, f_matrix, f_matrix_err,
-                                    chi_matrix_scf, chi_scf_err, chi_matrix_nscf, chi_nscf_err,
-                                    chi_scf_inv_jacobs, chi_nscf_inv_jacobs,
+                                (
+                                    uval,
+                                    uval_err,
+                                    jval,
+                                    jval_err,
+                                ) = compute_uj_scaled_two_by_two(
+                                    i,
+                                    f_matrix,
+                                    f_matrix_err,
+                                    chi_matrix_scf,
+                                    chi_scf_err,
+                                    chi_matrix_nscf,
+                                    chi_nscf_err,
+                                    chi_scf_inv_jacobs,
+                                    chi_nscf_inv_jacobs,
                                 )
 
                                 # update dictionary values
-                                hubbard_hund_dict[key]["values"]["site"+str(i)]["scaled"] = {}
-                                hubbard_hund_dict[key]["values"]["site"+str(i)]["scaled"].update({
-                                    "U":{"value":uval, "error":uval_err}})
-                                hubbard_hund_dict[key]["values"]["site"+str(i)]["scaled"].update({
-                                    "J":{"value":jval, "error":jval_err}})
+                                hubbard_hund_dict[key]["values"]["site" + str(i)][
+                                    "scaled"
+                                ] = {}
+                                hubbard_hund_dict[key]["values"]["site" + str(i)][
+                                    "scaled"
+                                ].update({"U": {"value": uval, "error": uval_err}})
+                                hubbard_hund_dict[key]["values"]["site" + str(i)][
+                                    "scaled"
+                                ].update({"J": {"value": jval, "error": jval_err}})
 
                             except Exception as exc:
-                                logger.warning('Error computing U & J values using scaled formula',  exc)
+                                logger.warning(
+                                    "Error computing U & J values using scaled formula",
+                                    exc,
+                                )
 
                 else:
                     for i in range(num_perturb_sites):
-                        uval = f_matrix[i,i]
-                        uval_err = f_matrix_err[i,i]
+                        uval = f_matrix[i, i]
+                        uval_err = f_matrix_err[i, i]
 
-                        hubbard_hund_dict[key]["values"].update({
-                            "site"+str(i): perturb_dict["site"+str(i)].copy()})
-                        hubbard_hund_dict[key]["values"]["site"+str(i)]["simple"] = {}
-                        hubbard_hund_dict[key]["values"]["site"+str(i)]["simple"].update({
-                            "U":{"value":uval, "error":uval_err}})
+                        hubbard_hund_dict[key]["values"].update(
+                            {"site" + str(i): perturb_dict["site" + str(i)].copy()}
+                        )
+                        hubbard_hund_dict[key]["values"]["site" + str(i)]["simple"] = {}
+                        hubbard_hund_dict[key]["values"]["site" + str(i)][
+                            "simple"
+                        ].update({"U": {"value": uval, "error": uval_err}})
 
                 # convert numpy arrays to nested lists
-                f_matrix, f_matrix_err =  array_to_list(f_matrix), \
-                    array_to_list(f_matrix_err)
-                chi_matrix_scf_list, chi_block_scf = array_to_list(chi_matrix_scf), \
-                    array_to_list(chi_block_scf)
-                chi_scf_inv, chi_scf_inv_var = array_to_list(chi_scf_inv), \
-                    array_to_list(chi_scf_inv_var)
-                chi_matrix_nscf_list, chi_block_nscf = array_to_list(chi_matrix_nscf), \
-                    array_to_list(chi_block_nscf)
-                chi_nscf_inv, chi_nscf_inv_var = array_to_list(chi_nscf_inv), \
-                    array_to_list(chi_nscf_inv_var)
+                f_matrix, f_matrix_err = array_to_list(f_matrix), array_to_list(
+                    f_matrix_err
+                )
+                chi_matrix_scf_list, chi_block_scf = array_to_list(
+                    chi_matrix_scf
+                ), array_to_list(chi_block_scf)
+                chi_scf_inv, chi_scf_inv_var = array_to_list(
+                    chi_scf_inv
+                ), array_to_list(chi_scf_inv_var)
+                chi_matrix_nscf_list, chi_block_nscf = array_to_list(
+                    chi_matrix_nscf
+                ), array_to_list(chi_block_nscf)
+                chi_nscf_inv, chi_nscf_inv_var = array_to_list(
+                    chi_nscf_inv
+                ), array_to_list(chi_nscf_inv_var)
 
             except Exception as exc:
                 f_matrix, f_matrix_err = [], []
                 chi_matrix_scf_list, chi_block_scf = array_to_list(chi_matrix_scf), []
                 chi_scf_inv, chi_scf_inv_var, chi_scf_inv_jacobs = [], [], []
-                chi_matrix_nscf_list, chi_block_nscf = array_to_list(chi_matrix_nscf), []
+                chi_matrix_nscf_list, chi_block_nscf = (
+                    array_to_list(chi_matrix_nscf),
+                    [],
+                )
                 chi_nscf_inv, chi_nscf_inv_var, chi_nscf_inv_jacobs = [], [], []
-                logger.warning('Screening matrix compute fail',  exc)
+                logger.warning("Screening matrix compute fail", exc)
 
             hubbard_hund_dict[key]["matrices"].update(
-                {"f_matrix":nested_copy(f_matrix),
-                 "f_matrix_err":nested_copy(f_matrix_err)})
+                {
+                    "f_matrix": nested_copy(f_matrix),
+                    "f_matrix_err": nested_copy(f_matrix_err),
+                }
+            )
             hubbard_hund_dict[key]["matrices"].update(
-                {"chi_block_scf":nested_copy(chi_block_scf),
-                 "chi_scf_inv": nested_copy(chi_scf_inv),
-                 "chi_scf_inv_var": nested_copy(chi_scf_inv_var)})
+                {
+                    "chi_block_scf": nested_copy(chi_block_scf),
+                    "chi_scf_inv": nested_copy(chi_scf_inv),
+                    "chi_scf_inv_var": nested_copy(chi_scf_inv_var),
+                }
+            )
             hubbard_hund_dict[key]["matrices"].update(
-                {"chi_block_nscf": nested_copy(chi_block_nscf),
-                 "chi_nscf_inv": nested_copy(chi_nscf_inv),
-                 "chi_nscf_inv_var": nested_copy(chi_nscf_inv_var)})
+                {
+                    "chi_block_nscf": nested_copy(chi_block_nscf),
+                    "chi_nscf_inv": nested_copy(chi_nscf_inv),
+                    "chi_nscf_inv_var": nested_copy(chi_nscf_inv_var),
+                }
+            )
 
         structure = None
         if docs:
@@ -1185,18 +1258,23 @@ def nested_copy(a):
 
         summary = {}
         if structure:
-            summary.update({'formula_pretty': structure.composition.reduced_formula})
-            summary.update({'structure_groundstate': structure.as_dict()})
-        summary.update({'perturb_sites': perturb_dict})
-        summary.update({'datapoints': response_dict})
+            summary.update({"formula_pretty": structure.composition.reduced_formula})
+            summary.update({"structure_groundstate": structure.as_dict()})
+        summary.update({"perturb_sites": perturb_dict})
+        summary.update({"datapoints": response_dict})
         summary.update(
-            {'response_matrices': {'chi_nscf': chi_matrix_nscf_list,
-                                   'chi_scf': chi_matrix_scf_list}})
-        summary.update({'hubbard_hund_results': hubbard_hund_dict})
-        summary.update({'calcs_skipped': calcs_skipped})
+            {
+                "response_matrices": {
+                    "chi_nscf": chi_matrix_nscf_list,
+                    "chi_scf": chi_matrix_scf_list,
+                }
+            }
+        )
+        summary.update({"hubbard_hund_results": hubbard_hund_dict})
+        summary.update({"calcs_skipped": calcs_skipped})
 
         summary.update({"created_at": datetime.utcnow()})
-        summary.update({'wf_meta': {'wf_uuid': uuid}})
+        summary.update({"wf_meta": {"wf_uuid": uuid}})
 
         if fw_spec.get("tags", None):
             summary["tags"] = fw_spec["tags"]
@@ -1208,6 +1286,7 @@ def nested_copy(a):
 
         logger.info("Hubbard-Hund linear response analysis is complete.")
 
+
 @explicit_serialize
 class MagneticOrderingsToDb(FiretaskBase):
     """
@@ -1505,7 +1584,7 @@ def run_task(self, fw_spec):
                 "Elapsed time (sec)",
             ]:
                 overall_run_stats[key] = sum(v[key] for v in run_stats.values())
-        except:
+        except Exception:
             logger.error(f"Bad run stats for {uuid}.")
             overall_run_stats = "Bad run stats"
 
diff --git a/atomate/vasp/fireworks/__init__.py b/atomate/vasp/fireworks/__init__.py
index d105ba092..e3df39c3b 100644
--- a/atomate/vasp/fireworks/__init__.py
+++ b/atomate/vasp/fireworks/__init__.py
@@ -1,2 +1,17 @@
-from .core import *
-from .nmr import *
+from .core import (
+    DFPTFW,
+    HSEBSFW,
+    MDFW,
+    NEBFW,
+    SOCFW,
+    BoltztrapFW,
+    NEBRelaxationFW,
+    NonSCFFW,
+    OptimizeFW,
+    RamanFW,
+    ScanOptimizeFW,
+    StaticFW,
+    StaticInterpolateFW,
+    TransmuterFW,
+)
+from .nmr import NMRFW
diff --git a/atomate/vasp/fireworks/core.py b/atomate/vasp/fireworks/core.py
index f820bcbcf..b9bb79d36 100644
--- a/atomate/vasp/fireworks/core.py
+++ b/atomate/vasp/fireworks/core.py
@@ -1,56 +1,53 @@
-import warnings
-
-from atomate.vasp.config import (
-    HALF_KPOINTS_FIRST_RELAX,
-    RELAX_MAX_FORCE,
-    VASP_CMD,
-    DB_FILE,
-    VDW_KERNEL_DIR,
-)
-
 """
 Defines standardized Fireworks that can be chained easily to perform various
 sequences of VASP calculations.
 """
+import warnings
 
 from fireworks import Firework
-
 from pymatgen.core import Structure
 from pymatgen.io.vasp.sets import (
-    MPRelaxSet,
-    MPScanRelaxSet,
     MITMDSet,
     MITRelaxSet,
-    MPStaticSet,
+    MPRelaxSet,
+    MPScanRelaxSet,
     MPSOCSet,
+    MPStaticSet,
 )
 
 from atomate.common.firetasks.glue_tasks import (
-    PassCalcLocs,
     CopyFiles,
     DeleteFiles,
     GzipDir,
+    PassCalcLocs,
+)
+from atomate.vasp.config import (
+    DB_FILE,
+    HALF_KPOINTS_FIRST_RELAX,
+    RELAX_MAX_FORCE,
+    VASP_CMD,
+    VDW_KERNEL_DIR,
 )
 from atomate.vasp.firetasks.glue_tasks import CopyVaspOutputs, pass_vasp_result
-from atomate.vasp.firetasks.neb_tasks import TransferNEBTask
-from atomate.vasp.firetasks.parse_outputs import VaspToDb, BoltztrapToDb
-from atomate.vasp.firetasks.run_calc import (
-    RunVaspCustodian,
-    RunBoltztrap,
+from atomate.vasp.firetasks.neb_tasks import (
+    TransferNEBTask,
+    WriteNEBFromEndpoints,
+    WriteNEBFromImages,
 )
+from atomate.vasp.firetasks.parse_outputs import BoltztrapToDb, VaspToDb
+from atomate.vasp.firetasks.run_calc import RunBoltztrap, RunVaspCustodian
 from atomate.vasp.firetasks.write_inputs import (
+    ModifyIncar,
     WriteNormalmodeDisplacedPoscar,
+    WriteScanRelaxFromPrev,
     WriteTransmutedStructureIOSet,
     WriteVaspFromIOSet,
+    WriteVaspFromIOSetFromInterpolatedPOSCAR,
     WriteVaspHSEBSFromPrev,
     WriteVaspNSCFFromPrev,
     WriteVaspSOCFromPrev,
     WriteVaspStaticFromPrev,
-    WriteVaspFromIOSetFromInterpolatedPOSCAR,
-    WriteScanRelaxFromPrev,
-    ModifyIncar,
 )
-from atomate.vasp.firetasks.neb_tasks import WriteNEBFromImages, WriteNEBFromEndpoints
 
 
 class OptimizeFW(Firework):
diff --git a/atomate/vasp/submission_filter.py b/atomate/vasp/submission_filter.py
index fae2f6104..f905ed141 100644
--- a/atomate/vasp/submission_filter.py
+++ b/atomate/vasp/submission_filter.py
@@ -84,7 +84,7 @@ def test(self, structure):
                             bs = mpr.get_bandstructure_by_material_id(mpid)
                             if bs:
                                 failures.append(f"NOT_IN_MP=False ({mpid})")
-                        except:
+                        except Exception:
                             pass
                 else:
                     failures.append(f"NOT_IN_MP=False ({mpids[0]})")
diff --git a/atomate/vasp/vasp_config.py b/atomate/vasp/vasp_config.py
index ac1894cea..ad13eae36 100644
--- a/atomate/vasp/vasp_config.py
+++ b/atomate/vasp/vasp_config.py
@@ -1,6 +1,29 @@
-__author__ = "Anubhav Jain <ajain@lbl.gov>"
-
 import warnings
 
+from .config import (  # noqa: F401
+    ADD_MODIFY_INCAR,
+    ADD_NAMEFILE,
+    ADD_WF_METADATA,
+    CUSTODIAN_MAX_ERRORS,
+    DB_FILE,
+    DEFUSE_UNSUCCESSFUL,
+    GAMMA_VASP_CMD,
+    HALF_KPOINTS_FIRST_RELAX,
+    LOBSTER_CMD,
+    LOBSTERINPUT_FILES,
+    LOBSTEROUTPUT_FILES,
+    RELAX_MAX_FORCE,
+    SCRATCH_DIR,
+    SMALLGAP_KPOINT_MULTIPLY,
+    STABILITY_CHECK,
+    STORE_ADDITIONAL_JSON,
+    STORE_BADER,
+    STORE_VOLUMETRIC_DATA,
+    VASP_CMD,
+    VASP_OUTPUT_FILES,
+    VDW_KERNEL_DIR,
+)
+
 warnings.warn("vasp_config renamed to config.")
-from .config import *  # noqa: F401, F403, E402
+
+__author__ = "Anubhav Jain <ajain@lbl.gov>"
diff --git a/atomate/vasp/workflows/__init__.py b/atomate/vasp/workflows/__init__.py
index 75aa9430e..d33786837 100644
--- a/atomate/vasp/workflows/__init__.py
+++ b/atomate/vasp/workflows/__init__.py
@@ -1,1 +1,20 @@
-from .presets.core import *
+from .presets.core import (
+    wf_bandstructure,
+    wf_bandstructure_hse,
+    wf_bandstructure_no_opt,
+    wf_bandstructure_plus_boltztrap,
+    wf_bandstructure_plus_hse,
+    wf_bulk_modulus,
+    wf_dielectric_constant,
+    wf_dielectric_constant_no_opt,
+    wf_elastic_constant,
+    wf_elastic_constant_minimal,
+    wf_gibbs_free_energy,
+    wf_nmr,
+    wf_nudged_elastic_band,
+    wf_piezoelectric_constant,
+    wf_raman_spectra,
+    wf_static,
+    wf_structure_optimization,
+    wf_thermal_expansion,
+)
diff --git a/atomate/vasp/workflows/base/adsorption.py b/atomate/vasp/workflows/base/adsorption.py
index 32bba5349..aca90c488 100644
--- a/atomate/vasp/workflows/base/adsorption.py
+++ b/atomate/vasp/workflows/base/adsorption.py
@@ -3,17 +3,15 @@
 """
 
 import numpy as np
-
 from fireworks import Workflow
-
-from atomate.vasp.fireworks.core import OptimizeFW, TransmuterFW
-from atomate.utils.utils import get_meta_from_structure
-
 from pymatgen.analysis.adsorption import AdsorbateSiteFinder
-from pymatgen.core.surface import generate_all_slabs, Slab
+from pymatgen.core.surface import Slab, generate_all_slabs
+from pymatgen.io.vasp.sets import MVLSlabSet
 from pymatgen.transformations.advanced_transformations import SlabTransformation
 from pymatgen.transformations.standard_transformations import SupercellTransformation
-from pymatgen.io.vasp.sets import MVLSlabSet
+
+from atomate.utils.utils import get_meta_from_structure
+from atomate.vasp.fireworks.core import OptimizeFW, TransmuterFW
 
 __author__ = "Joseph Montoya, Richard Tran"
 __email__ = "montoyjh@lbl.gov"
@@ -176,12 +174,6 @@ def get_slab_trans_params(slab):
 
     min_slab_size = slab_cell_height * slab_layers / total_layers - 0.001
     min_vac_size = slab_cell_height * vac_layers / total_layers - 0.001
-    # params = {"miller_index": [0, 0, 1], "shift": slab.shift,
-    #           "min_slab_size": min_slab_size, "min_vacuum_size": min_vac_size}
-    # trans = SlabTransformation(**params)
-    # new_slab = trans.apply_transformation(slab.oriented_unit_cell)
-    # if slab.composition.reduced_formula == "Si":
-    #     import nose; nose.tools.set_trace()
 
     return {
         "miller_index": [0, 0, 1],
diff --git a/atomate/vasp/workflows/base/electrode.py b/atomate/vasp/workflows/base/electrode.py
index 463edc0a2..88d20c01e 100644
--- a/atomate/vasp/workflows/base/electrode.py
+++ b/atomate/vasp/workflows/base/electrode.py
@@ -1,22 +1,21 @@
+"""
+Define workflow related to battery material simulation --- they all have a working ion
+"""
 from typing import List
 
-from fireworks import Workflow
-from pymatgen.core import Structure
+from fireworks import Firework, Workflow
 from pymatgen.analysis.structure_matcher import StructureMatcher
+from pymatgen.core import Structure
 
+from atomate.common.powerups import powerup_by_kwargs
 from atomate.vasp.config import DB_FILE
+from atomate.vasp.firetasks import pass_vasp_result
 from atomate.vasp.firetasks.electrode_tasks import AnalyzeChgcar, GetInsertionCalcs
+from atomate.vasp.fireworks import OptimizeFW, StaticFW
 
 __author__ = "Jimmy Shen"
 __email__ = "jmmshn@lbl.gov"
 
-from atomate.vasp.fireworks import Firework, OptimizeFW, StaticFW, pass_vasp_result
-from atomate.common.powerups import powerup_by_kwargs
-
-"""
-Define workflow related to battery material simulation --- they all have a working ion
-"""
-
 
 def get_ion_insertion_wf(
     structure: Structure,
@@ -41,8 +40,8 @@ def get_ion_insertion_wf(
     (GetInsertionCalcs) <- This task contains the dynamic workflow creation that will keep inserting working ions
 
     If you use this workflow please cite the following paper:
-        Shen, J.-X., Horton, M., & Persson, K. A. (2020). 
-        A charge-density-based general cation insertion algorithm for generating new Li-ion cathode materials. 
+        Shen, J.-X., Horton, M., & Persson, K. A. (2020).
+        A charge-density-based general cation insertion algorithm for generating new Li-ion cathode materials.
         npj Comput. Mater., 6(161), 1–7. doi: 10.1038/s41524-020-00422-3
 
     Args:
diff --git a/atomate/vasp/workflows/base/exchange.py b/atomate/vasp/workflows/base/exchange.py
index 550f80567..ef2070a6a 100644
--- a/atomate/vasp/workflows/base/exchange.py
+++ b/atomate/vasp/workflows/base/exchange.py
@@ -1,15 +1,11 @@
-from fireworks import Workflow
-from atomate.vasp.powerups import (
-    add_additional_fields_to_taskdocs,
-)
-from atomate.vasp.fireworks.exchange import HeisenbergModelFW, VampireCallerFW
-from atomate.vasp.config import DB_FILE
-from atomate.utils.utils import get_logger
-
 from uuid import uuid4
 
-logger = get_logger(__name__)
+from fireworks import Workflow
 
+from atomate.utils.utils import get_logger
+from atomate.vasp.config import DB_FILE
+from atomate.vasp.fireworks.exchange import HeisenbergModelFW, VampireCallerFW
+from atomate.vasp.powerups import add_additional_fields_to_taskdocs
 
 __author__ = "Nathan C. Frey"
 __maintainer__ = "Nathan C. Frey"
@@ -18,6 +14,8 @@
 __date__ = "July 2019"
 __version__ = 0.1
 
+logger = get_logger(__name__)
+
 
 class ExchangeWF:
     def __init__(
@@ -73,7 +71,7 @@ def __init__(
         for s in magnetic_structures:
             try:
                 s.site_properties["magmom"]
-            except:
+            except Exception:
                 raise RuntimeError(
                     "All structures must have 'magmom' site \
                     property."
diff --git a/atomate/vasp/workflows/base/ferroelectric.py b/atomate/vasp/workflows/base/ferroelectric.py
index aca343cb3..5db05188e 100644
--- a/atomate/vasp/workflows/base/ferroelectric.py
+++ b/atomate/vasp/workflows/base/ferroelectric.py
@@ -4,13 +4,10 @@
 
 from fireworks import Firework, Workflow
 
-from atomate.utils.utils import get_logger, get_a_unique_id
-
-
-from atomate.vasp.fireworks.core import OptimizeFW
-from atomate.vasp.fireworks.polarization import LcalcpolFW
-from atomate.vasp.fireworks.core import HSEBSFW
+from atomate.utils.utils import get_a_unique_id, get_logger
 from atomate.vasp.firetasks.parse_outputs import PolarizationToDb
+from atomate.vasp.fireworks.core import HSEBSFW, OptimizeFW
+from atomate.vasp.fireworks.polarization import LcalcpolFW
 from atomate.vasp.powerups import add_tags
 
 __author__ = "Tess Smidt"
diff --git a/atomate/vasp/workflows/base/gibbs.py b/atomate/vasp/workflows/base/gibbs.py
index 87a455524..209b33818 100644
--- a/atomate/vasp/workflows/base/gibbs.py
+++ b/atomate/vasp/workflows/base/gibbs.py
@@ -5,7 +5,6 @@
 from uuid import uuid4
 
 from fireworks import Firework, Workflow
-
 from pymatgen.analysis.elasticity.strain import Deformation
 from pymatgen.io.vasp.sets import MPStaticSet
 
diff --git a/atomate/vasp/workflows/base/hubbard_hund_linresp.py b/atomate/vasp/workflows/base/hubbard_hund_linresp.py
index c33021239..0f4ffbac3 100644
--- a/atomate/vasp/workflows/base/hubbard_hund_linresp.py
+++ b/atomate/vasp/workflows/base/hubbard_hund_linresp.py
@@ -1,44 +1,32 @@
-# coding: utf-8
-
-
-import os
 import itertools
+import os
+from uuid import uuid4
 
-from atomate.vasp.fireworks.core import StaticFW
-from fireworks import Workflow, Firework
-from atomate.vasp.powerups import (
-    add_additional_fields_to_taskdocs,
-    add_wf_metadata,
-    add_common_powerups,
-)
-from atomate.vasp.workflows.base.core import get_wf
+import numpy as np
+from fireworks import Firework, Workflow
+from pymatgen.core import Element, Structure
+from pymatgen.io.vasp import Incar, Kpoints, Poscar
+from pymatgen.io.vasp.sets import MPStaticSet
 
-from atomate.vasp.firetasks.run_calc import RunVaspCustodian
 from atomate.common.firetasks.glue_tasks import PassCalcLocs
+from atomate.utils.utils import get_logger
+from atomate.vasp.config import ADD_WF_METADATA, DB_FILE, VASP_CMD
 from atomate.vasp.firetasks.glue_tasks import CopyVaspOutputs
-from atomate.vasp.firetasks.parse_outputs import (
-    VaspToDb, HubbardHundLinRespToDb
-)
+from atomate.vasp.firetasks.parse_outputs import HubbardHundLinRespToDb, VaspToDb
+from atomate.vasp.firetasks.run_calc import RunVaspCustodian
 from atomate.vasp.firetasks.write_inputs import WriteVaspFromIOSet
-
-from atomate.utils.utils import get_logger
-
-logger = get_logger(__name__)
-
-from atomate.vasp.config import VASP_CMD, DB_FILE, ADD_WF_METADATA
-
-from uuid import uuid4
-from pymatgen.io.vasp.sets import MPRelaxSet, MPStaticSet
-from pymatgen.io.vasp.inputs import Poscar, Incar
-from pymatgen.core import Lattice, Structure, Element
-
-import numpy as np
+from atomate.vasp.powerups import (
+    add_additional_fields_to_taskdocs,
+    add_common_powerups,
+    add_wf_metadata,
+)
 
 __author__ = "Guy Moore, Martin Siron"
 __maintainer__ = "Guy Moore"
 __email__ = "gmoore@lbl.gov"
 __status__ = "Production"
 __date__ = "February 2020"
+logger = get_logger(__name__)
 
 __hubbard_hund_linresp_wf_version__ = 0.0
 
@@ -46,17 +34,19 @@
 
 
 def get_wf_hubbard_hund_linresp(
-        structure, 
-        user_incar_settings=None,
-        relax_nonmagnetic=True,
-        spin_polarized=True,
-        applied_potential_range=(-0.2, 0.2),
-        num_evals=9,
-        site_indices_perturb=None, species_perturb=None,
-        find_nearest_sites=True,
-        parallel_scheme=0,
-        ediff_tight=None,
-        c=None):
+    structure,
+    user_incar_settings=None,
+    relax_nonmagnetic=True,
+    spin_polarized=True,
+    applied_potential_range=(-0.2, 0.2),
+    num_evals=9,
+    site_indices_perturb=None,
+    species_perturb=None,
+    find_nearest_sites=True,
+    parallel_scheme=0,
+    ediff_tight=None,
+    c=None,
+):
     """
     Compute Hubbard U (and Hund J) on-site interaction values using GGA+U
     linear response method proposed by Cococcioni et. al.
@@ -64,37 +54,37 @@ def get_wf_hubbard_hund_linresp(
     and the spin-polarized response formalism developed by Linscott et. al.
     (DOI: 10.1103/PhysRevB.98.235157)
 
-    This workflow relies on the constrained on-site potential functional implemented in VASP, 
-    with a helpful tutorial found here: 
+    This workflow relies on the constrained on-site potential functional implemented in VASP,
+    with a helpful tutorial found here:
     https://www.vasp.at/wiki/index.php/Calculate_U_for_LSDA%2BU
 
     Args:
         structure:
         user_incar_settings: user INCAR settings
-        relax_nonmagnetic: Restart magnetic SCF runs from 
+        relax_nonmagnetic: Restart magnetic SCF runs from
     non-magnetic calculation, using WAVECAR
         spin_polarized: Perform spin-dependent perturbations
         applied_potential_range: Bounds of applied potential
         num_evals: Number of perturbation evalutaions
-        site_indices_perturb: (must specify if species_perturb=None) 
+        site_indices_perturb: (must specify if species_perturb=None)
     List of site indices within
-    Structure indicating perturbation sites; 
-        species_perturb: (must specify if site_indices_perturb=None) 
+    Structure indicating perturbation sites;
+        species_perturb: (must specify if site_indices_perturb=None)
     List of names of species (string)
     of sites to perturb; First site of that species
     is selected in the structure
-        find_nearest_sites: If set to true and species_perturb != None, 
-    the closest sites (by the Structure distance matrix) will be selected 
+        find_nearest_sites: If set to true and species_perturb != None,
+    the closest sites (by the Structure distance matrix) will be selected
     in the response analysis to account for inter-site screening effects
         parallel_scheme: 0 - (default) self-consistent (SCF)
     runs use WAVECAR from non-self consistent (NSCF) run
     at same applied potential; 1 - SCF runs use WAVECAR
-    from ground-state (V=0) run. 
-    While reusing the WAVECAR from NSCF run in SCF run may be more 
-    efficient (parallel_scheme: 0), the user may also choose to 
-    remove the dependency between NSCF and SCF runs 
+    from ground-state (V=0) run.
+    While reusing the WAVECAR from NSCF run in SCF run may be more
+    efficient (parallel_scheme: 0), the user may also choose to
+    remove the dependency between NSCF and SCF runs
     (parallel_scheme: 1)
-        ediff_tight: Final energy convergence tolerance, 
+        ediff_tight: Final energy convergence tolerance,
     if restarting from a previous run
     (if not specified, will default to pymatgen default EDIFF)
         c: Workflow config dict, in the same format
@@ -120,14 +110,13 @@ def get_wf_hubbard_hund_linresp(
                 found_specie = False
                 for s in range(len(structure)):
                     site = structure[s]
-                    if (Element(str(site.specie)) == Element(specie_u)) \
-                       and (s not in site_indices_perturb):
+                    if (Element(str(site.specie)) == Element(specie_u)) and (
+                        s not in site_indices_perturb
+                    ):
                         found_specie = True
                         break
                 if not found_specie:
-                    raise ValueError(
-                        "Could not find specie(s) in structure."
-                    )
+                    raise ValueError("Could not find specie(s) in structure.")
                 site_indices_perturb.append(s)
 
     elif not site_indices_perturb:
@@ -147,8 +136,12 @@ def get_wf_hubbard_hund_linresp(
     structure.remove_sites(indices=site_indices_perturb)
 
     for site in sites_perturb:
-        structure.insert(i=0, species=site.specie, coords=site.frac_coords,
-                         properties=site.properties)
+        structure.insert(
+            i=0,
+            species=site.specie,
+            coords=site.frac_coords,
+            properties=site.properties,
+        )
 
     # using a uuid for book-keeping,
     # in a similar way to other workflows
@@ -168,26 +161,33 @@ def get_wf_hubbard_hund_linresp(
 
     # setup VASP input sets
     uis_gs, uis_ldau, val_dict, vis_ldau = init_linresp_input_sets(
-        user_incar_settings, structure, num_perturb)
+        user_incar_settings, structure, num_perturb
+    )
 
     fws = []
     index_fw_gs = [0]
 
-    ediff_default = vis_ldau.incar['EDIFF']
+    ediff_default = vis_ldau.incar["EDIFF"]
     if not ediff_tight:
         ediff_tight = 0.1 * ediff_default
 
-    append_linresp_ground_state_fws (
-        fws, structure, num_perturb, index_fw_gs,
-        uis_gs, relax_nonmagnetic, 
-        ediff_default, ediff_tight)
+    append_linresp_ground_state_fws(
+        fws,
+        structure,
+        num_perturb,
+        index_fw_gs,
+        uis_gs,
+        relax_nonmagnetic,
+        ediff_default,
+        ediff_tight,
+    )
 
     # generate list of applied on-site potentials in linear response
     applied_potential_value_list = []
     for counter_perturb in range(num_perturb):
         applied_potential_values = np.linspace(
-            applied_potential_range[0], applied_potential_range[1],
-            num_evals)
+            applied_potential_range[0], applied_potential_range[1], num_evals
+        )
         applied_potential_values = np.around(applied_potential_values, decimals=9)
 
         if 0.0 in applied_potential_values:
@@ -203,10 +203,21 @@ def get_wf_hubbard_hund_linresp(
 
         for v in applied_potential_values:
 
-            append_linresp_perturb_fws (
-                v, fws, structure, counter_perturb, num_perturb, index_fw_gs,
-                uis_ldau, val_dict, spin_polarized, relax_nonmagnetic, 
-                ediff_default, ediff_tight, parallel_scheme)
+            append_linresp_perturb_fws(
+                v,
+                fws,
+                structure,
+                counter_perturb,
+                num_perturb,
+                index_fw_gs,
+                uis_ldau,
+                val_dict,
+                spin_polarized,
+                relax_nonmagnetic,
+                ediff_default,
+                ediff_tight,
+                parallel_scheme,
+            )
 
     wf = Workflow(fws)
 
@@ -215,7 +226,8 @@ def get_wf_hubbard_hund_linresp(
             num_perturb=num_perturb,
             spin_polarized=spin_polarized,
             relax_nonmagnetic=relax_nonmagnetic,
-            db_file=DB_FILE, wf_uuid=uuid
+            db_file=DB_FILE,
+            wf_uuid=uuid,
         ),
         name="HubbardHundLinRespToDb",
     )
@@ -240,6 +252,7 @@ def get_wf_hubbard_hund_linresp(
 
     return wf
 
+
 def find_closest_sites(struct, species_perturb):
     """
     Function to find closest cluster of sites of target species of
@@ -259,7 +272,7 @@ def find_closest_sites(struct, species_perturb):
     n_config = 1
     for k in n_species:
         n_config *= n_species[k]
-    indices = -1*np.ones(n_s, int)
+    indices = -1 * np.ones(n_s, int)
     dist_min = -1.0
     indices_nearest = indices.copy()
     for k in range(n_config):
@@ -269,7 +282,7 @@ def find_closest_sites(struct, species_perturb):
             indices[j] = np.mod(k // denom, n)
             denom *= n
         nn_s = [n_species[list(n_species.keys())[j]] for j in range(n_s)]
-        iindxs = [indices[j]+int(np.sum(nn_s[0:j])) for j in range(n_s)]
+        iindxs = [indices[j] + int(np.sum(nn_s[0:j])) for j in range(n_s)]
         indxs = []
         for j, jk in enumerate(n_species):
             if jk in species_perturb:
@@ -284,17 +297,20 @@ def find_closest_sites(struct, species_perturb):
 
     return indices_nearest
 
+
 def init_linresp_input_sets(
-    user_incar_settings, structure, num_perturb,
+    user_incar_settings,
+    structure,
+    num_perturb,
 ):
     """
-    Function to setup VASP input sets for ground-state 
+    Function to setup VASP input sets for ground-state
     and perturbation Fireworks
     """
 
     # set LMAXMIX in user_incar_settings
-    if 'LMAXMIX' not in user_incar_settings.keys():
-        lmaxmix_dict = {"p": 2, "d": 4, "f": 6} 
+    if "LMAXMIX" not in user_incar_settings.keys():
+        lmaxmix_dict = {"p": 2, "d": 4, "f": 6}
         lmm = "p"
         for site in structure:
             block = str(site.specie.block)
@@ -308,9 +324,7 @@ def init_linresp_input_sets(
     # ground state user incar settings
     uis_gs = user_incar_settings.copy()
     if "LMAXMIX" not in uis_gs:
-        logger.warning(
-            "You have not specified LMAXMIX. Defaulting to VASP default."
-        )
+        logger.warning("You have not specified LMAXMIX. Defaulting to VASP default.")
     uis_gs.update({"LDAU": False, "LORBIT": 11, "LWAVE": True, "ISPIN": 2})
 
     uis_ldau = uis_gs.copy()
@@ -319,38 +333,44 @@ def init_linresp_input_sets(
     # Initialize vasp input set
     vis_params = {"user_incar_settings": uis_ldau.copy()}
     vis_ldau = HubbardHundLinRespSet(
-        structure=structure, num_perturb=num_perturb, **vis_params.copy())
+        structure=structure, num_perturb=num_perturb, **vis_params.copy()
+    )
 
     val_dict = {"LDAUL": {}, "LDAUU": {}, "LDAUJ": {}}
     for k in ["LDAUL", "LDAUU", "LDAUJ"]:
-        if (k == "LDAUL"):
+        if k == "LDAUL":
             # for LDAUL
             for i in range(num_perturb):
-                val_dict[k].update({"perturb"+str(i): -1})
+                val_dict[k].update({f"perturb{i}": -1})
             for s in vis_ldau.poscar.site_symbols[num_perturb:]:
-                l = -1
-                val_dict[k].update({s: l})
+                val_dict[k].update({s: -1})
         else:
             # for LDAUU and LDAUJ
             for i in range(num_perturb):
-                val_dict[k].update({"perturb"+str(i): 0})
+                val_dict[k].update({f"perturb{i}": 0})
             for s in vis_ldau.poscar.site_symbols[num_perturb:]:
                 v = 0
                 val_dict[k].update({s: v})
         uis_ldau.update({k: val_dict[k].copy()})
     vis_params = {"user_incar_settings": uis_ldau.copy()}
     vis_ldau = HubbardHundLinRespSet(
-        structure=structure, num_perturb=num_perturb, **vis_params.copy())
+        structure=structure, num_perturb=num_perturb, **vis_params.copy()
+    )
 
     uis_gs = uis_ldau.copy()
 
     return uis_gs, uis_ldau, val_dict, vis_ldau
 
-def append_linresp_ground_state_fws (
-    fws, 
-    structure, num_perturb, index_fw_gs,
-    uis_gs, relax_nonmagnetic, 
-    ediff_default, ediff_tight,
+
+def append_linresp_ground_state_fws(
+    fws,
+    structure,
+    num_perturb,
+    index_fw_gs,
+    uis_gs,
+    relax_nonmagnetic,
+    ediff_default,
+    ediff_tight,
 ):
     """
     Appends the ground-state (zero potential) Fireworks to the list of Fireworks
@@ -362,10 +382,17 @@ def append_linresp_ground_state_fws (
         uis_gs.update({"ISPIN": 2, "EDIFF": ediff_tight})
     vis_params = {"user_incar_settings": uis_gs.copy()}
     vis_gs = HubbardHundLinRespSet(
-        structure=structure, num_perturb=num_perturb, **vis_params.copy())
-    fws.append(HubbardHundLinRespFW(
-        structure=structure, name="initial_static",
-        vasp_input_set=vis_gs, vasp_cmd=VASP_CMD, db_file=DB_FILE))
+        structure=structure, num_perturb=num_perturb, **vis_params.copy()
+    )
+    fws.append(
+        HubbardHundLinRespFW(
+            structure=structure,
+            name="initial_static",
+            vasp_input_set=vis_gs,
+            vasp_cmd=VASP_CMD,
+            db_file=DB_FILE,
+        )
+    )
 
     if relax_nonmagnetic:
         index_fw_gs[0] += 1
@@ -373,19 +400,35 @@ def append_linresp_ground_state_fws (
         additional_files = ["WAVECAR", "CHGCAR"]
         vis_params = {"user_incar_settings": uis_gs.copy()}
         vis_gs = HubbardHundLinRespSet(
-            structure=structure, num_perturb=num_perturb, **vis_params.copy())
-        fws.append(HubbardHundLinRespFW(
-            structure=structure, parents=fws[-1],
-            additional_files=additional_files.copy(),
-            name="initial_static_magnetic", vasp_input_set=vis_gs,
-            vasp_cmd=VASP_CMD, db_file=DB_FILE))
-
-def append_linresp_perturb_fws (
-    applied_pot, fws,
-    structure, counter_perturb, num_perturb, index_fw_gs,
-    uis_ldau, val_dict,
-    spin_polarized, relax_nonmagnetic,
-    ediff_default, ediff_tight, parallel_scheme,
+            structure=structure, num_perturb=num_perturb, **vis_params.copy()
+        )
+        fws.append(
+            HubbardHundLinRespFW(
+                structure=structure,
+                parents=fws[-1],
+                additional_files=additional_files.copy(),
+                name="initial_static_magnetic",
+                vasp_input_set=vis_gs,
+                vasp_cmd=VASP_CMD,
+                db_file=DB_FILE,
+            )
+        )
+
+
+def append_linresp_perturb_fws(
+    applied_pot,
+    fws,
+    structure,
+    counter_perturb,
+    num_perturb,
+    index_fw_gs,
+    uis_ldau,
+    val_dict,
+    spin_polarized,
+    relax_nonmagnetic,
+    ediff_default,
+    ediff_tight,
+    parallel_scheme,
 ):
     """
     Appends the perturbed (non-zero on-site potential) Fireworks to the list of Fireworks
@@ -393,15 +436,13 @@ def append_linresp_perturb_fws (
 
     v = applied_pot
 
-    sign = 'neg' if v < 0 else 'pos'
+    sign = "neg" if v < 0 else "pos"
     signs = []
 
     spin_potential_values = []
     if spin_polarized:
-        spin_potential_values = [{"LDAUU": v, "LDAUJ": 0.0},
-                                 {"LDAUU": 0.0, "LDAUJ": v}]
-        signs = [{"LDAUU": sign, "LDAUJ": ""},
-                 {"LDAUU": "", "LDAUJ": sign}]
+        spin_potential_values = [{"LDAUU": v, "LDAUJ": 0.0}, {"LDAUU": 0.0, "LDAUJ": v}]
+        signs = [{"LDAUU": sign, "LDAUJ": ""}, {"LDAUU": "", "LDAUJ": sign}]
     else:
         spin_potential_values = [{"LDAUU": v, "LDAUJ": v}]
         signs = [{"LDAUU": sign, "LDAUJ": sign}]
@@ -412,45 +453,50 @@ def append_linresp_perturb_fws (
 
         # Update perturbation potential for U and J
         for k in ["LDAUL", "LDAUU", "LDAUJ"]:
-            if (k == "LDAUL"):
+            if k == "LDAUL":
                 # for LDAUL
                 for i in range(num_perturb):
                     if i == counter_perturb:
                         block = str(structure[counter_perturb].specie.block)
-                        val_dict[k].update({"perturb"+str(i):block_dict[block]})
+                        val_dict[k].update({f"perturb{i}": block_dict[block]})
                     else:
-                        val_dict[k].update({"perturb"+str(i): -1})
+                        val_dict[k].update({f"perturb{i}": -1})
             else:
                 # for LDAUU and LDAUJ
                 for i in range(num_perturb):
                     if i == counter_perturb:
-                        val_dict[k].update(
-                            {"perturb"+str(i): spin_pot_dict[k]})
+                        val_dict[k].update({f"perturb{i}": spin_pot_dict[k]})
                     else:
-                        val_dict[k].update({"perturb"+str(i): 0})
+                        val_dict[k].update({f"perturb{i}": 0})
             uis_ldau.update({k: val_dict[k].copy()})
 
         # Non-SCF runs
-        uis_ldau.update({"ISTART": 1, "ICHARG": 11,
-                         "ISPIN": 2, "EDIFF": ediff_default})
+        uis_ldau.update({"ISTART": 1, "ICHARG": 11, "ISPIN": 2, "EDIFF": ediff_default})
 
         vis_params = {"user_incar_settings": uis_ldau.copy()}
         vis_ldau = HubbardHundLinRespSet(
-            structure=structure, num_perturb=num_perturb, **vis_params.copy())
+            structure=structure, num_perturb=num_perturb, **vis_params.copy()
+        )
 
         parents = fws[index_fw_gs[0]]
 
         additional_files = ["WAVECAR", "CHGCAR"]
 
         fw = HubbardHundLinRespFW(
-            structure=structure, parents=parents,
+            structure=structure,
+            parents=parents,
             name="nscf_site{}_vup_{}{}_vdn_{}{}".format(
                 counter_perturb,
-                sign_dict["LDAUU"], abs(round(spin_pot_dict["LDAUU"], 6)),
-                sign_dict["LDAUJ"], abs(round(spin_pot_dict["LDAUJ"], 6))),
+                sign_dict["LDAUU"],
+                abs(round(spin_pot_dict["LDAUU"], 6)),
+                sign_dict["LDAUJ"],
+                abs(round(spin_pot_dict["LDAUJ"], 6)),
+            ),
             vasp_input_set=vis_ldau,
             additional_files=additional_files.copy(),
-            vasp_cmd=VASP_CMD, db_file=DB_FILE)
+            vasp_cmd=VASP_CMD,
+            db_file=DB_FILE,
+        )
         fws.append(fw)
 
         # SCF runs
@@ -462,7 +508,8 @@ def append_linresp_perturb_fws (
 
         vis_params = {"user_incar_settings": uis_ldau.copy()}
         vis_ldau = HubbardHundLinRespSet(
-            structure=structure, num_perturb=num_perturb, **vis_params.copy())
+            structure=structure, num_perturb=num_perturb, **vis_params.copy()
+        )
 
         if parallel_scheme == 0:
             parents = fws[-1]
@@ -472,38 +519,51 @@ def append_linresp_perturb_fws (
         additional_files = ["WAVECAR"]
 
         fw = HubbardHundLinRespFW(
-            structure=structure, parents=parents,
+            structure=structure,
+            parents=parents,
             name="scf_site{}_vup_{}{}_vdn_{}{}".format(
                 counter_perturb,
-                sign_dict["LDAUU"], abs(round(spin_pot_dict["LDAUU"], 6)),
-                sign_dict["LDAUJ"], abs(round(spin_pot_dict["LDAUJ"], 6))),
+                sign_dict["LDAUU"],
+                abs(round(spin_pot_dict["LDAUU"], 6)),
+                sign_dict["LDAUJ"],
+                abs(round(spin_pot_dict["LDAUJ"], 6)),
+            ),
             vasp_input_set=vis_ldau,
             additional_files=additional_files.copy(),
-            vasp_cmd=VASP_CMD, db_file=DB_FILE)
+            vasp_cmd=VASP_CMD,
+            db_file=DB_FILE,
+        )
         fws.append(fw)
 
         # SCF magnetic runs
         if relax_nonmagnetic:
-            uis_ldau.update({"ISTART": 1, "ICHARG": 1,
-                             "ISPIN": 2, "EDIFF": ediff_tight})
+            uis_ldau.update(
+                {"ISTART": 1, "ICHARG": 1, "ISPIN": 2, "EDIFF": ediff_tight}
+            )
 
             vis_params = {"user_incar_settings": uis_ldau.copy()}
             vis_ldau = HubbardHundLinRespSet(
-                structure=structure, num_perturb=num_perturb,
-                **vis_params.copy())
+                structure=structure, num_perturb=num_perturb, **vis_params.copy()
+            )
 
             parents = fws[-1]
             additional_files = ["WAVECAR", "CHGCAR"]
 
             fw = HubbardHundLinRespFW(
-                structure=structure, parents=parents,
+                structure=structure,
+                parents=parents,
                 name="scf_magnetic_site{}_vup_{}{}_vdn_{}{}".format(
                     counter_perturb,
-                    sign_dict["LDAUU"], abs(round(spin_pot_dict["LDAUU"], 6)),
-                    sign_dict["LDAUJ"], abs(round(spin_pot_dict["LDAUJ"], 6))),
+                    sign_dict["LDAUU"],
+                    abs(round(spin_pot_dict["LDAUU"], 6)),
+                    sign_dict["LDAUJ"],
+                    abs(round(spin_pot_dict["LDAUJ"], 6)),
+                ),
                 vasp_input_set=vis_ldau,
                 additional_files=additional_files.copy(),
-                vasp_cmd=VASP_CMD, db_file=DB_FILE)
+                vasp_cmd=VASP_CMD,
+                db_file=DB_FILE,
+            )
             fws.append(fw)
 
 
@@ -513,12 +573,7 @@ class PoscarPerturb(Poscar):
     in the Structure
     """
 
-    def __init__(
-            self,
-            structure: Structure,
-            num_perturb: int = 1,
-            **kwargs
-    ):
+    def __init__(self, structure: Structure, num_perturb: int = 1, **kwargs):
         """
         Args:
             structure:
@@ -537,17 +592,15 @@ def site_symbols(self):
         Sequence of symbols associated with the Poscar
         """
 
-        if (self.num_perturb > 0 and self.num_perturb <= len(self.structure)):
-            syms = [site.specie.symbol
-                    for site in self.structure[self.num_perturb:]]
+        if self.num_perturb > 0 and self.num_perturb <= len(self.structure):
+            syms = [site.specie.symbol for site in self.structure[self.num_perturb :]]
             syms = [a[0] for a in itertools.groupby(syms)]
-            syms_perturb = [site.specie.symbol
-                            for site in self.structure[0:self.num_perturb]]
+            syms_perturb = [
+                site.specie.symbol for site in self.structure[0 : self.num_perturb]
+            ]
             syms_perturb.extend(syms)
         else:
-            raise ValueError(
-                "Invalid atom index to perturb"
-            )
+            raise ValueError("Invalid atom index to perturb")
 
         return syms_perturb
 
@@ -557,16 +610,14 @@ def natoms(self):
         Sequence of number of sites of each type associated with the Poscar
         """
 
-        if (self.num_perturb > 0 and self.num_perturb <= len(self.structure)):
-            syms = [site.specie.symbol for site in self.structure[self.num_perturb:]]
+        if self.num_perturb > 0 and self.num_perturb <= len(self.structure):
+            syms = [site.specie.symbol for site in self.structure[self.num_perturb :]]
             n_atoms = [len(tuple(a[1])) for a in itertools.groupby(syms)]
 
             n_atoms_perturb = [1 for i in range(self.num_perturb)]
             n_atoms_perturb.extend(n_atoms)
         else:
-            raise ValueError(
-                "Invalid atom index to perturb"
-            )
+            raise ValueError("Invalid atom index to perturb")
 
         return n_atoms_perturb
 
@@ -575,8 +626,17 @@ class HubbardHundLinRespSet(MPStaticSet):
     """
     VASP input set for Linear Response Hubbard U workflow perturbation Fireworks
     """
-    def __init__(self, structure, num_perturb, prev_incar=None, prev_kpoints=None,
-                 reciprocal_density=100, small_gap_multiply=None, **kwargs):
+
+    def __init__(
+        self,
+        structure,
+        num_perturb,
+        prev_incar=None,
+        prev_kpoints=None,
+        reciprocal_density=100,
+        small_gap_multiply=None,
+        **kwargs,
+    ):
         """
         Args:
             structure:
@@ -636,7 +696,8 @@ def poscar(self):
         Custom Poscar for HubbardHundLinRespSet
         """
         poscar = PoscarPerturb(
-            structure=super().structure, num_perturb=self.num_perturb)
+            structure=super().structure, num_perturb=self.num_perturb
+        )
         return poscar
 
     @property
@@ -650,12 +711,21 @@ def kpoints(self):
 
 
 class HubbardHundLinRespFW(Firework):
-    def __init__(self, structure=None, name="linresponse_U",
-                 vasp_input_set=None, vasp_input_set_params=None,
-                 vasp_cmd=VASP_CMD, prev_calc_loc=True, prev_calc_dir=None,
-                 db_file=DB_FILE, vasptodb_kwargs=None, parents=None,
-                 additional_files=None,
-                 **kwargs):
+    def __init__(
+        self,
+        structure=None,
+        name="linresponse_U",
+        vasp_input_set=None,
+        vasp_input_set_params=None,
+        vasp_cmd=VASP_CMD,
+        prev_calc_loc=True,
+        prev_calc_dir=None,
+        db_file=DB_FILE,
+        vasptodb_kwargs=None,
+        parents=None,
+        additional_files=None,
+        **kwargs,
+    ):
         """
         Standard static calculation Firework - either from a previous location
         or from a structure.
@@ -678,7 +748,7 @@ def __init__(self, structure=None, name="linresponse_U",
             parents (Firework): Parents of this particular Firework. FW or list
                 of FWS.
             vasptodb_kwargs (dict): kwargs to pass to VaspToDb
-            \*\*kwargs: Other kwargs that are passed to Firework.__init__.
+            kwargs: Other kwargs that are passed to Firework.__init__().
         """
         t = []
 
@@ -688,30 +758,38 @@ def __init__(self, structure=None, name="linresponse_U",
             vasptodb_kwargs["additional_fields"] = {}
         vasptodb_kwargs["additional_fields"]["task_label"] = name
 
-        fw_name = "{}-{}".format(
-            structure.composition.reduced_formula if structure else "unknown", name)
+        formula = structure.composition.reduced_formula if structure else "unknown"
+        fw_name = f"{formula}-{name}"
 
         if prev_calc_dir:
-            t.append(CopyVaspOutputs(
-                calc_dir=prev_calc_dir, additional_files=additional_files,
-                contcar_to_poscar=False))
+            t.append(
+                CopyVaspOutputs(
+                    calc_dir=prev_calc_dir,
+                    additional_files=additional_files,
+                    contcar_to_poscar=False,
+                )
+            )
         elif parents:
             if prev_calc_loc:
-                t.append(CopyVaspOutputs(
-                    calc_loc=prev_calc_loc, additional_files=additional_files,
-                    contcar_to_poscar=False))
+                t.append(
+                    CopyVaspOutputs(
+                        calc_loc=prev_calc_loc,
+                        additional_files=additional_files,
+                        contcar_to_poscar=False,
+                    )
+                )
 
         if structure:
             vasp_input_set = vasp_input_set or HubbardHundLinRespSet(
-                structure, **vasp_input_set_params)
-            t.append(WriteVaspFromIOSet(
-                structure=structure, vasp_input_set=vasp_input_set))
+                structure, **vasp_input_set_params
+            )
+            t.append(
+                WriteVaspFromIOSet(structure=structure, vasp_input_set=vasp_input_set)
+            )
         else:
             raise ValueError("Must specify structure")
 
         t.append(RunVaspCustodian(vasp_cmd=vasp_cmd, auto_npar=">>auto_npar<<"))
         t.append(PassCalcLocs(name=name))
-        t.append(
-            VaspToDb(db_file=db_file, **vasptodb_kwargs))
-        super(HubbardHundLinRespFW, self).__init__(
-            t, parents=parents, name=fw_name, **kwargs)
+        t.append(VaspToDb(db_file=db_file, **vasptodb_kwargs))
+        super().__init__(t, parents=parents, name=fw_name, **kwargs)
diff --git a/atomate/vasp/workflows/base/lobster.py b/atomate/vasp/workflows/base/lobster.py
index bf1b71223..801cfcf77 100644
--- a/atomate/vasp/workflows/base/lobster.py
+++ b/atomate/vasp/workflows/base/lobster.py
@@ -8,16 +8,16 @@
 import os
 from typing import List, Optional
 
-from atomate.common.firetasks.glue_tasks import DeleteFilesPrevFolder
-from atomate.vasp.config import VASP_CMD, DB_FILE, LOBSTER_CMD
-from atomate.vasp.fireworks import StaticFW, OptimizeFW
-from atomate.vasp.fireworks.lobster import LobsterFW
-from fireworks import Firework
-from fireworks.core.firework import Workflow
-from pymatgen.core.structure import Structure
+from fireworks import Firework, Workflow
+from pymatgen.core import Structure
 from pymatgen.io.lobster import Lobsterin
 from pymatgen.io.vasp.sets import LobsterSet
 
+from atomate.common.firetasks.glue_tasks import DeleteFilesPrevFolder
+from atomate.vasp.config import DB_FILE, LOBSTER_CMD, VASP_CMD
+from atomate.vasp.fireworks import OptimizeFW, StaticFW
+from atomate.vasp.fireworks.lobster import LobsterFW
+
 __author__ = "Janine George, Guido Petretto"
 __email__ = "janine.george@uclouvain.be, guido.petretto@uclouvain.be"
 
diff --git a/atomate/vasp/workflows/base/magnetism.py b/atomate/vasp/workflows/base/magnetism.py
index 1c66f27f7..3b9af22e1 100644
--- a/atomate/vasp/workflows/base/magnetism.py
+++ b/atomate/vasp/workflows/base/magnetism.py
@@ -1,35 +1,32 @@
 import os
+from uuid import uuid4
+
+import numpy as np
+from fireworks import Firework, Workflow
+from pymatgen.alchemy.materials import TransformedStructure
+from pymatgen.analysis.magnetism.analyzer import (
+    CollinearMagneticStructureAnalyzer,
+    MagneticStructureEnumerator,
+)
+from pymatgen.analysis.structure_matcher import ElementComparator, StructureMatcher
+from pymatgen.core import Lattice, Structure
+from pymatgen.io.vasp.sets import MPRelaxSet
 
+from atomate.utils.utils import get_logger
+from atomate.vasp.config import ADD_WF_METADATA, DB_FILE, VASP_CMD
+from atomate.vasp.firetasks.parse_outputs import (
+    MagneticDeformationToDb,
+    MagneticOrderingsToDb,
+)
 from atomate.vasp.fireworks.core import OptimizeFW, StaticFW
-from fireworks import Workflow, Firework
 from atomate.vasp.powerups import (
-    add_tags,
     add_additional_fields_to_taskdocs,
-    add_wf_metadata,
     add_common_powerups,
+    add_tags,
+    add_wf_metadata,
 )
 from atomate.vasp.workflows.base.core import get_wf
-from atomate.vasp.firetasks.parse_outputs import (
-    MagneticDeformationToDb,
-    MagneticOrderingsToDb,
-)
-
-from pymatgen.alchemy.materials import TransformedStructure
-
-from atomate.utils.utils import get_logger
-
-logger = get_logger(__name__)
-
-from atomate.vasp.config import VASP_CMD, DB_FILE, ADD_WF_METADATA
-
 from atomate.vasp.workflows.presets.scan import wf_scan_opt
-from uuid import uuid4
-from pymatgen.io.vasp.sets import MPRelaxSet
-from pymatgen.core import Lattice, Structure
-from pymatgen.analysis.magnetism.analyzer import (
-    CollinearMagneticStructureAnalyzer,
-    MagneticStructureEnumerator,
-)
 
 __author__ = "Matthew Horton"
 __maintainer__ = "Matthew Horton"
@@ -42,6 +39,8 @@
 
 module_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)))
 
+logger = get_logger(__name__)
+
 
 def get_wf_magnetic_deformation(structure, c=None, vis=None):
     """
@@ -414,7 +413,6 @@ def get_commensurate_orderings(magnetic_structures, energies):
     ordered_structures = [
         s for _, s in sorted(zip(energies, magnetic_structures), reverse=False)
     ]
-    ordered_energies = sorted(energies, reverse=False)
 
     # Ground state and 1st excited state
     gs_struct = ordered_structures[0]
@@ -467,7 +465,7 @@ def get_commensurate_orderings(magnetic_structures, energies):
     for s in mse.ordered_structures:
         try:
             s2 = sm.get_s2_like_s1(enum_struct, s)
-        except:
+        except Exception:
             s2 = None
         if s2 is not None:
             # Standardize magnetic structure
diff --git a/atomate/vasp/workflows/base/neb.py b/atomate/vasp/workflows/base/neb.py
index 23d88fc66..83c3dc7ca 100644
--- a/atomate/vasp/workflows/base/neb.py
+++ b/atomate/vasp/workflows/base/neb.py
@@ -6,9 +6,8 @@
 
 from datetime import datetime
 
-from pymatgen.analysis.diffusion.neb.io import get_endpoints_from_index
-
 from fireworks.core.firework import Workflow
+from pymatgen.analysis.diffusion.neb.io import get_endpoints_from_index
 
 from atomate.vasp.fireworks.core import NEBFW, NEBRelaxationFW
 
diff --git a/dev_scripts/plot_raman.py b/dev_scripts/plot_raman.py
index 46d54d4e4..4c38628aa 100644
--- a/dev_scripts/plot_raman.py
+++ b/dev_scripts/plot_raman.py
@@ -3,7 +3,6 @@
 
 import numpy as np
 
-
 __author__ = "Kiran Mathew"
 __email__ = "kmathew@lbl.gov"
 
@@ -110,7 +109,7 @@ def run():
     # lorentzian_width = 4 # cm^-1, Phys Rev B 73, 104304 2006
     frequencies, intensities = get_freq_intensities(args.input_file)
     print(
-        f"Frequencies(cm^-1) and Normalized intensities: \n {frequencies} \n{intensities}"
+        f"Frequencies(cm^-1) and Normalized intensities: \n{frequencies} \n{intensities}"
     )
     plot_spectrum(frequencies, intensities, args.width)
 
diff --git a/docs_rst/conf.py b/docs_rst/conf.py
index fd7f4d8ce..f97acc18a 100644
--- a/docs_rst/conf.py
+++ b/docs_rst/conf.py
@@ -1,4 +1,3 @@
-#
 # Documentation build configuration file, created by
 # sphinx-quickstart on Fri Jan 11 16:36:11 2013.
 #
diff --git a/requirements-ci.txt b/requirements-ci.txt
index 1eaf7d73b..458b0c5c9 100644
--- a/requirements-ci.txt
+++ b/requirements-ci.txt
@@ -1,6 +1,5 @@
-pytest==6.2.4
-pytest-cov==2.12.1
+boto3==1.17.97
 coverage==5.5
-coveralls==3.1.0
 moto==2.0.10
-boto3==1.17.97
\ No newline at end of file
+pytest-cov==2.12.1
+pytest==6.2.4
diff --git a/requirements.txt b/requirements.txt
index 1ba013aec..e5059ab6f 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,17 +1,15 @@
-numpy==1.20.3
-scipy==1.7.0
+custodian==2021.2.8
 FireWorks==1.9.7
-pymatgen-analysis-diffusion==2021.4.29
+maggma==0.29.2
 monty==2021.6.10
-paramiko==2.7.2
-tqdm==4.61.1
-pybtex==0.24.0
-ruamel.yaml==0.17.9
-pandas==1.2.5
-pymatgen==2022.0.10
-custodian==2021.2.8
 networkx==2.5.1
+numpy>=1.20.3,<1.22.0
+pandas==1.2.5
+paramiko==2.7.2
 pydash==5.0.0
+pymatgen-analysis-diffusion==2021.4.29
+pymatgen==2022.0.10
 pyyaml==5.4.1
-maggma==0.29.2
-scikit-image==0.18.1
+ruamel.yaml==0.17.9
+scipy==1.7.0
+tqdm==4.61.1
diff --git a/scripts/atwf b/scripts/atwf
index 5175a18b1..700d92c22 100755
--- a/scripts/atwf
+++ b/scripts/atwf
@@ -1,28 +1,23 @@
 #!/usr/bin/env python
-# coding: utf-8
 # Copyright (c) atomate Development Team.
 
-from __future__ import division, unicode_literals, print_function
-
 import argparse
+import ast
 import os
 import sys
-import yaml
-import ast
 from datetime import datetime
 
-from monty.serialization import loadfn
-
+import yaml
 from fireworks import LaunchPad
+from monty.serialization import loadfn
+from pymatgen.core import Lattice, Structure
+from pymatgen.ext.matproj import MPRester
+from pymatgen.util.testing import PymatgenTest
 
 from atomate.utils.utils import get_wf_from_spec_dict, load_class
 from atomate.vasp.powerups import add_namefile, add_tags
 from atomate.vasp.workflows.presets import core
 
-from pymatgen.core import Structure, Lattice
-from pymatgen.ext.matproj import MPRester
-from pymatgen.util.testing import PymatgenTest
-
 default_yaml = """fireworks:
 - fw: atomate.vasp.fireworks.core.OptimizeFW
 - fw: atomate.vasp.fireworks.core.StaticFW
@@ -66,7 +61,7 @@ def _get_wf(args, structure):
                     presets_dir, "..", "base", "library", spec_path
                 )
             else:
-                raise ValueError("Unknown library: {}".format(args.library))
+                raise ValueError(f"Unknown library: {args.library}")
         d = loadfn(spec_path)
         return get_wf_from_spec_dict(structure, d, args.common_param_updates)
 
@@ -133,7 +128,7 @@ def submit_test_suite(args):
                 wfs.append(wf_func(*custom_args[name]))
             else:
                 wfs.append(wf_func(structs[0]))
-    wfs = [add_tags(wf, "test set {}".format(dt)) for wf in wfs]
+    wfs = [add_tags(wf, f"test set {dt}") for wf in wfs]
     for wf in wfs:
         add_to_lpad(wf, write_namefile=False)
 
@@ -148,11 +143,11 @@ def verify_test_suite(args):
         ]
         rep_dict = {k["_id"]: k["count"] for k in lpad.fireworks.aggregate(pipeline)}
         dt = "".join(tag.split()[2:])
-        print("Test set submitted at {}".format(dt))
+        print(f"Test set submitted at {dt}")
         if args.report:
             print("   Test fw state summary:")
             for state, count in rep_dict.items():
-                print("   -{}: {}".format(state, count))
+                print(f"   -{state}: {count}")
         count = sum(rep_dict.values())
         if rep_dict.get("COMPLETED", None) == count:
             print("   All test workflows successfully completed")
@@ -280,7 +275,7 @@ if __name__ == "__main__":
         "-pk",
         "--powerup_kwargs",
         default="{}",
-        help="powerup keyword arguments, e.g. " '\'{"incar_update": {"ENCUT": 700}}\'',
+        help='powerup keyword arguments, e.g. \'{"incar_update": {"ENCUT": 700}}\'',
     )
     ppowerup.set_defaults(func=powerup_workflow)
 
diff --git a/setup.cfg b/setup.cfg
index a5d15e9c6..5a17bb279 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -10,5 +10,11 @@ upload-dir = docs/_build/html
 upload_docs = upload_docs --upload-dir=docs/_build/html
 release = register sdist upload
 
+[flake8]
+max-line-length = 125
+per-file-ignores =
+  # F401: imported but unused
+  __init__.py: F401
+
 [isort]
-profile = "black"
+profile = black
diff --git a/setup.py b/setup.py
index d136d1312..98288dc46 100644
--- a/setup.py
+++ b/setup.py
@@ -1,18 +1,16 @@
-#!/usr/bin/env python
-
 import os
+from os.path import abspath, dirname, join
 
-from setuptools import setup, find_packages
+from setuptools import find_packages, setup
 
-module_dir = os.path.dirname(os.path.abspath(__file__))
+module_dir = dirname(abspath(__file__))
 
 if __name__ == "__main__":
     setup(
         name="atomate",
         version="1.0.1",
-        description="atomate has implementations of FireWorks workflows for "
-        "Materials Science",
-        long_description=open(os.path.join(module_dir, "README.md")).read(),
+        description="atomate has implementations of FireWorks workflows for Materials Science",
+        long_description=open(join(module_dir, "README.md")).read(),
         url="https://github.com/hackingmaterials/atomate",
         author="Anubhav Jain, Kiran Mathew",
         author_email="anubhavster@gmail.com, kmathew@lbl.gov",
@@ -24,26 +22,31 @@
         },
         zip_safe=False,
         install_requires=[
-            "numpy",
-            "scipy",
+            "custodian>=2019.8.24",
             "FireWorks>=1.4.0",
-            "pymatgen-analysis-diffusion>=2021.4.29",
+            "maggma>=0.26.0",
             "monty>=2.0.6",
-            "paramiko",
-            "pandas",
-            "tqdm>=4.7.4",
             "networkx",
-            "pymatgen>=2020.9.14",
-            "custodian>=2019.8.24",
+            "numpy>=1.20.3,<1.22.0",
+            "pandas",
+            "paramiko",
             "pydash>=4.1.0",
+            "pymatgen-analysis-diffusion>=2021.4.29",
+            "pymatgen>=2020.9.14,<=2022.0.10",
             "pyyaml>=5.1.2",
-            "maggma>=0.26.0",
+            "ruamel.yaml",
+            "scipy",
+            "tqdm>=4.7.4",
         ],
         extras_require={
-            "rtransfer": ["paramiko>=2.4.2"],
             "plotting": ["matplotlib>=1.5.2"],
             "phonons": ["phonopy>=1.10.8"],
-            "complete": ["paramiko>=2.4.2", "matplotlib>=1.5.2", "phonopy>=1.10.8"],
+            "qchem": ["openbabel"],
+            "complete": [
+                "matplotlib>=1.5.2",
+                "phonopy>=1.10.8",
+                "openbabel",
+            ],
         },
         classifiers=[
             "Programming Language :: Python :: 3",
@@ -57,10 +60,5 @@
             "Topic :: Other/Nonlisted Topic",
             "Topic :: Scientific/Engineering",
         ],
-        test_suite="nose.collector",
-        tests_require=["nose"],
-        scripts=[
-            os.path.join("scripts", f)
-            for f in os.listdir(os.path.join(module_dir, "scripts"))
-        ],
+        scripts=[join("scripts", f) for f in os.listdir(join(module_dir, "scripts"))],
     )


Test patch:
diff --git a/atomate/common/firetasks/tests/test_glue_tasks.py b/atomate/common/firetasks/tests/test_glue_tasks.py
index 286932eb2..0b82d658c 100644
--- a/atomate/common/firetasks/tests/test_glue_tasks.py
+++ b/atomate/common/firetasks/tests/test_glue_tasks.py
@@ -1,19 +1,20 @@
 import os
 import unittest
 
+from fireworks import Firework, Workflow
+from fireworks.core.rocket_launcher import rapidfire
+from monty.tempfile import ScratchDir
+
 from atomate.common.firetasks.glue_tasks import (
-    PassCalcLocs,
-    get_calc_loc,
     CopyFilesFromCalcLoc,
     CreateFolder,
     DeleteFiles,
     DeleteFilesPrevFolder,
+    PassCalcLocs,
+    get_calc_loc,
 )
 from atomate.utils.testing import AtomateTest
 from atomate.vasp.firetasks.glue_tasks import CopyVaspOutputs
-from fireworks.core.firework import Firework, Workflow
-from fireworks.core.rocket_launcher import rapidfire
-from monty.tempfile import ScratchDir
 
 __author__ = "Anubhav Jain <ajain@lbl.gov>"
 
@@ -194,7 +195,7 @@ def test_cleanupfiles_calc_loc(self):
 
     def test_cleanupfiles_calc_dir(self):
         # will test deleting from some folder specified by calc_dir
-        with ScratchDir(".", copy_from_current_on_enter=True) as d:
+        with ScratchDir(".", copy_from_current_on_enter=True):
             current_path = os.getcwd()
             os.mkdir("to_remove.relax0")
             os.mkdir("to_remove.relax1")
diff --git a/atomate/qchem/test_files/FF_before_run/orig/test_cust.py b/atomate/qchem/test_files/FF_before_run/orig/test_cust.py
index 928f95458..62763f003 100644
--- a/atomate/qchem/test_files/FF_before_run/orig/test_cust.py
+++ b/atomate/qchem/test_files/FF_before_run/orig/test_cust.py
@@ -1,6 +1,6 @@
 from custodian import Custodian
-from custodian.qchem.new_jobs import QCJob
 from custodian.qchem.new_handlers import QChemErrorHandler
+from custodian.qchem.new_jobs import QCJob
 
 my_input = "test.qin"
 my_output = "test.qout"
diff --git a/atomate/qchem/test_files/FF_before_run/test_cust.py b/atomate/qchem/test_files/FF_before_run/test_cust.py
index e8f1a5226..205ec27ab 100644
--- a/atomate/qchem/test_files/FF_before_run/test_cust.py
+++ b/atomate/qchem/test_files/FF_before_run/test_cust.py
@@ -1,6 +1,6 @@
 from custodian import Custodian
-from custodian.qchem.jobs import QCJob
 from custodian.qchem.handlers import QChemErrorHandler
+from custodian.qchem.jobs import QCJob
 
 my_input = "test.qin"
 my_output = "test.qout"
diff --git a/atomate/qchem/test_files/FF_working/test_cust.py b/atomate/qchem/test_files/FF_working/test_cust.py
index e8f1a5226..205ec27ab 100644
--- a/atomate/qchem/test_files/FF_working/test_cust.py
+++ b/atomate/qchem/test_files/FF_working/test_cust.py
@@ -1,6 +1,6 @@
 from custodian import Custodian
-from custodian.qchem.jobs import QCJob
 from custodian.qchem.handlers import QChemErrorHandler
+from custodian.qchem.jobs import QCJob
 
 my_input = "test.qin"
 my_output = "test.qout"
diff --git a/atomate/qchem/test_files/real_run/test_cust.py b/atomate/qchem/test_files/real_run/test_cust.py
index d217004e5..e3e561d2c 100644
--- a/atomate/qchem/test_files/real_run/test_cust.py
+++ b/atomate/qchem/test_files/real_run/test_cust.py
@@ -1,6 +1,6 @@
 from custodian import Custodian
-from custodian.qchem.jobs import QCJob
 from custodian.qchem.handlers import QChemErrorHandler
+from custodian.qchem.jobs import QCJob
 
 my_input = "mol.qin"
 my_output = "mol.qout"
diff --git a/atomate/utils/testing.py b/atomate/utils/testing.py
index 461c40ac2..324f038b4 100644
--- a/atomate/utils/testing.py
+++ b/atomate/utils/testing.py
@@ -47,7 +47,7 @@ def setUp(self, lpad=True):
             try:
                 self.lp = LaunchPad.from_file(os.path.join(DB_DIR, "my_launchpad.yaml"))
                 self.lp.reset("", require_password=False)
-            except:
+            except Exception:
                 raise unittest.SkipTest(
                     "Cannot connect to MongoDB! Is the database server running? "
                     "Are the credentials correct?"
diff --git a/atomate/vasp/firetasks/tests/test_get_interpolated_poscar.py b/atomate/vasp/firetasks/tests/test_get_interpolated_poscar.py
index 5a0e35458..d4c12e133 100644
--- a/atomate/vasp/firetasks/tests/test_get_interpolated_poscar.py
+++ b/atomate/vasp/firetasks/tests/test_get_interpolated_poscar.py
@@ -1,14 +1,13 @@
 import os
 import unittest
 
-from pymatgen.core.structure import Structure
-
-from fireworks.core.firework import Firework, Workflow
+from fireworks import Firework, Workflow
 from fireworks.core.rocket_launcher import rapidfire
+from pymatgen.core.structure import Structure
 
 from atomate.common.firetasks.glue_tasks import PassCalcLocs, get_calc_loc
-from atomate.vasp.firetasks.glue_tasks import CopyVaspOutputs, GetInterpolatedPOSCAR
 from atomate.utils.testing import AtomateTest
+from atomate.vasp.firetasks.glue_tasks import CopyVaspOutputs, GetInterpolatedPOSCAR
 
 __author__ = "Tess Smidt"
 __email__ = "blondegeek@gmail.com"
diff --git a/atomate/vasp/firetasks/tests/test_lobster_tasks.py b/atomate/vasp/firetasks/tests/test_lobster_tasks.py
index 14761d3d5..30fd86fce 100644
--- a/atomate/vasp/firetasks/tests/test_lobster_tasks.py
+++ b/atomate/vasp/firetasks/tests/test_lobster_tasks.py
@@ -5,18 +5,18 @@
 from unittest import mock
 
 import gridfs
-from atomate.utils.testing import AtomateTest
-from atomate.utils.testing import DB_DIR
+from fireworks.utilities.fw_serializers import load_object
+from monty.serialization import dumpfn
+from monty.shutil import copy_r
+from pymatgen.io.lobster import Lobsterin
+
+from atomate.utils.testing import DB_DIR, AtomateTest
 from atomate.vasp.database import VaspCalcDb
 from atomate.vasp.firetasks.lobster_tasks import (
-    WriteLobsterinputfromIO,
     LobsterRunToDb,
     RunLobster,
+    WriteLobsterinputfromIO,
 )
-from fireworks.utilities.fw_serializers import load_object
-from monty.serialization import dumpfn
-from monty.shutil import copy_r
-from pymatgen.io.lobster import Lobsterin
 
 DB_FILE = os.path.join(DB_DIR, "db.json")
 module_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)))
@@ -100,7 +100,7 @@ def tearDown(self):
             for coll in db.collection_names():
                 if coll != "system.indexes":
                     db[coll].drop()
-        except:
+        except Exception:
             pass
 
     def test_jsonfile(self):
@@ -115,7 +115,7 @@ def test_jsonfile(self):
     def test_mongodb(self):
         try:
             VaspCalcDb.from_db_file(DB_FILE)
-        except:
+        except Exception:
             raise unittest.SkipTest(
                 "Cannot connect to MongoDB! Is the database server running? "
                 "Are the credentials correct?"
@@ -133,7 +133,7 @@ def test_mongodb(self):
     def test_mongodb_more_files(self):
         try:
             VaspCalcDb.from_db_file(DB_FILE)
-        except:
+        except Exception:
             raise unittest.SkipTest(
                 "Cannot connect to MongoDB! Is the database server running? "
                 "Are the credentials correct?"
@@ -157,12 +157,12 @@ def test_mongodb_more_files(self):
         self.assertListEqual(load_dict["output"]["chargespilling"], [0.008, 0.008])
         db = self.get_task_database()
         gfs = gridfs.GridFS(db, "lobster_files")
-        results = gfs.find({}).count()
-        self.assertEqual(results, 2)
+        results = gfs.find({})
+        self.assertEqual(len(list(results)), 2)
         for fn in ["ICOHPLIST", "COOPCAR"]:
             oid = load_dict[fn.lower() + "_id"]
-            results = gfs.find({"_id": oid}).count()
-            self.assertEqual(results, 1)
+            results = gfs.find({"_id": oid})
+            self.assertEqual(len(list(results)), 1)
 
     def test_jsonfile_si(self):
         copy_r(self.vasp_si_dir, ".")
diff --git a/atomate/vasp/firetasks/tests/test_write_vasp_from_interpolated_poscar.py b/atomate/vasp/firetasks/tests/test_write_vasp_from_interpolated_poscar.py
index d6c5f79aa..10b8e98c1 100644
--- a/atomate/vasp/firetasks/tests/test_write_vasp_from_interpolated_poscar.py
+++ b/atomate/vasp/firetasks/tests/test_write_vasp_from_interpolated_poscar.py
@@ -1,15 +1,14 @@
 import os
 import unittest
 
-from pymatgen.core.structure import Structure
-
-from fireworks.core.firework import Firework, Workflow
+from fireworks import Firework, Workflow
 from fireworks.core.rocket_launcher import rapidfire
+from pymatgen.core.structure import Structure
 
 from atomate.common.firetasks.glue_tasks import PassCalcLocs, get_calc_loc
+from atomate.utils.testing import AtomateTest
 from atomate.vasp.firetasks.glue_tasks import CopyVaspOutputs
 from atomate.vasp.firetasks.write_inputs import WriteVaspFromIOSetFromInterpolatedPOSCAR
-from atomate.utils.testing import AtomateTest
 
 __author__ = "Tess Smidt"
 __email__ = "blondegeek@gmail.com"
diff --git a/atomate/vasp/fireworks/tests/test_fireworks_core.py b/atomate/vasp/fireworks/tests/test_fireworks_core.py
index 18e8003a3..6889aac3d 100644
--- a/atomate/vasp/fireworks/tests/test_fireworks_core.py
+++ b/atomate/vasp/fireworks/tests/test_fireworks_core.py
@@ -5,7 +5,17 @@
 from pymatgen.core.structure import Structure
 from pymatgen.transformations.standard_transformations import RotationTransformation
 
-from atomate.vasp.fireworks.core import *
+from atomate.vasp.fireworks.core import (
+    DFPTFW,
+    HSEBSFW,
+    SOCFW,
+    BoltztrapFW,
+    NonSCFFW,
+    OptimizeFW,
+    RamanFW,
+    StaticFW,
+    TransmuterFW,
+)
 
 __author__ = "Shyam Dwaraknath"
 __email__ = "shyamd@lbl.gov"
diff --git a/atomate/vasp/fireworks/tests/test_nmr.py b/atomate/vasp/fireworks/tests/test_nmr.py
index 552e2933b..381fa7e90 100644
--- a/atomate/vasp/fireworks/tests/test_nmr.py
+++ b/atomate/vasp/fireworks/tests/test_nmr.py
@@ -4,9 +4,8 @@
 from pymatgen.core.lattice import Lattice
 from pymatgen.core.structure import Structure
 
-from atomate.vasp.fireworks.nmr import *
-
-from atomate.vasp.firetasks.write_inputs import WriteVaspNMRFromPrev, WriteVaspFromIOSet
+from atomate.vasp.firetasks.write_inputs import WriteVaspFromIOSet, WriteVaspNMRFromPrev
+from atomate.vasp.fireworks.nmr import NMRFW
 
 __author__ = "Shyam Dwaraknath"
 __email__ = "shyamd@lbl.gov"
diff --git a/atomate/vasp/workflows/tests/test_bulk_modulus_workflow.py b/atomate/vasp/workflows/tests/test_bulk_modulus_workflow.py
index 8ebfd9e20..edb0db673 100644
--- a/atomate/vasp/workflows/tests/test_bulk_modulus_workflow.py
+++ b/atomate/vasp/workflows/tests/test_bulk_modulus_workflow.py
@@ -178,7 +178,7 @@ def write_task_docs(self):
                     for prop in rm_props:
                         try:
                             del d["calcs_reversed"][icalc][prop]
-                        except:
+                        except Exception:
                             pass
                 with open(os.path.join(reference_dir, str(i), "task.json"), "w") as fp:
                     json.dump(
diff --git a/atomate/vasp/workflows/tests/test_hubbard_hund_linresp.py b/atomate/vasp/workflows/tests/test_hubbard_hund_linresp.py
index 5644ec35b..c56702010 100644
--- a/atomate/vasp/workflows/tests/test_hubbard_hund_linresp.py
+++ b/atomate/vasp/workflows/tests/test_hubbard_hund_linresp.py
@@ -1,16 +1,10 @@
-# coding: utf-8
-
 import os
-import unittest
+from json import load
 
-from monty.os.path import which
+from pymatgen.core.structure import Structure
 
-from atomate.vasp.workflows.base.hubbard_hund_linresp import get_wf_hubbard_hund_linresp
+from atomate.utils.testing import DB_DIR, AtomateTest
 from atomate.vasp.firetasks.parse_outputs import HubbardHundLinRespToDb
-from atomate.utils.testing import AtomateTest, DB_DIR
-
-from json import load
-from pymatgen.core.structure import Structure
 
 __author__ = "Guy Moore"
 __email__ = "gmoore@lbl.gov"
@@ -19,8 +13,8 @@
 db_dir = os.path.join(module_dir, "..", "..", "..", "common", "test_files")
 ref_dir = os.path.join(module_dir, "..", "..", "test_files", "hubbard_hund_linresp_wf")
 
-class TestHubbardHundLinRespWorkflow(AtomateTest):
 
+class TestHubbardHundLinRespWorkflow(AtomateTest):
     def test_analysis(self):
 
         # load example tasks (since workflow re-uses existing FW building
@@ -30,10 +24,12 @@ def test_analysis(self):
         # Example: LiNiPO4
         formula_pretty = "LiNiPO4"
         tasks = self.get_task_collection()
-        with open(os.path.join(ref_dir, "sample_tasks_multisite_spinpolarized.json"), "r") as f:
+        with open(
+            os.path.join(ref_dir, "sample_tasks_multisite_spinpolarized.json")
+        ) as f:
             sample_tasks = load(f)
         wf_uuid = sample_tasks[0]["wf_meta"]["wf_uuid"]
-        parent_structure = Structure.from_dict(sample_tasks[0]["input"]["structure"])
+        Structure.from_dict(sample_tasks[0]["input"]["structure"])
         tasks.insert_many(sample_tasks)
 
         num_perturb = 2
@@ -43,39 +39,48 @@ def test_analysis(self):
             num_perturb=num_perturb,
             spin_polarized=spin_polarized,
             relax_nonmagnetic=relax_nonmagnetic,
-            db_file=os.path.join(DB_DIR, "db.json"), wf_uuid=wf_uuid,
+            db_file=os.path.join(DB_DIR, "db.json"),
+            wf_uuid=wf_uuid,
         )
         toDb.run_task({})
 
         hubbard_hund_linresp_collection = self.get_task_database().hubbard_hund_linresp
-        from pprint import pprint
-        hubbard_hund_analysis = hubbard_hund_linresp_collection.find_one({"formula_pretty": formula_pretty})
+
+        hubbard_hund_analysis = hubbard_hund_linresp_collection.find_one(
+            {"formula_pretty": formula_pretty}
+        )
 
         # For LiNiPO4: site0 = O-p, site1 = Ni-d
         uj_dict = hubbard_hund_analysis["hubbard_hund_results"]
 
         # Point-wise inversion
-        self.assertAlmostEqual(uj_dict["point"]["values"]["site0"]["U"]["value"],
-                               2.3, 1)
-        self.assertAlmostEqual(uj_dict["point"]["values"]["site1"]["U"]["value"],
-                               2.7, 1)
+        self.assertAlmostEqual(
+            uj_dict["point"]["values"]["site0"]["U"]["value"], 2.3, 1
+        )
+        self.assertAlmostEqual(
+            uj_dict["point"]["values"]["site1"]["U"]["value"], 2.7, 1
+        )
 
         # Atom-wise inversion
-        self.assertAlmostEqual(uj_dict["atom"]["values"]["site0"]["simple"]["U"]["value"],
-                               9.1, 1)
-        self.assertAlmostEqual(uj_dict["atom"]["values"]["site1"]["simple"]["U"]["value"],
-                               4.7, 1)
-
+        self.assertAlmostEqual(
+            uj_dict["atom"]["values"]["site0"]["simple"]["U"]["value"], 9.1, 1
+        )
+        self.assertAlmostEqual(
+            uj_dict["atom"]["values"]["site1"]["simple"]["U"]["value"], 4.7, 1
+        )
 
-        self.assertAlmostEqual(uj_dict["atom"]["values"]["site1"]["simple"]["J"]["value"],
-                               0.40, 1)
+        self.assertAlmostEqual(
+            uj_dict["atom"]["values"]["site1"]["simple"]["J"]["value"], 0.40, 1
+        )
 
         # Full inversion
-        self.assertAlmostEqual(uj_dict["full"]["values"]["site0"]["simple"]["U"]["value"],
-                               9.1, 1)
-        self.assertAlmostEqual(uj_dict["full"]["values"]["site1"]["simple"]["U"]["value"],
-                               4.7, 1)
-
+        self.assertAlmostEqual(
+            uj_dict["full"]["values"]["site0"]["simple"]["U"]["value"], 9.1, 1
+        )
+        self.assertAlmostEqual(
+            uj_dict["full"]["values"]["site1"]["simple"]["U"]["value"], 4.7, 1
+        )
 
-        self.assertAlmostEqual(uj_dict["full"]["values"]["site1"]["simple"]["J"]["value"],
-                               0.40, 1)
+        self.assertAlmostEqual(
+            uj_dict["full"]["values"]["site1"]["simple"]["J"]["value"], 0.40, 1
+        )
diff --git a/atomate/vasp/workflows/tests/test_neb_workflow.py b/atomate/vasp/workflows/tests/test_neb_workflow.py
index db88cd37e..cc8d3b5c5 100644
--- a/atomate/vasp/workflows/tests/test_neb_workflow.py
+++ b/atomate/vasp/workflows/tests/test_neb_workflow.py
@@ -1,18 +1,16 @@
+import copy
+import unittest
 from pathlib import Path
 
 import ruamel.yaml as yaml
-import unittest
-import copy
-
 from fireworks.core.fworker import FWorker
 from fireworks.core.rocket_launcher import rapidfire
+from pymatgen.core import Structure
+from pymatgen.util.testing import PymatgenTest
 
+from atomate.utils.testing import AtomateTest
 from atomate.vasp.powerups import use_fake_vasp, use_potcar_spec
 from atomate.vasp.workflows.presets.core import wf_nudged_elastic_band
-from atomate.utils.testing import AtomateTest
-
-from pymatgen.core import Structure
-from pymatgen.util.testing import PymatgenTest
 
 try:
     from pymatgen.analysis.diffusion.neb.io import get_endpoints_from_index
@@ -51,7 +49,7 @@ def setUp(self):
 
         test_yaml = wf_dir / "config/neb_unittest.yaml"
         with open(test_yaml) as stream:
-            self.config = yaml.safe_load(stream)
+            self.config = yaml.load(stream)
 
         # Use scratch directory as destination directory for testing
         env = {"run_dest_root": self.scratch_dir}
diff --git a/atomate/vasp/workflows/tests/test_nmr.py b/atomate/vasp/workflows/tests/test_nmr.py
index 4dd8e4a6d..5511142ef 100644
--- a/atomate/vasp/workflows/tests/test_nmr.py
+++ b/atomate/vasp/workflows/tests/test_nmr.py
@@ -2,15 +2,13 @@
 import unittest
 
 import numpy as np
-
 from fireworks import FWorker
 from fireworks.core.rocket_launcher import rapidfire
+from pymatgen.core import Structure
 
-from atomate.vasp.powerups import use_fake_vasp
-from atomate.vasp.workflows.presets.core import wf_nmr
 from atomate.utils.testing import AtomateTest
-
-from pymatgen.core import Structure
+from atomate.vasp.powerups import use_custodian, use_fake_vasp
+from atomate.vasp.workflows.presets.core import wf_nmr
 
 module_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)))
 db_dir = os.path.join(module_dir, "..", "..", "..", "common", "test_files")