예제 #1
0
    def setUp(self):

        en = [0.0, 1.0]
        self.m = Molecule(name="Molecule", elenergies=en)

        mod1 = Mode(frequency=0.1)
        self.m.add_Mode(mod1)
        mod1.set_nmax(0, 3)
        mod1.set_nmax(1, 3)

        en2 = [0.0, 0.1, 0.1]
        self.m2 = Molecule(name="AdMolecule", elenergies=en2)
        self.m2.set_adiabatic_coupling(1, 2, 0.02)
        mod2 = Mode(frequency=0.01)
        self.m2.add_Mode(mod2)
        mod2.set_nmax(0, 3)
        mod2.set_nmax(1, 3)
        mod2.set_nmax(2, 3)
예제 #2
0
    def setUp(self, verbose=False):

        self.verbose = verbose

        #
        # PURE ELECTRONIC AGGREGATE
        #

        m1 = Molecule([0.0, 1.0])
        m2 = Molecule([0.0, 1.0])

        agg = Aggregate(molecules=[m1, m2])

        agg.set_resonance_coupling(0, 1, 0.1)

        agg.build()

        self.ham = agg.get_Hamiltonian()

        KK12 = ProjectionOperator(1, 2, dim=self.ham.dim)
        KK21 = ProjectionOperator(2, 1, dim=self.ham.dim)

        self.rates = (1.0 / 100.0, 1.0 / 200.0)

        self.sbi = SystemBathInteraction([KK12, KK21], rates=self.rates)
        self.sbi.set_system(agg)

        #
        #  VIBRONIC AGGREGATE
        #

        vm1 = Molecule([0.0, 1.0])
        vm2 = Molecule([0.0, 1.0])
        mod1 = Mode(0.01)
        mod2 = Mode(0.01)
        vm1.add_Mode(mod1)
        vm2.add_Mode(mod2)

        mod1.set_nmax(0, 3)
        mod1.set_nmax(1, 3)

        mod2.set_nmax(0, 3)
        mod2.set_nmax(1, 3)

        vagg = Aggregate(molecules=[vm1, vm2])
        vagg.set_resonance_coupling(0, 1, 0.1)

        vagg.build()

        self.vham = vagg.get_Hamiltonian()

        self.vsbi = SystemBathInteraction([KK12, KK21], rates=self.rates)
        self.vsbi.set_system(vagg)
예제 #3
0
    def setUp(self):

        m1 = Molecule(name="Molecule 1", elenergies=[0.0, 1.0])
        m2 = Molecule(name="Molecule 2", elenergies=[0.0, 1.0])

        time = TimeAxis(0.0, 1000, 1.0)
        params = dict(ftype="OverdampedBrownian", reorg=20, cortime=100, T=300)
        with energy_units("1/cm"):
            fc = CorrelationFunction(time, params)

        m1.set_transition_environment((0, 1), fc)
        m1.position = [0.0, 0.0, 0.0]
        m1.set_dipole(0, 1, [10.0, 0.0, 0.0])
        m2.set_transition_environment((0, 1), fc)
        m2.position = [10.0, 0.0, 0.0]
        m2.set_dipole(0, 1, [10.0, 0.0, 0.0])

        self.agg = Aggregate(name="TestAgg", molecules=[m1, m2])

        self.agg.set_coupling_by_dipole_dipole()

        self.agg.build()

        m3 = Molecule(name="Molecule 1", elenergies=[0.0, 1.0])
        m4 = Molecule(name="Molecule 2", elenergies=[0.0, 1.0])
        m3.add_Mode(Mode(0.01))
        m4.add_Mode(Mode(0.01))

        mod3 = m3.get_Mode(0)
        mod4 = m4.get_Mode(0)

        mod3.set_nmax(0, 4)
        mod3.set_nmax(1, 4)
        mod3.set_HR(1, 0.1)
        mod4.set_nmax(0, 4)
        mod4.set_nmax(1, 4)
        mod4.set_HR(1, 0.3)

        self.vagg = Aggregate(molecules=[m3, m4])
        self.vagg.build()
