From 6b5180d2a5f93dbe6e8563e4ce333c3275b88adb Mon Sep 17 00:00:00 2001 From: AnirudhG07 Date: Wed, 2 Oct 2024 11:54:56 +0530 Subject: [PATCH] bug fix with bpath --- src/bept/gen/interface.py | 58 ++++++++++++--------------------------- test/data/1l2y.in | 27 ++++++++++++++++++ 2 files changed, 45 insertions(+), 40 deletions(-) create mode 100644 test/data/1l2y.in diff --git a/src/bept/gen/interface.py b/src/bept/gen/interface.py index 1b28cb3..99716b2 100644 --- a/src/bept/gen/interface.py +++ b/src/bept/gen/interface.py @@ -1,27 +1,18 @@ -import toml import warnings from copy import deepcopy -from bept.gen.toml_in_converter import in_toml, toml_in -from typing import Coroutine, Any +from typing import Any, Coroutine + +import toml from textual import on from textual.app import App -from textual.containers import Vertical, Horizontal, VerticalScroll -from textual.widgets import ( - Footer, - Label, - Checkbox, - RadioSet, - RadioButton, - TabbedContent, - Input, - TabPane, - Select, - Collapsible, - Static, - OptionList, -) +from textual.containers import Horizontal, Vertical, VerticalScroll +from textual.widgets import (Checkbox, Collapsible, Footer, Input, Label, + OptionList, RadioButton, RadioSet, Select, Static, + TabbedContent, TabPane) from textual.widgets.option_list import Option +from bept.gen.toml_in_converter import in_toml, toml_in + # GLOBALS TAB_NAMES = ["Input", "Misc-Options", "Output-Settings"] possible_inputs = ["mg-auto", "mg-para", "mg-manual", "fe-manual", "mg-dummy"] @@ -55,14 +46,7 @@ def generate_toml_file(input_file): - global \ - data, \ - input_file_name, \ - write_commands, \ - calcenergy, \ - calcforce, \ - selected_input, \ - form + global data, input_file_name, write_commands, calcenergy, calcforce, selected_input, form in_toml(input_file) toml_input_file_name = input_file_name = input_file[:-3] + ".toml" @@ -1519,20 +1503,18 @@ def compose(self): yield Label("Output") with Collapsible(title="FORMAT TO WRITE DATA:"): with RadioSet(id="format"): - yield RadioButton( - "OpenDX", id="dx", value=(self.write_pot[0] == "dx") - ) + yield RadioButton("OpenDX", id="dx", value=(self.format[0] == "dx")) yield RadioButton( "AVS UCD", id="avs", disabled=(selected_input != "fe-manual"), - value=(self.write_pot[0] == "avs"), + value=(self.format[0] == "avs"), ) yield RadioButton( "UBHD", id="uhbd", disabled=(selected_input == "fe-manual"), - value=(self.write_pot[0] == "uhbd"), + value=(self.format[0] == "uhbd"), ) @@ -1542,14 +1524,7 @@ def __init__(self, input_path): self.input_path = input_path # Initializations - global \ - data, \ - input_file_name, \ - write_commands, \ - calcenergy, \ - calcforce, \ - selected_input, \ - form + global data, input_file_name, write_commands, calcenergy, calcforce, selected_input, form new_data = mg_auto_def cgcent = ["", "", ""] fgcent = ["", "", ""] @@ -1772,7 +1747,10 @@ def action_show_tab(self, tab: str) -> None: def action_quit(self) -> Coroutine[Any, Any, None]: """Triggers when the App is quit""" - self.new_data["read"]["mol"] = ["pqr", data["read"]["mol"][1].split(".")[0] + ".pqr"] + self.new_data["read"]["mol"] = [ + "pqr", + data["read"]["mol"][1].split(".")[0] + ".pqr", + ] self.new_data["elec"]["calcforce"] = calcforce self.new_data["elec"]["calcenergy"] = calcenergy for i in range(len(write_commands)): diff --git a/test/data/1l2y.in b/test/data/1l2y.in new file mode 100644 index 0000000..2744298 --- /dev/null +++ b/test/data/1l2y.in @@ -0,0 +1,27 @@ +read + mol pqr 1l2y.pqr +end +elec + mg-auto + dime 97 65 65 + cglen 42.9505 38.8433 27.8477 + fglen 42.9505 38.8433 27.8477 + cgcent mol 1 + fgcent mol 1 + mol 1 + lpbe + bcfl sdh + pdie 2.0000 + sdie 78.5400 + srfm smol + chgm spl2 + sdens 10.00 + srad 1.40 + swin 0.30 + temp 298.15 + calcenergy total + calcforce no + write pot dx 1l2y.pqr +end +print elecEnergy 1 end +quit