Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 16, 2024
1 parent fb328dd commit 1eb013f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 deletions.
6 changes: 2 additions & 4 deletions cclib/io/qcschemareader.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2021, the cclib development team
# Copyright (c) 2021-2024, the cclib development team
#
# This file is part of cclib (http://cclib.github.io) and is distributed under
# the terms of the BSD 3-Clause License.

"""A reader for MolSSI quantum chemical JSON (QCSchema) files.
"""
"""A reader for MolSSI quantum chemical JSON (QCSchema) files."""

from cclib.io.cjsonreader import CJSON as CJSONReader

Expand Down
22 changes: 10 additions & 12 deletions cclib/io/qcschemawriter.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2021, the cclib development team
# Copyright (c) 2021-2024, the cclib development team
#
# This file is part of cclib (http://cclib.github.io) and is distributed under
# the terms of the BSD 3-Clause License.

"""A writer for MolSSI quantum chemical JSON (QCSchema) files.
"""
"""A writer for MolSSI quantum chemical JSON (QCSchema) files."""

import json

Expand Down Expand Up @@ -106,7 +104,7 @@ def as_dict(self, validate=True):
)
return_energy = ccsd_total_energy
else:
raise RuntimeError("Don't know what to do with method {}".format(method))
raise RuntimeError(f"Don't know what to do with method {method}")

scf_dipole_moment = None
if hasattr(self.ccdata, "moments"):
Expand Down Expand Up @@ -155,9 +153,9 @@ def as_dict(self, validate=True):
# scf_xc_energy
}
if hasattr(self.ccdata, "dispersionenergies"):
qcschema_dict["properties"][
"scf_dispersion_correction_energy"
] = self.ccdata.dispersionenergies[-1]
qcschema_dict["properties"]["scf_dispersion_correction_energy"] = (
self.ccdata.dispersionenergies[-1]
)
if scf_dipole_moment is not None:
qcschema_dict["scf_dipole_moment"] = scf_dipole_moment
if mp2_correlation_energy is not None:
Expand Down Expand Up @@ -205,9 +203,9 @@ def as_dict(self, validate=True):
if has_beta:
mocoeffs_b = self.ccdata.mocoeffs[1]
if not np.isnan(mocoeffs_b).any():
qcschema_dict["wavefunction"][
"scf_orbitals_b"
] = mocoeffs_b.transpose().tolist()
qcschema_dict["wavefunction"]["scf_orbitals_b"] = (
mocoeffs_b.transpose().tolist()
)

if driver == "energy":
return_result = return_energy
Expand All @@ -216,7 +214,7 @@ def as_dict(self, validate=True):
elif driver == "hessian":
return_result = self.ccdata.hessian.flatten().tolist()
else:
raise RuntimeError("Don't know driver {}".format(driver))
raise RuntimeError(f"Don't know driver {driver}")
qcschema_dict["return_result"] = return_result

if validate:
Expand Down
3 changes: 1 addition & 2 deletions test/io/testqcschemawriter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2021, the cclib development team
# Copyright (c) 2021-2024, the cclib development team
#
# This file is part of cclib (http://cclib.github.io) and is distributed under
# the terms of the BSD 3-Clause License.
Expand Down

0 comments on commit 1eb013f

Please sign in to comment.