示例#1
0
def test_energies_ev():
    CAPH = CAPHamiltonian(output=os.path.join(dest_dir, "n2_opencap.out"))
    CAPH.run_trajectory(eta_list)
    assert np.isclose(np.real(CAPH.energies_ev(ref_energy=ref_energy)[0]),
                      1.3174781)
    traj = CAPH.track_state(1, tracking="overlap")
    assert np.isclose(np.real(traj.energies_ev(ref_energy=ref_energy)[0]),
                      2.55378)
示例#2
0
# start_idx and end_idx for search use python slice notation (i.e. [start_idx:end_idx]).
corr_energy, corr_eta_opt = traj.find_eta_opt(corrected=True,
                                              start_idx=10,
                                              end_idx=-1,
                                              ref_energy=ref_energy,
                                              units="eV")
uc_energy_au = traj.get_energy(eta_opt, units="au")
corr_energy_au = traj.get_energy(eta_opt, units="au", corrected=True)
print("Uncorrected:")
print(uc_energy)
print(uc_energy_au)
print(eta_opt)
print("Corrected:")
print(corr_energy)
print(corr_energy_au)
print(corr_eta_opt)

import matplotlib.pyplot as plt

plt.plot(np.real(CAPH.energies_ev(ref_energy)),
         np.imag(CAPH.energies_ev(ref_energy)), 'ro')
plt.show()

plt.plot(np.real(traj.energies_ev(ref_energy)),
         np.imag(traj.energies_ev(ref_energy)), '-ro')
plt.plot(np.real(traj.energies_ev(ref_energy, corrected=True)),
         np.imag(traj.energies_ev(ref_energy, corrected=True)), '-bo')
plt.plot(np.real(corr_energy), np.imag(corr_energy), "g*", markersize=20)
plt.plot(np.real(uc_energy), np.imag(uc_energy), "g*", markersize=20)
plt.show()