<jupyter_start><jupyter_text>Histogram<jupyter_code>from tqdm.notebook import tqdm
def Get_Hist_data(Histogram_data, I_term):
    E_list=[]
    for m_index in tqdm(range(Histogram_data[list(Histogram_data.keys())[0]]['Measurements'].shape[0])):
        E=I_term
        for M_dict_key in Histogram_data:
            coeff = Histogram_data[M_dict_key]['coeff']
            parity =  1 if sum(map(int, Histogram_data[M_dict_key]['Measurements'][m_index])) % 2 == 0 else -1
            E+=coeff*parity
        E_list.append(E)
    return E_list
    
    
I_term = -4.142299396835105

E_list_SEQ_ROT_XY=Get_Hist_data(SEQ_ROT_Hist_data_XY, 0)
E_list_SEQ_ROT_Z=Get_Hist_data(SEQ_ROT_Hist_data_Z, 0)
import numpy as np

E_list_SEQ_ROT_XY=np.array(E_list_SEQ_ROT_XY, dtype=float).tolist()
E_list_SEQ_ROT_Z=np.array(E_list_SEQ_ROT_Z, dtype=float).tolist()
import json
with open("XY_SEQ_ROT.json", "w") as write_file:
    json.dump(E_list_SEQ_ROT_XY, write_file)
with open("Z_SEQ_ROT.json", "w") as write_file:
    json.dump(E_list_SEQ_ROT_Z, write_file)
with open("XY_SEQ_ROT.json", "r") as read_file:
    E_list_SEQ_ROT_XY = json.load(read_file)
with open("Z_SEQ_ROT.json", "r") as read_file:
    E_list_SEQ_ROT_Z = json.load(read_file)
E_list_SEQ_ROT_XY=np.array(E_list_SEQ_ROT_XY)
E_list_SEQ_ROT_Z=np.array(E_list_SEQ_ROT_Z)
set(E_list_SEQ_ROT_Z)
from matplotlib import pyplot
%matplotlib inline


# bins_standard = len(set(E_list_STANDARD_sim))
bins_standard = 1000

# bin_heights_XY, bin_borders_XY, _=pyplot.hist(E_list_SEQ_ROT_XY,
#                                                           bins_standard, alpha=0.7,
#                                                           label='$XY$ terms',
#                                                           color='b',
#                                                           density=False)

bin_heights_Z, bin_borders_Z, _=pyplot.hist(E_list_SEQ_ROT_Z,
                                                          bins_standard, alpha=1,
                                                          label='$Z$ terms',
                                                          color='b',
                                                          density=True)

pyplot.rcParams["font.family"] = "Times New Roman"
pyplot.ylabel('Probability Density', fontsize=20)
pyplot.xlabel('Energy / Hartree', fontsize=20)
pyplot.xticks(np.arange(0.15,0.17,0.005), fontsize=20)
pyplot.xlim((0.15,0.16)) 
pyplot.yticks(np.arange(0,1500,500), fontsize=20)

pyplot.tight_layout()

file_name = 'LiH_SEQ_ROT_Z.jpeg'
pyplot.savefig(file_name, dpi=300,transparent=True,) # edgecolor='black', facecolor='white')
pyplot.show()
from matplotlib import pyplot
%matplotlib inline


# bins_standard = len(set(E_list_STANDARD_sim))
bins_standard = 1000

bin_heights_XY, bin_borders_XY, _=pyplot.hist(E_list_SEQ_ROT_XY,
                                                          bins_standard, alpha=0.7,
                                                          label='$XY$ terms',
                                                          color='b',
                                                          density=True)

# bin_heights_Z, bin_borders_Z, _=pyplot.hist(E_list_SEQ_ROT_Z,
#                                                           bins_standard, alpha=0.7,
#                                                           label='$Z$ terms',
#                                                           color='r',
#                                                           density=False)

pyplot.rcParams["font.family"] = "Times New Roman"
pyplot.ylabel('Probability Density', fontsize=20)
pyplot.xlabel('Energy / Hartree', fontsize=20)
pyplot.xticks(np.arange(-6,-1,1), fontsize=20)
pyplot.xlim((-6, -2)) 
pyplot.yticks(np.arange(0,3.5,0.5), fontsize=20)

pyplot.tight_layout()

file_name = 'LiH_SEQ_ROT_XY.jpeg'
pyplot.savefig(file_name, dpi=300,transparent=True,) # edgecolor='black', facecolor='white')
pyplot.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1109433962264151, 'fraction_numerical': 0.02389937106918239, 'mean_word_length': 2.000754716981132, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 32, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '631026', 'license': 'MIT', 'n_tokens_mistral': 1410, 'n_tokens_neox': 1319, 'n_words': 182, 'path': 'old_projects/quchem_ibm/Experiments/LiH_Simulation_result/SEQ_ROT_XY_Z_Comparison.ipynb', 'repo_name': 'AlexisRalli/VQE-code', 'size': '3975'}