Skip to content

Commit 3305d33

Browse files
committed
add print logo in main and format some of the logger.info
1 parent 7eb57e4 commit 3305d33

File tree

6 files changed

+263
-17
lines changed

6 files changed

+263
-17
lines changed

dptb/__main__.py

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,39 @@
1-
from dptb.entrypoints.main import main
1+
from dptb.entrypoints.main import main as entry_main
2+
import logging
3+
import pyfiglet
4+
from dptb import __version__
25

6+
logging.basicConfig(level=logging.INFO, format='%(message)s')
7+
log = logging.getLogger(__name__)
8+
9+
def print_logo():
10+
f = pyfiglet.Figlet(font='dos_rebel') # 您可以选择您喜欢的字体
11+
logo = f.renderText("DeePTB")
12+
log.info(" ")
13+
log.info(" ")
14+
log.info("#"*81)
15+
log.info("#" + " "*79 + "#")
16+
log.info("#" + " "*79 + "#")
17+
for line in logo.split('\n'):
18+
if line.strip(): # 避免记录空行
19+
log.info('# '+line+ ' #')
20+
log.info("#" + " "*79 + "#")
21+
version_info = f"Version: {__version__}"
22+
padding = (79 - len(version_info)) // 2
23+
nspace = 79-padding
24+
format_str = "#" + "{}"+"{:<"+f"{nspace}" + "}"+ "#"
25+
log.info(format_str.format(" "*padding, version_info))
26+
log.info("#" + " "*79 + "#")
27+
log.info("#"*81)
28+
log.info(" ")
29+
log.info(" ")
30+
def main() -> None:
31+
"""
32+
The main entry point for the dptb package.
33+
"""
34+
print_logo()
35+
entry_main()
336

437
if __name__ == '__main__':
5-
main()
38+
#print_logo()
39+
main()

dptb/plugins/train_logger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class Logger(Plugin):
88
alignment = 4
99
# 不同字段之间的分隔符
10-
separator = '#' * 160
10+
separator = '-' * 81
1111

1212
def __init__(self, fields, interval=None):
1313
if interval is None:

dptb/utils/argcheck.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,8 +1488,7 @@ def collect_cutoffs(jdata):
14881488
log.info("IN PUSH mode, the env correction should not be used. the er_max will not take effect.")
14891489
else:
14901490
if jdata['data_options'].get("r_max") is not None:
1491-
log.info("For usually where the nnsk/push is not used. the cutoffs will take from the model options. like the r_max rs and rc values.")
1492-
log.info("This option will not take effect.")
1491+
log.info("When not nnsk/push. the cutoffs will take from the model options: r_max rs and rc values. this seting in data_options will be ignored.")
14931492

14941493
elif jdata["model_options"].get("dftbsk", None) is not None:
14951494
assert r_max is None, "r_max should not be provided in outside the dftbsk for training dftbsk model."
@@ -1503,11 +1502,12 @@ def collect_cutoffs(jdata):
15031502
assert r_max is not None
15041503
cutoff_options = ({"r_max": r_max, "er_max": er_max, "oer_max": oer_max})
15051504

1506-
log.info("<><><><><><>"*10)
1507-
log.info(f"Cutoff options: ")
1508-
log.info(f"r_max : {r_max}")
1509-
log.info(f"er_max : {er_max}")
1510-
log.info(f"oer_max : {oer_max}")
1511-
log.info("<><><><><><>"*10)
1505+
log.info("-"*66)
1506+
log.info(' {:<55} '.format("Cutoff options:"))
1507+
log.info(' {:<55} '.format(" "*30))
1508+
log.info(' {:<16} : {:<36} '.format("r_max", f"{r_max}"))
1509+
log.info(' {:<16} : {:<36} '.format("er_max", f"{er_max}"))
1510+
log.info(' {:<16} : {:<36} '.format("oer_max", f"{oer_max}"))
1511+
log.info("-"*66)
15121512

15131513
return cutoff_options

examples/hBN/band_plot.ipynb

Lines changed: 214 additions & 0 deletions
Large diffs are not rendered by default.

examples/hBN/data/kpath.0/info.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@
22
"nframes": 1,
33
"natoms": 2,
44
"pos_type": "ase",
5-
"AtomicData_options": {
6-
"r_max": 5.5,
7-
"er_max": 3.5,
8-
"oer_max":1.6,
9-
"pbc": true
10-
},
5+
"pbc": true,
116
"bandinfo": {
127
"band_min": 0,
138
"band_max": 6,

examples/hBN/input_short.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
}
3838
},
3939
"data_options": {
40+
"r_max": 5.5,
41+
"er_max": 3.5,
42+
"oer_max":1.6,
4043
"train": {
4144
"root": "./data/",
4245
"prefix": "kpath",

0 commit comments

Comments
 (0)