Skip to content

Commit 6b5180d

Browse files
committed
bug fix with bpath
1 parent d7a546b commit 6b5180d

File tree

2 files changed

+45
-40
lines changed

2 files changed

+45
-40
lines changed

src/bept/gen/interface.py

Lines changed: 18 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,18 @@
1-
import toml
21
import warnings
32
from copy import deepcopy
4-
from bept.gen.toml_in_converter import in_toml, toml_in
5-
from typing import Coroutine, Any
3+
from typing import Any, Coroutine
4+
5+
import toml
66
from textual import on
77
from textual.app import App
8-
from textual.containers import Vertical, Horizontal, VerticalScroll
9-
from textual.widgets import (
10-
Footer,
11-
Label,
12-
Checkbox,
13-
RadioSet,
14-
RadioButton,
15-
TabbedContent,
16-
Input,
17-
TabPane,
18-
Select,
19-
Collapsible,
20-
Static,
21-
OptionList,
22-
)
8+
from textual.containers import Horizontal, Vertical, VerticalScroll
9+
from textual.widgets import (Checkbox, Collapsible, Footer, Input, Label,
10+
OptionList, RadioButton, RadioSet, Select, Static,
11+
TabbedContent, TabPane)
2312
from textual.widgets.option_list import Option
2413

14+
from bept.gen.toml_in_converter import in_toml, toml_in
15+
2516
# GLOBALS
2617
TAB_NAMES = ["Input", "Misc-Options", "Output-Settings"]
2718
possible_inputs = ["mg-auto", "mg-para", "mg-manual", "fe-manual", "mg-dummy"]
@@ -55,14 +46,7 @@
5546

5647

5748
def generate_toml_file(input_file):
58-
global \
59-
data, \
60-
input_file_name, \
61-
write_commands, \
62-
calcenergy, \
63-
calcforce, \
64-
selected_input, \
65-
form
49+
global data, input_file_name, write_commands, calcenergy, calcforce, selected_input, form
6650

6751
in_toml(input_file)
6852
toml_input_file_name = input_file_name = input_file[:-3] + ".toml"
@@ -1519,20 +1503,18 @@ def compose(self):
15191503
yield Label("Output")
15201504
with Collapsible(title="FORMAT TO WRITE DATA:"):
15211505
with RadioSet(id="format"):
1522-
yield RadioButton(
1523-
"OpenDX", id="dx", value=(self.write_pot[0] == "dx")
1524-
)
1506+
yield RadioButton("OpenDX", id="dx", value=(self.format[0] == "dx"))
15251507
yield RadioButton(
15261508
"AVS UCD",
15271509
id="avs",
15281510
disabled=(selected_input != "fe-manual"),
1529-
value=(self.write_pot[0] == "avs"),
1511+
value=(self.format[0] == "avs"),
15301512
)
15311513
yield RadioButton(
15321514
"UBHD",
15331515
id="uhbd",
15341516
disabled=(selected_input == "fe-manual"),
1535-
value=(self.write_pot[0] == "uhbd"),
1517+
value=(self.format[0] == "uhbd"),
15361518
)
15371519

15381520

@@ -1542,14 +1524,7 @@ def __init__(self, input_path):
15421524
self.input_path = input_path
15431525

15441526
# Initializations
1545-
global \
1546-
data, \
1547-
input_file_name, \
1548-
write_commands, \
1549-
calcenergy, \
1550-
calcforce, \
1551-
selected_input, \
1552-
form
1527+
global data, input_file_name, write_commands, calcenergy, calcforce, selected_input, form
15531528
new_data = mg_auto_def
15541529
cgcent = ["", "", ""]
15551530
fgcent = ["", "", ""]
@@ -1772,7 +1747,10 @@ def action_show_tab(self, tab: str) -> None:
17721747

17731748
def action_quit(self) -> Coroutine[Any, Any, None]:
17741749
"""Triggers when the App is quit"""
1775-
self.new_data["read"]["mol"] = ["pqr", data["read"]["mol"][1].split(".")[0] + ".pqr"]
1750+
self.new_data["read"]["mol"] = [
1751+
"pqr",
1752+
data["read"]["mol"][1].split(".")[0] + ".pqr",
1753+
]
17761754
self.new_data["elec"]["calcforce"] = calcforce
17771755
self.new_data["elec"]["calcenergy"] = calcenergy
17781756
for i in range(len(write_commands)):

test/data/1l2y.in

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
read
2+
mol pqr 1l2y.pqr
3+
end
4+
elec
5+
mg-auto
6+
dime 97 65 65
7+
cglen 42.9505 38.8433 27.8477
8+
fglen 42.9505 38.8433 27.8477
9+
cgcent mol 1
10+
fgcent mol 1
11+
mol 1
12+
lpbe
13+
bcfl sdh
14+
pdie 2.0000
15+
sdie 78.5400
16+
srfm smol
17+
chgm spl2
18+
sdens 10.00
19+
srad 1.40
20+
swin 0.30
21+
temp 298.15
22+
calcenergy total
23+
calcforce no
24+
write pot dx 1l2y.pqr
25+
end
26+
print elecEnergy 1 end
27+
quit

0 commit comments

Comments
 (0)