Skip to content

Commit

Permalink
format with black 20
Browse files Browse the repository at this point in the history
  • Loading branch information
loriab committed Aug 31, 2020
1 parent 514d68d commit ba6b49b
Show file tree
Hide file tree
Showing 13 changed files with 520 additions and 102 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[tool.black]
line-length = 120
target-version = ['py37']
target-version = ['py37', 'py38']
8 changes: 4 additions & 4 deletions qcengine/extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ def get_information(key):

def provenance_stamp(routine):
"""Return dictionary satisfying QCSchema,
https://github.com/MolSSI/QCSchema/blob/master/qcschema/dev/definitions.py#L23-L41
with QCEngine's credentials for creator and version. The
generating routine's name is passed in through `routine`.
https://github.com/MolSSI/QCSchema/blob/master/qcschema/dev/definitions.py#L23-L41
with QCEngine's credentials for creator and version. The
generating routine's name is passed in through `routine`.
"""
"""
return {"creator": "QCEngine", "version": get_information("version"), "routine": routine}


Expand Down
41 changes: 19 additions & 22 deletions qcengine/mdi_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def __init__(
raise_error: bool = False,
local_options: Optional[Dict[str, Any]] = None,
):
""" Initialize an MDIServer object for communication with MDI
"""Initialize an MDIServer object for communication with MDI
Parameters
----------
Expand Down Expand Up @@ -157,7 +157,7 @@ def __init__(
self.comm = MDI_Accept_Communicator()

def update_molecule(self, key: str, value):
""" Update the molecule
"""Update the molecule
Parameters
----------
Expand Down Expand Up @@ -195,7 +195,7 @@ def update_molecule(self, key: str, value):

# Respond to the <@ command
def send_node(self) -> str:
""" Send the name of the current node through MDI
"""Send the name of the current node through MDI
Returns
-------
Expand All @@ -208,7 +208,7 @@ def send_node(self) -> str:

# Respond to the <NATOMS command
def send_natoms(self) -> int:
""" Send the number of atoms through MDI
"""Send the number of atoms through MDI
Returns
-------
Expand All @@ -221,7 +221,7 @@ def send_natoms(self) -> int:

# Respond to the <COORDS command
def send_coords(self) -> np.ndarray:
""" Send the nuclear coordinates through MDI
"""Send the nuclear coordinates through MDI
Returns
-------
Expand All @@ -237,7 +237,7 @@ def send_coords(self) -> np.ndarray:

# Respond to the >COORDS command
def recv_coords(self, coords: Optional[np.ndarray] = None) -> None:
""" Receive a set of nuclear coordinates through MDI and assign them to the atoms in the current molecule
"""Receive a set of nuclear coordinates through MDI and assign them to the atoms in the current molecule
Parameters
----------
Expand All @@ -253,7 +253,7 @@ def recv_coords(self, coords: Optional[np.ndarray] = None) -> None:

# Respond to the <ENERGY command
def send_energy(self) -> float:
""" Send the total energy through MDI
"""Send the total energy through MDI
Returns
-------
Expand All @@ -270,7 +270,7 @@ def send_energy(self) -> float:

# Respond to the <FORCES command
def send_forces(self) -> np.ndarray:
""" Send the nuclear forces through MDI
"""Send the nuclear forces through MDI
Returns
-------
Expand All @@ -294,8 +294,7 @@ def send_forces(self) -> np.ndarray:

# Respond to the SCF command
def run_energy(self) -> None:
""" Run an energy calculation
"""
"""Run an energy calculation"""
input = qcel.models.AtomicInput(
molecule=self.molecule, driver="energy", model=self.model, keywords=self.keywords
)
Expand All @@ -305,7 +304,7 @@ def run_energy(self) -> None:

# Respond to the <ELEMENTS command
def send_elements(self):
""" Send the atomic number of each nucleus through MDI
"""Send the atomic number of each nucleus through MDI
Returns
-------
Expand All @@ -319,7 +318,7 @@ def send_elements(self):

# Respond to the >ELEMENTS command
def recv_elements(self, elements: Optional[List[int]] = None):
""" Receive a set of atomic numbers through MDI and assign them to the atoms in the current molecule
"""Receive a set of atomic numbers through MDI and assign them to the atoms in the current molecule
Parameters
----------
Expand All @@ -337,7 +336,7 @@ def recv_elements(self, elements: Optional[List[int]] = None):

# Respond to the <MASSES command
def send_masses(self) -> np.ndarray:
""" Send the nuclear masses through MDI
"""Send the nuclear masses through MDI
Returns
-------
Expand All @@ -351,7 +350,7 @@ def send_masses(self) -> np.ndarray:

# Respond to the >MASSES command
def recv_masses(self, masses: Optional[List[float]] = None) -> None:
""" Receive a set of nuclear masses through MDI and assign them to the atoms in the current molecule
"""Receive a set of nuclear masses through MDI and assign them to the atoms in the current molecule
Parameters
----------
Expand All @@ -365,7 +364,7 @@ def recv_masses(self, masses: Optional[List[float]] = None) -> None:

# Respond to the <TOTCHARGE command
def send_total_charge(self) -> float:
""" Send the total system charge through MDI
"""Send the total system charge through MDI
Returns
-------
Expand All @@ -378,7 +377,7 @@ def send_total_charge(self) -> float:

# Respond to the >TOTCHARGE command
def recv_total_charge(self, charge: Optional[float] = None) -> None:
""" Receive the total system charge through MDI
"""Receive the total system charge through MDI
Parameters
----------
Expand All @@ -397,7 +396,7 @@ def recv_total_charge(self, charge: Optional[float] = None) -> None:

# Respond to the <ELEC_MULT command
def send_multiplicity(self) -> int:
""" Send the electronic multiplicity through MDI
"""Send the electronic multiplicity through MDI
Returns
-------
Expand All @@ -410,7 +409,7 @@ def send_multiplicity(self) -> int:

# Respond to the >ELEC_MULT command
def recv_multiplicity(self, multiplicity: Optional[int] = None) -> None:
""" Receive the electronic multiplicity through MDI
"""Receive the electronic multiplicity through MDI
Parameters
----------
Expand All @@ -429,14 +428,12 @@ def recv_multiplicity(self, multiplicity: Optional[int] = None) -> None:

# Respond to the EXIT command
def stop(self) -> None:
""" Stop listening for MDI commands
"""
"""Stop listening for MDI commands"""
self.stop_listening = True

# Enter server mode, listening for commands from the driver
def start(self) -> None:
""" Receive commands through MDI and respond to them as defined by the MDI Standard
"""
"""Receive commands through MDI and respond to them as defined by the MDI Standard"""

while not self.stop_listening:
if self.world_rank == 0:
Expand Down
5 changes: 4 additions & 1 deletion qcengine/procedures/berny.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ class BernyProcedure(ProcedureHarness):

def found(self, raise_error: bool = False) -> bool:
return which_import(
"berny", return_bool=True, raise_error=raise_error, raise_msg="Please install via `pip install pyberny`.",
"berny",
return_bool=True,
raise_error=raise_error,
raise_msg="Please install via `pip install pyberny`.",
)

def build_input_model(self, data: Union[Dict[str, Any], "OptimizationInput"]) -> "OptimizationInput":
Expand Down
4 changes: 1 addition & 3 deletions qcengine/programs/cfour/harvester.py
Original file line number Diff line number Diff line change
Expand Up @@ -920,9 +920,7 @@ def harvest_GRD(grd):


def harvest_DIPOL(dipol):
"""Parses the contents *dipol* of the Cfour DIPOL file into a dipol vector.
"""
"""Parses the contents *dipol* of the Cfour DIPOL file into a dipol vector."""
dipol = dipol.splitlines()
lline = dipol[0].split()
dip = [float(lline[0]), float(lline[1]), float(lline[2])]
Expand Down
4 changes: 2 additions & 2 deletions qcengine/programs/gamess/harvester.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ def harvest(p4Mol, gamessout: str, **largs) -> Tuple[PreservingDict, Molecule, l

def harvest_output(outtext):
"""Function to separate portions of a gamess output file *outtext*,
divided by "Step".
"""
divided by "Step".
"""
pass_qcvar = []
pass_coord = []
pass_grad = []
Expand Down
4 changes: 1 addition & 3 deletions qcengine/programs/openmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ def _get_cache(self, key):
return self._CACHE[key]["value"]

