Skip to content

Commit

Permalink
The .UHF file is now written if the molecule has a uhf larger than 0 (
Browse files Browse the repository at this point in the history
#74)

* The .UHF file is now written if the molecule has a uhf larger than 0

Signed-off-by: Jonathan Schöps <[email protected]>

* Writes the .CHRG file if the charge is larger than 0

Signed-off-by: Jonathan Schöps <[email protected]>

* charge and uhf can be None

Signed-off-by: Jonathan Schöps <[email protected]>

* Negative charge is now written aswell

Signed-off-by: Jonathan Schöps <[email protected]>

---------

Signed-off-by: Jonathan Schöps <[email protected]>
  • Loading branch information
jonathan-schoeps authored Nov 18, 2024
1 parent 820bdac commit f4b7230
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/mindlessgen/molecules/molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,11 +519,11 @@ def write_xyz_to_file(self, filename: str | Path | None = None):
with open(filename, "w", encoding="utf8") as f:
f.write(self.get_xyz_str())
# if the charge is set, write it to a '.CHRG' file
if self._charge is not None:
if self._charge is not None and self._charge != 0:
with open(filename.with_suffix(".CHRG"), "w", encoding="utf8") as f:
f.write(f"{self.charge}\n")
# if the UHF is set, write it to a '.UHF' file
if self._uhf is not None:
if self._uhf is not None and self._uhf > 0:
with open(filename.with_suffix(".UHF"), "w", encoding="utf8") as f:
f.write(f"{self.uhf}\n")

Expand Down

0 comments on commit f4b7230

Please sign in to comment.