예제 #4
0
def build_aggregate_2(settings):
    """Example function for building aggregate no. 2"""
    mol_l = []
    mod_l = []

    with qr.energy_units("1/cm"):
        for ind in range(settings["Nmol"]):
            mol = Molecule([0.0, settings["E1"]])
            # mol1.set_dipole(0,1,[1.0, 0.0, 0.0])
            # mol1.set_transition_width((0,1), width)

            mod = Mode(settings["omega"])
            mol.add_Mode(mod)
            mod.set_nmax(0, settings["Nvib_0"])
            mod.set_nmax(1, settings["Nvib_1"])
            mod.set_HR(1, settings["HR"])
            mol_l.append(mol)
            mod_l.append(mod)

    agg = Aggregate(molecules=mol_l)
    for ind in range(settings["Nmol"] - 1):
        agg.set_resonance_coupling(ind, ind + 1, settings["JJ"])
    # agg.set_resonance_coupling(settings["Nmol"]-1, 0, settings["JJ"])

    agg.build(mult=1)

    return agg
예제 #5
0
    def setUp(self):
        
        en = [0.0, 1.0]
        self.m = Molecule(name="Molecule",elenergies=en)

        mod1 = Mode(frequency=0.1)
        self.m.add_Mode(mod1)
        mod1.set_nmax(0,3)
        mod1.set_nmax(1,3)
    
        en2 = [0.0,0.1,0.1]
        self.m2 = Molecule(name="AdMolecule",elenergies=en2)    
        self.m2.set_adiabatic_coupling(1,2,0.02)
        mod2 = Mode(frequency=0.01)
        self.m2.add_Mode(mod2)
        mod2.set_nmax(0,3)
        mod2.set_nmax(1,3)
        mod2.set_nmax(2,3)
예제 #6
0
    def setUp(self,verbose=False):
        
        self.verbose = verbose
        
        #
        # PURE ELECTRONIC AGGREGATE
        #
    
        m1 = Molecule([0.0, 1.0])
        m2 = Molecule([0.0, 1.0])
        
        agg = Aggregate(molecules=[m1, m2])
        
        agg.set_resonance_coupling(0,1, 0.1)
        
        agg.build()
        
        self.ham = agg.get_Hamiltonian()
                
        KK12 = ProjectionOperator(1, 2, dim=self.ham.dim)
        KK21 = ProjectionOperator(2, 1, dim=self.ham.dim)
        
        self.rates = (1.0/100.0, 1.0/200.0)
        
        self.sbi = SystemBathInteraction([KK12,KK21],
                                          rates=self.rates)
        self.sbi.set_system(agg)

        #
        #  VIBRONIC AGGREGATE
        #
        
        vm1 = Molecule([0.0, 1.0])
        vm2 = Molecule([0.0, 1.0])
        mod1 = Mode(0.01)
        mod2 = Mode(0.01)
        vm1.add_Mode(mod1)
        vm2.add_Mode(mod2)
                
        mod1.set_nmax(0, 3)
        mod1.set_nmax(1, 3)
        
        mod2.set_nmax(0, 3)
        mod2.set_nmax(1, 3)
        
        vagg = Aggregate(molecules=[vm1, vm2])
        vagg.set_resonance_coupling(0, 1, 0.1)
        
        vagg.build()
        
        self.vham = vagg.get_Hamiltonian()
        
        self.vsbi = SystemBathInteraction([KK12, KK21], rates=self.rates)
        self.vsbi.set_system(vagg)       
예제 #7
0
def build_testing_aggregate():
    """Testing aggregate for unit tests."""
    # Number of molecules
    Nmol = 2
    # energy of molecule one
    E1 = 12500.0
    # energy gap to molecule two
    Edelta = 100.0
    # coupling between the two molecules
    JJ = 30.0
    # frequency of the vibrational mode
    omega = 110.0
    # Huan-Rhys factor
    HR = 0.01
    # transition width
    width = 80
    # max nvib states
    Nvib_0 = 3
    Nvib_1 = 3

    mol_l = []
    mod_l = []

    with qr.energy_units("1/cm"):
        for ind in range(Nmol):
            mol = Molecule([0.0, E1])
            mol.set_dipole(0, 1, [1.0, 0.0, 0.0])
            mol.set_transition_width((0, 1), width)

            mod = Mode(omega)
            mol.add_Mode(mod)
            mod.set_nmax(0, Nvib_0)
            mod.set_nmax(1, Nvib_1)
            mod.set_HR(1, HR)
            mol_l.append(mol)
            mod_l.append(mod)

    agg = Aggregate(molecules=mol_l)
    for ind in range(Nmol - 1):
        agg.set_resonance_coupling(ind, ind + 1, JJ)
    agg.set_resonance_coupling(Nmol - 1, 0, JJ)

    agg.build(mult=1)

    return agg
예제 #8
0
LFa.convert_2_tensor()

print(LFa.data[1, 1, 2, 2])
print(LFa.data[1, 2, 1, 2])

