if "bandchars" not in locals(): bandchars = []
if "multi_orbs_with_arr" not in locals(): multi_orbs_with_arr = []
if "similar_trans" not in locals(): similar_trans = False

start_time = time.time()
if try_parallel:
    cores = multiprocessing.cpu_count()
    try:
        pool = multiprocessing.Pool(processes=cores)
    except:
        pool = ""
else:
    pool = ""


operations = query.match_info(Info, multi_orbs_with_arr=multi_orbs_with_arr,
    chars_for_bands=bandchars, similar_trans=similar_trans)
for item in operations:
    print(item["name"], item["rep"])
print()

result = simple_calc(operations, order_list=order_list, pool=pool, debug=False)
if pool: pool.close()

print("result:\n","\n".join([str(item) for item in result]))
from functools import reduce
import operator
final_without_E = reduce(operator.add,
    [item[1]*item[2] for item in result if item[2] != sp.eye(item[2].shape[0])],
    sp.zeros(result[0][2].shape[0]))
print("final without E:\n["+",\n".join([str(row) for row in final_without_E.tolist()])+"]")
print("(run time: "+str(round(time.time() - start_time, 1))+"s)")
Пример #2
0
if "bandchars" not in locals(): bandchars = []
if "multi_orbs_with_arr" not in locals(): multi_orbs_with_arr = []
if "similar_trans" not in locals(): similar_trans = False

start_time = time.time()
if try_parallel:
    cores = multiprocessing.cpu_count()
    try:
        pool = multiprocessing.Pool(processes=cores)
    except:
        pool = ""
else:
    pool = ""

operations_ori = query.match_info(Info, multi_orbs_with_arr=multi_orbs_with_arr,
    chars_for_bands=bandchars, similar_trans=similar_trans)
c4 = query.match_info(get_data(TR=True)["C4h"], multi_orbs_with_arr=multi_orbs_with_arr,
    chars_for_bands=bandchars, similar_trans=similar_trans)[0]
operations = [operations_ori[0],
    {"op3x3":c4['op3x3']**-1*operations_ori[1]["op3x3"]*c4['op3x3'],
     "rep":c4['rep']**-1*operations_ori[1]["rep"]*c4['rep'],
     "is_au":False,
     "name":"M_x"}, operations_ori[2]]

for item in operations:
    print(item["name"], item["rep"])
print()
#print(operations)

result = simple_calc(operations, order_list=order_list, pool=pool, debug=False)
if pool: pool.close()