def test_fluor_calculator(self): """Testing some basic methods of the FluorSpectrumCalculator class """ #Calculations for monomer are already performed. Now testing that #fluorescence spectrum can be calculated for an aggregate. try: mol1 = Molecule(elenergies=[0.0, 12000.0]) mol2 = Molecule(elenergies=[0.0, 12000.0]) params = dict(ftype="OverdampedBrownian", reorg=20, cortime=100, T=300) mol1.set_dipole(0, 1, [0.0, 1.0, 0.0]) mol2.set_dipole(0, 1, [0.0, 1.0, 0.0]) cf = CorrelationFunction(self.ta, params) mol1.set_transition_environment((0, 1), cf) mol2.set_transition_environment((0, 1), cf) agg = Aggregate(name="tester_dim", molecules=[mol1, mol2]) agg.build() HH = agg.get_Hamiltonian() fluor_calc = FluorSpectrumCalculator(self.ta, system=agg, dynamics="secular", relaxation_tensor=None, rate_matrix=None, effective_hamiltonian=HH, temperature=300) fluor_calc.bootstrap(rwa=12000) fluor_calc = fluor_calc.calculate() except: raise Exception('Fluorescence not calculatable for aggregate')
# FIXME: temporary fix for version 0.0.34 # Manager().gen_conf.legacy_relaxation = True # # PURELY ELECTRONIC Aggregate of two molecules # from quantarhei import Molecule m1 = Molecule([0.0, 1.0]) m2 = Molecule([0.0, 1.1]) m3 = Molecule([0.0, 1.2]) from quantarhei import Aggregate agg = Aggregate([m1, m2, m3]) agg.build() # # Operator describing relaxation # from quantarhei.qm import Operator HH = agg.get_Hamiltonian() K = Operator(dim=HH.dim, real=True) K.data[1, 2] = 1.0 # # System bath interaction with prescribed rate # from quantarhei.qm import SystemBathInteraction
gamma=1.0 / 10000.0) with energy_units('1/cm'): cf2 = CorrelationFunction(tsbi, params2) cf.add_to_data(cf2) # # Set system-bath interaction # mol1.set_transition_environment((0, 1), cf) mol2.set_transition_environment((0, 1), cf) # # Creating aggregate # agg = Aggregate("Dimer", molecules=[mol1, mol2]) agg.set_coupling_by_dipole_dipole() with energy_units("1/cm"): print(agg.get_resonance_coupling(0, 1)) agg.build(mult=2) with energy_units("1/cm"): rwa_cm = agg.get_RWA_suggestion() rwa = agg.get_RWA_suggestion() # # Prepare for calculation of 2D spectra # # TimeAxis for t2 waiting time
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
tsbi = TimeAxis(0.0, 3 * Nr, 10.0) params = dict(ftype="OverdampedBrownian", T=300, reorg=30.0, cortime=50.0) with energy_units('1/cm'): cf = CorrelationFunction(tsbi, params) mol1.set_transition_environment((0, 1), cf) mol2.set_transition_environment((0, 1), cf) mol3.set_transition_environment((0, 1), cf) mol4.set_transition_environment((0, 1), cf) # # Creating aggregate # agg = Aggregate(molecules=molecules) #agg = Aggregate("Dimer", molecules=[mol1, mol2, mol3]) if True: with energy_units("1/cm"): agg.set_resonance_coupling(0, 1, 60.0) agg.set_resonance_coupling(1, 2, 60.0) agg.set_resonance_coupling(0, 2, 30.0) agg.set_resonance_coupling(1, 3, 30.0) pass #agg.set_coupling_by_dipole_dipole() agg.build(mult=2) with energy_units("1/cm"):
tsbi = TimeAxis(0.0, 3 * Nr, 2.0) params = dict(ftype="OverdampedBrownian", T=300, reorg=50.0, cortime=100.0) with energy_units('1/cm'): cf = CorrelationFunction(tsbi, params) mol1.set_transition_environment((0, 1), cf) mol2.set_transition_environment((0, 1), cf) mol3.set_transition_environment((0, 1), cf) mol4.set_transition_environment((0, 1), cf) # # Creating aggregate # agg = Aggregate("Dimer", molecules=[mol1, mol2, mol3, mol4]) #agg = Aggregate("Dimer", molecules=[mol1, mol2, mol3]) with energy_units("1/cm"): agg.set_resonance_coupling(0, 1, 60.0) agg.set_resonance_coupling(1, 2, 60.0) agg.set_resonance_coupling(0, 2, 30.0) agg.set_resonance_coupling(1, 3, 30.0) pass #agg.set_coupling_by_dipole_dipole() agg.build(mult=2) with energy_units("1/cm"): rwa_cm = agg.get_RWA_suggestion()
# -*- 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)
the we create electronic Lindblad form for a system with vibrational levels """ # # PURELY ELECTRONIC Aggregate of two molecules # from quantarhei import Molecule m1 = Molecule([0.0, 1.0]) m2 = Molecule([0.0, 1.1]) m3 = Molecule([0.0, 1.2]) from quantarhei import Aggregate agg = Aggregate([m1, m2, m3]) agg.build() # # Operator describing relaxation # from quantarhei.qm import Operator HH = agg.get_Hamiltonian() K = Operator(dim=HH.dim,real=True) K.data[1,2] = 1.0 # # System bath interaction with prescribed rate # from quantarhei.qm import SystemBathInteraction
# -*- coding: utf-8 -*- from quantarhei import Molecule, Aggregate from quantarhei import energy_units en = [0.0, 1.0] m1 = Molecule("Mol1", en) m2 = Molecule("Mol2", en) ag = Aggregate("Homodimer", maxband=1) ag.add_Molecule(m1) ag.add_Molecule(m2) ag.set_resonance_coupling(0, 1, 0.1) ag.build() H = ag.get_Hamiltonian() with energy_units("1/cm"): print(H)
import matplotlib.pyplot as plt 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)
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
"A377": "BChl7", "A378": "BChl8" } for name in names: for m in molecules: if m.name == name: m.set_name(naming_map[name]) # all except for 378 go into aggregate if name != "378": for_aggregate.append(m) # # Create an new aggregate of the Bacteriochlorophylls without BChl8 # agg = Aggregate(name="FMO", molecules=for_aggregate) # Setting site energies according to literature # with energy_units("1/cm"): m = agg.get_Molecule_by_name("BChl1") m.set_energy(1, 12468.0) m = agg.get_Molecule_by_name("BChl2") m.set_energy(1, 12466.0) m = agg.get_Molecule_by_name("BChl3") m.set_energy(1, 12129.0) m = agg.get_Molecule_by_name("BChl4") m.set_energy(1, 12410.0) m = agg.get_Molecule_by_name("BChl5") m.set_energy(1, 12320.0) m = agg.get_Molecule_by_name("BChl6")
m1.set_transition_environment((0,1),cfce2) m2.set_transition_environment((0,1),cfce1) m3.set_transition_environment((0,1),cfce1) m4.set_transition_environment((0,1),cfce2) m5.set_transition_environment((0,1),cfce1) m6.set_transition_environment((0,1),cfce2) 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)
# 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() print("Shape of the operators")
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