#
# VIBRONIC Aggregate of two molecules
#

m1v = Molecule([0.0, 1.0])
m2v = Molecule([0.0, 1.1])
m3v = Molecule([0.0, 1.2])

from quantarhei import Mode

mod1 = Mode(0.01)
mod2 = Mode(0.01)
mod3 = Mode(0.01)

Nvib = 2

m1v.add_Mode(mod1)
mod1.set_nmax(0, Nvib)
mod1.set_nmax(1, Nvib)
mod1.set_HR(1, 0.3)

m2v.add_Mode(mod2)
mod2.set_nmax(0, Nvib)
mod2.set_nmax(1, Nvib)
mod2.set_HR(1, 0.3)
예제 #9
0
#    EXAMPLE 2.2                                                              #
#                                                                             #
###############################################################################
""")
#
# The same Hamiltonian using the Molecule class
#

from quantarhei import Molecule

m = Molecule("Mol 1", [0.0, 1.0])
m.set_adiabatic_coupling(0, 1, 0.4)

from quantarhei import Mode

vib1 = Mode(frequency=0.01)
m.add_Mode(vib1)

vib1.set_shift(1, 0.5)
vib1.set_nmax(0, 5)
vib1.set_nmax(1, 5)

Hm = m.get_Hamiltonian()
print(Hm)
print(m)

psi_vib = StateVector(10)
psi_vib.data[3] = 1.0

prop_vib = StateVectorPropagator(time, Hm)
예제 #10
0
#    EXAMPLE 2.2                                                              #
#                                                                             #
###############################################################################
""")
#
# The same Hamiltonian using the Molecule class
#

from quantarhei import Molecule

m = Molecule(name="Mol 1", elenergies=[0.0, 1.0])
m.set_adiabatic_coupling(0,1,0.4)

from quantarhei import Mode

vib1 = Mode(frequency=0.01)
m.add_Mode(vib1)

vib1.set_shift(1, 0.5)
vib1.set_nmax(0, 5)
vib1.set_nmax(1, 5)


Hm = m.get_Hamiltonian()
print(Hm)
print(m)

psi_vib = StateVector(10)
psi_vib.data[3] = 1.0

prop_vib = StateVectorPropagator(time, Hm)
예제 #11
0
    # is created
    en = [0.0, 14500, 15500]
    m = Molecule("RC-P",en)    

    # Transition dipole moment from 0 -> 2 (exciton state) is set to 
    # a unit vector in the direction of x-axis (this choice is arbitrary)
    di = numpy.sqrt(23.0)*0.20819434
    m.set_dipole(0,2,[di,0.0,0.0])
    
    #
    # To represent CT coordinate, we add an explicite harmonic mode 
    # to the molecule.
    #
    
    # First the mode with frequency 10 1/cm is created
    qct = Mode(frequency=10.0)
    # and registered with the molecule
    m.add_Mode(qct)
    
    # In the CT state, the equilibrium coordinate is shifted towards
    # charge separation. In the ground state and the exciton, no shift
    # of the coordinate is assumed (see the text (!!!!) for justification.)
    qct.set_shift(1,1.0)
    
    # By default, the Mode we created is harmonic. The number of states
    # by which it is represented is set to 2 (which is a very small number).
    # Let us increase the number of states to represent the oscillators
    # in the three electronic states of the molecule to some chosen N[0], N[1]
    # and N[2] (see the text (!!!!) for the choice of values).
    #
    # we create an array of 3 zeros
