Skip to content

Commit

Permalink
bug fix with bpath
Browse files Browse the repository at this point in the history
  • Loading branch information
AnirudhG07 committed Oct 2, 2024
1 parent d7a546b commit 6b5180d
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 40 deletions.
58 changes: 18 additions & 40 deletions src/bept/gen/interface.py
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"),
)


Expand All @@ -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 = ["", "", ""]
Expand Down Expand Up @@ -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)):
Expand Down
27 changes: 27 additions & 0 deletions test/data/1l2y.in
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 6b5180d

Please sign in to comment.