Skip to content

Commit 4d15c41

Browse files
committed
1. In opt_orb_pytorh_dpsi, add IO.change_info.get_info_max()
1 parent 97faf88 commit 4d15c41

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

tools/opt_orb_pytorch_dpsi/IO/change_info.py

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import addict
2+
import util
3+
import itertools
24

35
def change_info(info_old, weight_old):
46
info_stru = [None] * info_old.Nst
@@ -28,4 +30,47 @@ def change_info(info_old, weight_old):
2830
info_opt.cal_T = info_old.cal_T
2931
info_opt.cal_smooth = info_old.cal_smooth
3032

31-
return info_stru, info_element, info_opt
33+
return info_stru, info_element, info_opt
34+
35+
"""
36+
info_stru =
37+
[{'Na': {'C': 2},
38+
'Nb': 6,
39+
'weight': tensor([0.1250, 0.1250, 0.1150, 0.1150, 0.0200, 0.0000])},
40+
{'Na': {'C': 2},
41+
'Nb': 6,
42+
'weight': tensor([0.1250, 0.1250, 0.0896, 0.0896, 0.0707, 0.0000])}]
43+
44+
info_element =
45+
{'C': {'Ecut': 200,
46+
'Ne': 19,
47+
'Nl': 3,
48+
'Nu': [2, 2, 1],
49+
'Rcut': 6,
50+
'dr': 0.01}}
51+
52+
info_opt =
53+
{'cal_T': False,
54+
'cal_smooth': False,
55+
'lr': 0.01}
56+
"""
57+
58+
59+
def get_info_max(info_stru, info_element):
60+
info_max = [None] * len(info_stru)
61+
for ist in range(len(info_stru)):
62+
Nt = info_stru[ist].Na.keys()
63+
info_max[ist] = addict.Dict()
64+
info_max[ist].Nt = len(Nt)
65+
info_max[ist].Na = max((info_stru[ist].Na[it] for it in Nt))
66+
info_max[ist].Nl = max([info_element[it].Nl for it in Nt])
67+
info_max[ist].Nm = max((util.Nm(info_element[it].Nl-1) for it in Nt))
68+
info_max[ist].Nu = max(itertools.chain.from_iterable([info_element[it].Nu for it in Nt]))
69+
info_max[ist].Ne = max((info_element[it].Ne for it in Nt))
70+
info_max[ist].Nb = info_stru[ist].Nb
71+
return info_max
72+
73+
"""
74+
[{'Na': 2, 'Nb': 6, 'Ne': 19, 'Nl': 3, 'Nm': 5, 'Nt': 1, 'Nu': 2},
75+
{'Na': 2, 'Nb': 6, 'Ne': 19, 'Nl': 3, 'Nm': 5, 'Nt': 1, 'Nu': 2}]
76+
"""

0 commit comments

Comments
 (0)