コード例 #1
0
ファイル: __init__.py プロジェクト: nishattasnimliza/PyQchem
def plot_rasci_state_configurations(states):
    for i, state in enumerate(states):
        plt.figure(figsize=(len(state['configurations']), 5))
        plt.title('State {}'.format(i + 1))
        amplitude_list = []
        for j, conf in enumerate(state['configurations']):
            plot_state(conf['alpha'], conf['beta'], index=j)
            amplitude_list.append(conf['amplitude'])

        plt.plot(range(1,
                       len(amplitude_list) + 1),
                 np.square(amplitude_list) *
                 len(state['configurations'][0]['alpha']),
                 label='amplitudes')
        plt.xlabel('Configurations')
        plt.ylabel('Amplitude')
        plt.axis('off')
        plt.legend()

    plt.show()
コード例 #2
0
    print('\nState {}'.format(i + 1))
    print('Transition DM: ', state['transition_moment'])
    print('Energy: ', state['excitation_energy'])
    print(' Alpha  Beta   Amplitude')
    for j, conf in enumerate(state['configurations']):
        print('  {}  {} {:8.3f}'.format(conf['alpha'], conf['beta'],
                                        conf['amplitude']))

# plot diabatic states
from pyqchem.plots import plot_state
for i, state in enumerate(parsed_data['excited_states']):
    plt.figure(figsize=(len(state['configurations']), 5))
    plt.title('Adiabatic State {}'.format(i + 1))
    amplitude_list = []
    for j, conf in enumerate(state['configurations']):
        plot_state(conf['alpha'], conf['beta'], index=j)
        amplitude_list.append(conf['amplitude'])

    plt.plot(range(1,
                   len(amplitude_list) + 1),
             np.square(amplitude_list) *
             len(state['configurations'][0]['alpha']),
             label='amplitudes')
    plt.xlabel('Configurations')
    plt.ylabel('Amplitude')
    plt.axis('off')
    plt.legend()

plt.show()

# Analysis of diabatic states to use in diabatization
コード例 #3
0
# print adiabatic states
print('Adiabatic states dimer\n--------------------')
for i, state in enumerate(parsed_data['excited_states']):
    print('\nState {}'.format(i + 1))
    print('Transition DM: ', state['transition_moment'])
    print('Energy: ', state['excitation_energy'])
    print(' Alpha  Beta   Amplitude')
    for j, conf in enumerate(state['configurations']):
        print('  {}  {} {:8.3f}'.format(conf['alpha'], conf['beta'],
                                        conf['amplitude']))

# plot adiabatic states
for i, state in enumerate(parsed_data['excited_states']):
    plot_state(state,
               with_amplitude=True,
               orbital_range=[
                   qc_input._ras_occ, qc_input._ras_occ + qc_input._ras_act
               ])
    plt.title('Adiabatic State {}'.format(i + 1))

plt.show()

# Analysis of diabatic states to use in diabatization
from pyqchem.utils import is_transition, get_ratio_of_condition
print('\nAdiabatic states to use in diabatization (1e, max_jump 4)')
for i, state in enumerate(parsed_data['excited_states']):
    ratio = get_ratio_of_condition(state, n_electron=1, max_jump=4)
    mark = 'X' if ratio > 0.5 else ''
    print('State {}: {:4.3f}  {}'.format(i + 1, ratio, mark))

# diabatization analysis
コード例 #4
0
# parsed_data = rasci_parser(parsed_data)
# print(parsed_data)

# print adiabatic states
print('\nAdiabatic states dimer\n--------------------')
for i, state in enumerate(parsed_data['excited_states']):
    print('\nState {}'.format(i+1))
    print('Transition DM: ', state['transition_moment'])
    print('Energy: ', state['excitation_energy'])
    print(' Origin  Target   Amplitude')
    for j, conf in enumerate(state['configurations']):
        print('{:^9} {:^7} {:8.3f}'.format(conf['origin'], conf['target'], conf['amplitude']))

# plot adiabatic states
for i, state in enumerate(parsed_data['excited_states']):
    plot_state(state, with_amplitude=True, orbital_range=[dimer.alpha_electrons-4, dimer.alpha_electrons+4])
    plt.title('Adiabatic State {}'.format(i+1))
plt.show()

# diabatization analysis
diabatization = parsed_data['diabatization']

print('\nRotation Matrix')
print(np.array(diabatization['rot_matrix']))

print('\nAdiabatic Matrix')
print(np.array(diabatization['adiabatic_matrix']))

print('\nDiabatic Matrix')
print(np.array(diabatization['diabatic_matrix']))