Skip to content

Commit

Permalink
clean up gjf formatting a bit
Browse files Browse the repository at this point in the history
corinwagen committed Mar 27, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent c7f6ba1 commit 75f92e6
Showing 3 changed files with 48 additions and 45 deletions.
7 changes: 5 additions & 2 deletions cctk/gaussian_file.py
Original file line number Diff line number Diff line change
@@ -95,7 +95,7 @@ def __init__(
self.job_types = job_types

@classmethod
def write_molecule_to_file(cls, filename, molecule, route_card, link0={"mem": "32GB", "nprocshared": 16}, footer=None, title="title", append=False):
def write_molecule_to_file(cls, filename, molecule, route_card, link0={"mem": "32GB", "nprocshared": 16}, footer=None, title="title", append=False, print_symbol=False):
"""
Write a ``.gjf`` file using the given molecule.
@@ -107,6 +107,7 @@ def write_molecule_to_file(cls, filename, molecule, route_card, link0={"mem": "3
footer (str): footer for new file
title (str): title of the file, defaults to "title"
append (Bool): whether or not to append to file using Link1 specifications
print_symbol (Bool): whether to print atomic symbols (instead of atomic numbers)
"""
if not isinstance(molecule, Molecule):
raise TypeError("need a valid molecule to write a file!")
@@ -128,7 +129,9 @@ def write_molecule_to_file(cls, filename, molecule, route_card, link0={"mem": "3
text += f"{int(molecule.charge)} {int(molecule.multiplicity)}\n"
for index, Z in enumerate(molecule.atomic_numbers, start=1):
line = molecule.get_vector(index)
text += f"{Z:2d} {line[0]:.8f} {line[1]:.8f} {line[2]:.8f}\n"
if print_symbol:
Z = get_symbol(Z)
text += f"{Z:2d} {line[0]:>13.8f} {line[1]:>13.8f} {line[2]:>13.8f}\n"

text += "\n"
if footer is not None:
24 changes: 12 additions & 12 deletions test/static/14-butanedione.gjf
Original file line number Diff line number Diff line change
@@ -5,16 +5,16 @@
title

0 1
6 1.38206090 2.09031660 0.00029410
6 -0.02285010 1.54211260 0.00029510
1 1.44893090 3.20249860 0.00028910
1 -0.56534610 1.90991060 -0.88062190
6 0.00000000 0.00000000 0.00000000
1 -0.56522210 1.90958060 0.88143110
8 2.38573090 1.41377460 0.00029810
6 -1.41099690 -0.53146624 -0.03056004
1 -2.05221454 -0.20191335 0.81894289
1 0.49339313 -0.30876681 0.93103078
1 0.56441437 -0.36518936 -0.86090239
8 -1.85442278 -1.26014431 -0.88931747
6 1.38206090 2.09031660 0.00029410
6 -0.02285010 1.54211260 0.00029510
1 1.44893090 3.20249860 0.00028910
1 -0.56534610 1.90991060 -0.88062190
6 0.00000000 0.00000000 0.00000000
1 -0.56522210 1.90958060 0.88143110
8 2.38573090 1.41377460 0.00029810
6 -1.41099690 -0.53146624 -0.03056004
1 -2.05221454 -0.20191335 0.81894289
1 0.49339313 -0.30876681 0.93103078
1 0.56441437 -0.36518936 -0.86090239
8 -1.85442278 -1.26014431 -0.88931747

62 changes: 31 additions & 31 deletions test/static/gaussian_file.gjf
Original file line number Diff line number Diff line change
@@ -5,35 +5,35 @@
title

0 1
7 2.99787600 -0.51206400 -0.44431600
1 2.80991800 -1.15793000 -1.20325700
6 1.87680600 0.25250600 0.02252100
1 1.90476400 0.31802900 1.11700900
6 1.95458200 1.68396000 -0.50614200
6 0.58459400 -0.42556600 -0.44586900
1 1.84214900 1.75364100 -1.59177700
8 0.60452600 -1.36606000 -1.22851600
7 -0.55868500 0.08920700 0.05266900
1 -0.55284000 0.91956900 0.63687100
6 -1.84058000 -0.39000200 -0.40081900
1 -1.83468200 -0.54962500 -1.48475700
6 -2.16988400 -1.72503000 0.26788800
6 -2.88543400 0.65707000 -0.03069900
1 -1.32614300 -2.41745300 0.23528600
8 -2.62870500 1.65476400 0.59860100
8 -4.08683200 0.32319000 -0.47504100
6 -5.14300500 1.23478100 -0.13361000
1 -6.04723700 0.80794600 -0.56336100
1 -5.23344800 1.31441500 0.95130900
1 -4.94190600 2.21940200 -0.56022600
9 -3.23993900 -2.29722700 -0.33135300
9 -2.50124600 -1.49220600 1.56768800
9 0.97606700 2.43241000 0.08396200
9 3.14204700 2.22405600 -0.15310500
6 4.11060600 -0.68312900 0.33507100
8 4.26047100 -0.09716100 1.39340900
6 5.11540300 -1.67082700 -0.21169500
1 4.90930900 -2.65842000 0.21416200
1 5.07313700 -1.74598800 -1.30072900
1 6.11606800 -1.36732700 0.09877200
7 2.99787600 -0.51206400 -0.44431600
1 2.80991800 -1.15793000 -1.20325700
6 1.87680600 0.25250600 0.02252100
1 1.90476400 0.31802900 1.11700900
6 1.95458200 1.68396000 -0.50614200
6 0.58459400 -0.42556600 -0.44586900
1 1.84214900 1.75364100 -1.59177700
8 0.60452600 -1.36606000 -1.22851600
7 -0.55868500 0.08920700 0.05266900
1 -0.55284000 0.91956900 0.63687100
6 -1.84058000 -0.39000200 -0.40081900
1 -1.83468200 -0.54962500 -1.48475700
6 -2.16988400 -1.72503000 0.26788800
6 -2.88543400 0.65707000 -0.03069900
1 -1.32614300 -2.41745300 0.23528600
8 -2.62870500 1.65476400 0.59860100
8 -4.08683200 0.32319000 -0.47504100
6 -5.14300500 1.23478100 -0.13361000
1 -6.04723700 0.80794600 -0.56336100
1 -5.23344800 1.31441500 0.95130900
1 -4.94190600 2.21940200 -0.56022600
9 -3.23993900 -2.29722700 -0.33135300
9 -2.50124600 -1.49220600 1.56768800
9 0.97606700 2.43241000 0.08396200
9 3.14204700 2.22405600 -0.15310500
6 4.11060600 -0.68312900 0.33507100
8 4.26047100 -0.09716100 1.39340900
6 5.11540300 -1.67082700 -0.21169500
1 4.90930900 -2.65842000 0.21416200
1 5.07313700 -1.74598800 -1.30072900
1 6.11606800 -1.36732700 0.09877200

0 comments on commit 75f92e6

Please sign in to comment.