예제 #12
0
    def test_saving_of_molecule(self):
        """Testing the saving capability of the Molecule class
        
        
        """
        use_temporary_file = True

        with energy_units("1/cm"):
            mod = Mode(frequency=150)
            mod1 = Mode(frequency=100)

        m2 = Molecule(elenergies=[0.0, 2.0])
        m2.add_Mode(mod)
        m2.add_Mode(mod1)

        if use_temporary_file:

            #drv = "core"
            #bcs = False

            #with h5py.File('tempfile.hdf5',
            #               driver=drv,
            #               backing_store=bcs) as f:
            with tempfile.TemporaryFile() as f:

                #self.m.save_as(f,"Molecule")
                self.m.save(f, test=True)

                # reread it
                m = Molecule()
                #m.load_as(f,"Molecule")
                m = m.load(f, test=True)

        else:

            #with h5py.File('tempfile.hdf5') as f:
            with open('tempfile.qrp', 'wb') as f:
                #self.m.save_as(f,"Molecules")
                self.m.save(f)

            #with h5py.File('tempfile.hdf5') as f:
            with open('tempfile.qrp', 'rb') as f:
                m = Molecule()
                #m.load_as(f,"Molecules")
                m = m.load(f)

        self.assertEqual(self.m.name, m.name)
        self.assertEqual(self.m.nel, m.nel)
        numpy.testing.assert_array_equal(self.m.elenergies, m.elenergies)

        numpy.testing.assert_array_equal(
            self.m.get_transition_environment((0, 1)).data, self.fc.data)

        #with h5py.File('tempfile.hdf5',
        #               driver=drv,
        #               backing_store=bcs) as f:
        with tempfile.TemporaryFile() as f:

            #self.m.save_as(f,"Molecule")
            m2.save(f, test=True)

            # reread it
            m3 = Molecule()
            #m.load_as(f,"Molecule")
            m3 = m3.load(f, test=True)

        self.assertEqual(m2.name, m3.name)
        self.assertEqual(m2.nel, m3.nel)
        numpy.testing.assert_array_equal(m2.elenergies, m3.elenergies)

        self.assertEqual(m2.get_Mode(0).get_energy(0), mod.get_energy(0))
        self.assertEqual(m2.get_Mode(1).get_energy(0), mod1.get_energy(0))
예제 #13
0
print(LFa.data[1,1,2,2])
print(LFa.data[1,2,1,2])


#
# VIBRONIC Aggregate of two molecules
#

m1v = Molecule([0.0, 1.0])
m2v = Molecule([0.0, 1.1])
m3v = Molecule([0.0, 1.2])

from quantarhei import Mode

mod1 = Mode(0.01)
mod2 = Mode(0.01)
mod3 = Mode(0.01)

Nvib = 2

m1v.add_Mode(mod1)
mod1.set_nmax(0, Nvib)
mod1.set_nmax(1, Nvib)
mod1.set_HR(1, 0.3)

m2v.add_Mode(mod2)
mod2.set_nmax(0, Nvib)
mod2.set_nmax(1, Nvib)
mod2.set_HR(1, 0.3)
예제 #14
0
    def test_saving_of_molecule(self):
        """Testing the saving capability of the Molecule class
        
        
        """
        use_temporary_file = True
        
        with energy_units("1/cm"):
            mod = Mode(frequency=150)
            mod1 = Mode(frequency=100)
            
        m2 = Molecule(elenergies=[0.0, 2.0])
        m2.add_Mode(mod)
        m2.add_Mode(mod1)

        
        if use_temporary_file: 
            
            #drv = "core"
            #bcs = False
        
            #with h5py.File('tempfile.hdf5', 
            #               driver=drv, 
            #               backing_store=bcs) as f:
            with tempfile.TemporaryFile() as f:
                                             
                #self.m.save_as(f,"Molecule")
                self.m.save(f, test=True)
                
                # reread it
                m = Molecule()
                #m.load_as(f,"Molecule")
                m = m.load(f, test=True)

        else:

            #with h5py.File('tempfile.hdf5') as f: 
            with open('tempfile.qrp', 'wb') as f:                                          
                #self.m.save_as(f,"Molecules")
                self.m.save(f)
            
            #with h5py.File('tempfile.hdf5') as f:
            with open('tempfile.qrp', 'rb') as f:
                m = Molecule()
                #m.load_as(f,"Molecules")
                m = m.load(f)
            

        self.assertEqual(self.m.name, m.name)
        self.assertEqual(self.m.nel, m.nel)
        numpy.testing.assert_array_equal(self.m.elenergies, m.elenergies)
        
        numpy.testing.assert_array_equal(
                self.m.get_transition_environment((0,1)).data, self.fc.data)
        
        #with h5py.File('tempfile.hdf5', 
        #               driver=drv, 
        #               backing_store=bcs) as f:
        with tempfile.TemporaryFile() as f:
                                         
            #self.m.save_as(f,"Molecule")
            m2.save(f, test=True)
            
            # reread it
            m3 = Molecule()
            #m.load_as(f,"Molecule")
            m3 = m3.load(f, test=True)

        self.assertEqual(m2.name, m3.name)
        self.assertEqual(m2.nel, m3.nel)
        numpy.testing.assert_array_equal(m2.elenergies, m3.elenergies)
        
        self.assertEqual(m2.get_Mode(0).get_energy(0), mod.get_energy(0))
        self.assertEqual(m2.get_Mode(1).get_energy(0), mod1.get_energy(0))