コード例 #1
0
    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)")
try:
    print("\neigenvalues:", energy([item[2] for item in result]))
except:
    exit()
コード例 #2
0
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,
                     output_index=result_pattern,
                     pool=pool,
                     debug=False)
if pool: pool.close()
print("(run time: " + str(round(time.time() - start_time, 1)) + "s)")
show_result(result,
            result_pattern=result_pattern,
            kz_zero=kz_zero,
            pretty_print=pretty_print)