def absorption_spectrum_trimer(self): dd1 = [0.0, 3.0, 0.0] dd2 = [0.0, 1.0, 2.0] dd3 = [0.0, 1.0, 1.0] cf = world.cf with energy_units("1/cm"): m1 = Molecule([0.0, 12100]) m1.set_dipole(0, 1, dd1) m1.set_transition_environment((0, 1), cf) m2 = Molecule([0.0, 11800]) m2.set_dipole(0, 1, dd2) m2.set_transition_environment((0, 1), cf) m3 = Molecule([0.0, 12500]) m3.set_dipole(0, 1, dd3) m3.set_transition_environment((0, 1), cf) m1.position = [0.0, 0.0, 0.0] m2.position = [5.0, 0.0, 0.0] m3.position = [0.0, 5.0, 0.0] AG = Aggregate(name="TestAggregate") AG.add_Molecule(m1) AG.add_Molecule(m2) AG.add_Molecule(m3) AG.set_coupling_by_dipole_dipole(epsr=3.0) AG.build() (RRr, hamr) = AG.get_RelaxationTensor(world.ta, relaxation_theory="standard_Redfield", time_dependent=True) ac = AbsSpectrumCalculator(world.ta, AG, relaxation_tensor=RRr, effective_hamiltonian=hamr) with energy_units("1/cm"): ac.bootstrap(rwa=12000) a1 = ac.calculate() with energy_units("1/cm"): world.abs = numpy.zeros((len(a1.data), 2)) for kk in range(len(a1.data)): world.abs[kk, 0] = a1.axis.data[kk] #frequency[kk] world.abs[kk, 1] = a1.data[kk]
def absorption_spectrum_trimer(self): dd1 = [0.0,3.0,0.0] dd2 = [0.0,1.0,2.0] dd3 = [0.0,1.0,1.0] cf = world.cf with energy_units("1/cm"): m1 = Molecule([0.0, 12100]) m1.set_dipole(0,1,dd1) m1.set_transition_environment((0,1), cf) m2 = Molecule([0.0, 11800]) m2.set_dipole(0,1,dd2) m2.set_transition_environment((0,1), cf) m3 = Molecule([0.0, 12500]) m3.set_dipole(0,1,dd3) m3.set_transition_environment((0,1), cf) m1.position = [0.0,0.0,0.0] m2.position = [5.0,0.0,0.0] m3.position = [0.0,5.0,0.0] AG = Aggregate(name="TestAggregate") AG.add_Molecule(m1) AG.add_Molecule(m2) AG.add_Molecule(m3) AG.set_coupling_by_dipole_dipole(epsr=3.0) AG.build() (RRr,hamr) = AG.get_RelaxationTensor(world.ta, relaxation_theory="standard_Redfield", time_dependent=True) ac = AbsSpectrumCalculator(world.ta,AG, relaxation_tensor=RRr, effective_hamiltonian=hamr) with energy_units("1/cm"): ac.bootstrap(rwa=12000) a1 = ac.calculate(raw=True) with energy_units("1/cm"): world.abs = numpy.zeros((len(a1.data),2)) for kk in range(len(a1.data)): world.abs[kk,0] = a1.axis.data[kk] #frequency[kk] world.abs[kk,1] = a1.data[kk]
def absorption_spectrum_dimer(self): dd1 = [0.0,3.0,0.0] dd2 = [0.0,1.0,1.0] cf = world.cf #cm = CorrelationFunctionMatrix(world.ta,2,1) #cm.set_correlation_function(cf,[(1,1),(0,0)]) with energy_units("1/cm"): m1 = Molecule([0.0, 12100]) m1.set_dipole(0,1,dd1) m1.set_transition_environment((0,1), cf) m2 = Molecule([0.0, 12000]) m2.set_dipole(0,1,dd2) m2.set_transition_environment((0,1), cf) #m1.set_egcf([0,1],cf) #m2.set_egcf([0,1],cf) #m1.set_egcf_mapping((0,1),cm,0) #m2.set_egcf_mapping((0,1),cm,1) m1.position = [0.0,0.0,0.0] m2.position = [5.0,0.0,0.0] AG = Aggregate(name="TestAggregate") #AG.set_egcf_matrix(cm) AG.add_Molecule(m1) AG.add_Molecule(m2) AG.set_coupling_by_dipole_dipole() AG.build() ac = AbsSpectrumCalculator(world.ta,AG) with energy_units("1/cm"): ac.bootstrap(rwa=12000) a1 = ac.calculate(raw=True) with energy_units("1/cm"): world.abs = numpy.zeros((len(a1.data),2)) for kk in range(len(a1.data)): world.abs[kk,0] = a1.axis.data[kk] #frequency[kk] world.abs[kk,1] = a1.data[kk]
def hamiltonian_is_created(self): # # Homodimer # with energy_units(world.h_units): en = world.senergy m1 = Molecule([0.0, en], "mol1") m2 = Molecule([0.0, en], "mol2") agg = Aggregate(name="Homodimer") agg.add_Molecule(m1) agg.add_Molecule(m2) with energy_units(world.r_units): agg.set_resonance_coupling(0, 1, world.r_coupl) agg.build() world.HH = agg.get_Hamiltonian()
def hamiltonian_is_created(self): # # Homodimer # with energy_units(world.h_units): en = world.senergy m1 = Molecule([0.0, en], "mol1") m2 = Molecule([0.0, en], "mol2") agg = Aggregate(name="Homodimer") agg.add_Molecule(m1) agg.add_Molecule(m2) with energy_units(world.r_units): agg.set_resonance_coupling(0,1,world.r_coupl) agg.build() world.HH = agg.get_Hamiltonian()
def redfield_tensor(self): print("Redfield tensor calculation") # # Correlation function # params = { "ftype": world.ctype, "reorg": world.reorg, "cortime": world.ctime, "T": world.temp, "matsubara": world.mats } # FIXME: also time_units, temperature_units with energy_units(world.e_units): cf = CorrelationFunction(world.ta, params) # # Homodimer # with energy_units(world.h_units): en = world.senergy m1 = Molecule("mol1", [0.0, en]) m2 = Molecule("mol2", [0.0, en]) m1.set_egcf((0, 1), cf) m2.set_egcf((0, 1), cf) agg = Aggregate("Homodimer") agg.add_Molecule(m1) agg.add_Molecule(m2) # m = Manager() ## # with energy_units("1/cm"): # Hm = m1.get_Hamiltonian() # print(Hm) # print(m.convert_energy_2_current_u(Hm._data)) with energy_units(world.r_units): agg.set_resonance_coupling(0, 1, world.r_coupl) agg.build() H = agg.get_Hamiltonian() world.HH = H ## # with energy_units("1/cm"): # print(H) # print(m.convert_energy_2_current_u(H._data)) sbi = agg.get_SystemBathInteraction() H.protect_basis() with eigenbasis_of(H): RRT = RedfieldRelaxationTensor(H, sbi) dim = H.dim rates_T = numpy.zeros(dim * dim) k = 0 world.K12 = numpy.real(RRT.data[1, 1, 2, 2]) for i in range(dim): for j in range(dim): rates_T[k] = numpy.real(RRT.data[i, i, j, j]) k += 1 world.rates_T = rates_T
# -*- coding: utf-8 -*- _show_plots_ = False from quantarhei import Molecule, Aggregate #from quantarhei import energy_units en = [0.0, 1.0] m1 = Molecule(name="Mol1", elenergies=en) m2 = Molecule(name="Mol2", elenergies=en) ag = Aggregate(name="Homodimer") ag.add_Molecule(m1) ag.add_Molecule(m2) ag.set_resonance_coupling(0, 1, 0.1) ag.build(mult=1) H = ag.get_Hamiltonian() #with energy_units("1/cm"): # print(H)
plt.plot(time.data, sm) plt.axis([0.0, 100.0, 0.0, 1.1]) plt.show() # # Molecular dimer without vibrations # from quantarhei import Aggregate mol1 = Molecule("Mol 1", [0.0, 1.0]) mol2 = Molecule("Mol 2", [0.0, 1.0]) agg = Aggregate("Dimer") agg.add_Molecule(mol1) agg.add_Molecule(mol2) agg.set_resonance_coupling(0, 1, 0.01) agg.build() H = agg.get_Hamiltonian() print(H) psi = StateVector(3) psi.data[2] = 1.0 dimer_propagator = StateVectorPropagator(time, H) psi_t = dimer_propagator.propagate(psi) psi_t.plot(ptype="square", show=False)
def redfield_relaxation(self): print("Redfield rate calculation") # # Correlation function # params = { "ftype": world.ctype, "reorg": world.reorg, "cortime": world.ctime, "T": world.temp, "matsubara": world.mats } # FIXME: also time_units, temperature_units with energy_units(world.e_units): cf = CorrelationFunction(world.ta, params) # # Homodimer # with energy_units(world.h_units): en = world.senergy m1 = Molecule([0.0, en], "mol1") m2 = Molecule([0.0, en], "mol2") # m3 = Molecule("mol2", [0.0, en]) m1.set_egcf((0, 1), cf) m2.set_egcf((0, 1), cf) # m3.set_egcf((0,1), cf) agg = Aggregate(name="Homodimer") agg.add_Molecule(m1) agg.add_Molecule(m2) # agg.add_Molecule(m3) # with energy_units("1/cm"): # Hm = m1.get_Hamiltonian() # print(Hm) # print(m.convert_energy_2_current_u(Hm._data)) with energy_units(world.r_units): agg.set_resonance_coupling(0, 1, world.r_coupl) # agg.set_resonance_coupling(1,2,world.r_coupl) agg.build() H = agg.get_Hamiltonian() # with energy_units("1/cm"): # print(H) # print(m.convert_energy_2_current_u(H._data)) sbi = agg.get_SystemBathInteraction() RRM = RedfieldRateMatrix(H, sbi) world.K12 = numpy.real(RRM.data[1, 2]) dim = H.dim rates_M = numpy.zeros(dim * dim) k = 0 for i in range(dim): for j in range(dim): rates_M[k] = RRM.data[i, j] k += 1 world.rates_M = rates_M
plt.plot(time.data, sm) plt.axis([0.0,100.0, 0.0, 1.1]) plt.show() # # Molecular dimer without vibrations # from quantarhei import Aggregate mol1 = Molecule(name="Mol 1", elenergies=[0.0, 1.0]) mol2 = Molecule(name="Mol 2", elenergies=[0.0, 1.0]) agg = Aggregate(name="Dimer") agg.add_Molecule(mol1) agg.add_Molecule(mol2) agg.set_resonance_coupling(0,1,0.01) agg.build() H = agg.get_Hamiltonian() print(H) psi = StateVector(3) psi.data[2] = 1.0 dimer_propagator = StateVectorPropagator(time, H) psi_t = dimer_propagator.propagate(psi) psi_t.plot(ptype="square", show=False)
en = [0.0, 1.0] m1 = Molecule("Mol1",en) m2 = Molecule("Mol2",en) m3 = Molecule("Mol3",en) m1.set_dipole(0,1,[1.0, 0.0, 0.0]) time = TimeAxis(0.0, 1000, 1.0) bath_params = dict(ftype="OverdampedBrownian", T=300, cortime=100, reorg=30.0) with energy_units("1/cm"): cf = CorrelationFunction(time, bath_params) m1.set_transition_environment((0,1),cf) m2.set_transition_environment((0,1),cf) m3.set_transition_environment((0,1),cf) ag = Aggregate("Homodimer") ag.add_Molecule(m1) ag.add_Molecule(m2) ag.add_Molecule(m3) ag.set_resonance_coupling(0,1,0.1) mult = 2 ag.build(mult=mult,sbi_for_higher_ex=False) # # Look at its various components # H = ag.get_Hamiltonian()
m7.set_transition_environment((0,1),cfce1) m8.set_transition_environment((0,1),cfce1) m9.set_transition_environment((0,1),cfce2) m10.set_transition_environment((0,1),cfce2) m11.set_transition_environment((0,1),cfce2) m12.set_transition_environment((0,1),cfce1) # create an aggregate AG = Aggregate("TestAggregate") if explicit_mapping: AG.set_egcf_matrix(cm) # fill the cluster with monomers AG.add_Molecule(m1) AG.add_Molecule(m2) AG.add_Molecule(m3) AG.add_Molecule(m4) AG.add_Molecule(m5) AG.add_Molecule(m6) AG.add_Molecule(m7) AG.add_Molecule(m8) AG.add_Molecule(m9) AG.add_Molecule(m10) AG.add_Molecule(m11) AG.add_Molecule(m12) print(AG._has_egcf_matrix) print(AG._has_system_bath_interaction)
def redfield_relaxation(self): print("Redfield rate calculation") # # Correlation function # params = {"ftype": world.ctype, "reorg": world.reorg, "cortime": world.ctime, "T": world.temp, "matsubara":world.mats} # FIXME: also time_units, temperature_units with energy_units(world.e_units): cf = CorrelationFunction(world.ta,params) # # Homodimer # with energy_units(world.h_units): en = world.senergy m1 = Molecule([0.0, en],"mol1") m2 = Molecule([0.0, en], "mol2") # m3 = Molecule("mol2", [0.0, en]) m1.set_egcf((0,1), cf) m2.set_egcf((0,1), cf) # m3.set_egcf((0,1), cf) agg = Aggregate(name="Homodimer") agg.add_Molecule(m1) agg.add_Molecule(m2) # agg.add_Molecule(m3) # with energy_units("1/cm"): # Hm = m1.get_Hamiltonian() # print(Hm) # print(m.convert_energy_2_current_u(Hm._data)) with energy_units(world.r_units): agg.set_resonance_coupling(0,1,world.r_coupl) # agg.set_resonance_coupling(1,2,world.r_coupl) agg.build() H = agg.get_Hamiltonian() # with energy_units("1/cm"): # print(H) # print(m.convert_energy_2_current_u(H._data)) sbi = agg.get_SystemBathInteraction() RRM = RedfieldRateMatrix(H, sbi) world.K12 = numpy.real(RRM.data[1,2]) dim = H.dim rates_M = numpy.zeros(dim*dim) k = 0 for i in range(dim): for j in range(dim): rates_M[k] = RRM.data[i,j] k += 1 world.rates_M = rates_M
def get_Aggregate(self, name="dimer-1"): if name == "dimer-1": agg = Aggregate(name=name) elif name == "trimer-1": agg = Aggregate(name=name) with energy_units("1/cm"): m1 = Molecule("Mol 1", [0.0, 10100.0]) m2 = Molecule("Mol 2", [0.0, 10050.0]) m3 = Molecule("Mol 3", [0.0, 10000.0]) m1.position = [0.0, 0.0, 0.0] m2.position = [15.0, 0.0, 0.0] m3.position = [10.0, 10.0, 0.0] m1.set_dipole(0, 1, [5.8, 0.0, 0.0]) m2.set_dipole(0, 1, [5.8, 0.0, 0.0]) m3.set_dipole(0, 1, [numpy.sqrt(12.0), 0.0, 0.0]) agg.add_Molecule(m1) agg.add_Molecule(m2) agg.add_Molecule(m3) self.molecules = [m1, m2, m3] # m4 = Molecule("Mol 4", [0.0, 11000.0]) # m5 = Molecule("Mol 5", [0.0, 11000.0]) # m4.position = [15.0, 15.0, 0.0] # m5.position = [15.0, 10.0, 0.0] # m4.set_dipole(0,1,[5.8, 0.0, 0.0]) # m5.set_dipole(0,1,[5.8, 0.0, 0.0]) # agg.add_Molecule(m4) # agg.add_Molecule(m5) agg.set_coupling_by_dipole_dipole() elif name == "pentamer-1": agg = Aggregate(name=name) with energy_units("1/cm"): m1 = Molecule("Mol 1", [0.0, 10100.0]) m2 = Molecule("Mol 2", [0.0, 10050.0]) m3 = Molecule("Mol 3", [0.0, 10000.0]) m4 = Molecule("Mol 4", [0.0, 10200.0]) m5 = Molecule("Mol 5", [0.0, 10070.0]) m1.position = [0.0, 0.0, 0.0] m2.position = [15.0, 0.0, 0.0] m3.position = [10.0, 10.0, 0.0] m4.position = [15.0, 15.0, 0.0] m5.position = [0, 10.0, 10.0] m1.set_dipole(0, 1, [5.8, 0.0, 0.0]) m2.set_dipole(0, 1, [5.8, 0.0, 0.0]) m3.set_dipole(0, 1, [numpy.sqrt(12.0), 0.0, 0.0]) m4.set_dipole(0, 1, [5.8, 0.0, 0.0]) m5.set_dipole(0, 1, [5.8, 0.0, 0.0]) agg.add_Molecule(m1) agg.add_Molecule(m2) agg.add_Molecule(m3) agg.add_Molecule(m4) agg.add_Molecule(m5) self.molecules = [m1, m2, m3, m4, m5] agg.set_coupling_by_dipole_dipole() else: raise Exception("Unknown model name %s" % name) return agg
def redfield_tensor(self): print("Redfield tensor calculation") # # Correlation function # params = {"ftype": world.ctype, "reorg": world.reorg, "cortime": world.ctime, "T": world.temp, "matsubara":world.mats} # FIXME: also time_units, temperature_units with energy_units(world.e_units): cf = CorrelationFunction(world.ta,params) # # Homodimer # with energy_units(world.h_units): en = world.senergy m1 = Molecule([0.0, en], "mol1") m2 = Molecule([0.0, en], "mol2") m1.set_egcf((0,1), cf) m2.set_egcf((0,1), cf) agg = Aggregate(name="Homodimer") agg.add_Molecule(m1) agg.add_Molecule(m2) # m = Manager() ## # with energy_units("1/cm"): # Hm = m1.get_Hamiltonian() # print(Hm) # print(m.convert_energy_2_current_u(Hm._data)) with energy_units(world.r_units): agg.set_resonance_coupling(0,1,world.r_coupl) agg.build() H = agg.get_Hamiltonian() world.HH = H ## # with energy_units("1/cm"): # print(H) # print(m.convert_energy_2_current_u(H._data)) sbi = agg.get_SystemBathInteraction() H.protect_basis() with eigenbasis_of(H): RRT = RedfieldRelaxationTensor(H, sbi) dim = H.dim rates_T = numpy.zeros(dim*dim) k = 0 world.K12 = numpy.real(RRT.data[1,1,2,2]) for i in range(dim): for j in range(dim): rates_T[k] = numpy.real(RRT.data[i,i,j,j]) k += 1 world.rates_T = rates_T