Skip to content

Commit

Permalink
Added option for just writing the input, not running DFTB+.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulsaxe committed Jan 19, 2024
1 parent f618c41 commit d13187b
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 15 deletions.
18 changes: 6 additions & 12 deletions dftbplus_step/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,9 @@ def __init__(
self.mapping_from_primitive = None
self.mapping_to_primitive = None
self.results = None # Results of the calculation from the tag file.
self._input_only = False

super().__init__(flowchart=flowchart, title=title, extension=extension)

@property
def input_only(self):
"""Whether to write the input only, not run MOPAC."""
return self._input_only

@input_only.setter
def input_only(self, value):
self._input_only = value

@property
def is_runable(self):
"""Indicate whether this not runs or just adds input."""
Expand Down Expand Up @@ -719,6 +709,10 @@ def run(self, current_input):
"""
system, configuration = self.get_system_configuration(None)

P = self.parameters.current_values_to_dict(
context=seamm.flowchart_variables._data
)

directory = Path(self.directory)
directory.mkdir(parents=True, exist_ok=True)

Expand Down Expand Up @@ -757,7 +751,7 @@ def run(self, current_input):
with path.open(mode="w") as fd:
fd.write(files[filename])

if not self.input_only:
if not P["input only"]:
# Get the computational environment and set limits
ce = seamm_exec.computational_environment()

Expand Down Expand Up @@ -828,7 +822,7 @@ def run(self, current_input):

logger.debug("\n" + pprint.pformat(result))

if not self.input_only:
if not P["input only"]:
# Parse the results.tag file
path = directory / "results.tag"
if path.exists():
Expand Down
12 changes: 12 additions & 0 deletions dftbplus_step/energy_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@ class EnergyParameters(seamm.Parameters):
"""

parameters = {
"input only": {
"default": "no",
"kind": "boolean",
"default_units": "",
"enumeration": (
"yes",
"no",
),
"format_string": "s",
"description": "Write the input files and stop:",
"help_text": "Don't run DFTB+. Just write the input files.",
},
"primitive cell": {
"default": "Yes",
"kind": "boolean",
Expand Down
11 changes: 9 additions & 2 deletions dftbplus_step/tk_energy.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ def create_dialog(self, title="Edit DFTB+ Energy Step"):
# Create all the widgets
P = self.node.parameters

# Just write input
self["input only"] = P["input only"].widget(self["frame"])

# Frame to isolate widgets
e_frame = self["energy frame"] = ttk.LabelFrame(
self["frame"],
Expand All @@ -69,7 +72,7 @@ def create_dialog(self, title="Edit DFTB+ Energy Step"):
)

for key in dftbplus_step.EnergyParameters.parameters:
if key not in ("results", "extra keywords", "create tables"):
if key not in ("results", "extra keywords", "create tables", "input only"):
self[key] = P[key].widget(e_frame)

# Set the callbacks for changes
Expand Down Expand Up @@ -117,8 +120,12 @@ def reset_dialog(self, widget=None):
for slave in frame.grid_slaves():
slave.grid_forget()

# Put in the energy frame
row = 0
# Whether to just write input
self["input only"].grid(row=row, column=0, sticky=tk.W)
row += 1

# Put in the energy frame
self["energy frame"].grid(row=row, column=0, sticky=tk.N)
row += 1

Expand Down
2 changes: 1 addition & 1 deletion dftbplus_step/tk_optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def create_dialog(self, title="Edit DFTB+ Optimization Step"):
def reset_dialog(self, widget=None):
super().reset_dialog()

row = 0
row = 1
self["optimization frame"].grid(row=row, column=1, sticky=tk.EW)
row += 1
self["structure frame"].grid(row=row, column=0, columnspan=2)
Expand Down

0 comments on commit d13187b

Please sign in to comment.