def _cache_it(self, key, value):
"""Add to our LRU cache, possibly popping off least used key.
"""
"""Add to our LRU cache, possibly popping off least used key."""
self._CACHE[key] = {"value": value, "last_used": datetime.datetime.utcnow()}

# if cache is beyond max size, whittle it down by dropping entry least
Expand Down
21 changes: 18 additions & 3 deletions qcengine/programs/tests/standard_suite_contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,12 @@ def contractual_mp2(
)
or (
((qc_module == "psi4-occ" and reference == "rohf" and method in ["olccd"]))
and pv in ["MP2 CORRELATION ENERGY", "MP2 TOTAL ENERGY", "MP2 SINGLES ENERGY",]
and pv
in [
"MP2 CORRELATION ENERGY",
"MP2 TOTAL ENERGY",
"MP2 SINGLES ENERGY",
]
)
or (
(
Expand Down Expand Up @@ -481,11 +486,21 @@ def contractual_ccsd(
)
or (
(qc_module == "cfour-vcc" and reference in ["rohf"] and method in ["ccsd", "ccsd(t)"])
and pv in ["CCSD SAME-SPIN CORRELATION ENERGY", "CCSD SINGLES ENERGY", "CCSD DOUBLES ENERGY",]
and pv
in [
"CCSD SAME-SPIN CORRELATION ENERGY",
"CCSD SINGLES ENERGY",
"CCSD DOUBLES ENERGY",
]
)
or (
(qc_module == "cfour-ecc" and reference in ["rohf"] and method in ["ccsd", "ccsd(t)"])
and pv in ["CCSD OPPOSITE-SPIN CORRELATION ENERGY", "CCSD SINGLES ENERGY", "CCSD DOUBLES ENERGY",]
and pv
in [
"CCSD OPPOSITE-SPIN CORRELATION ENERGY",
"CCSD SINGLES ENERGY",
"CCSD DOUBLES ENERGY",
]
)
or (
(
Expand Down
Loading

0 comments on commit ba6b49b

Please sign in to comment.