예제 #1
0
파일: util.py 프로젝트: pastewka/hotbit
def IP_EA(symb, remove_orb, add_orb, remove, add, add_args={}):
    """ Return ionization potential and electron affinity for given atom,
        and the valence energies of neutral atom.
    
    parameters: 
    -----------
    symb: element symbol
    remove_orb: orbital from where to remove atoms (e.g. '2p')
    add_orb: orbital from where to add atoms (e.g. '2p')
    remove: how many electrons to remove
    add: how many electrons to add
         (remove and add can be different from 1.0 if DFT should not
         be stable to e.g. adding one full electron)
         
    Fit second order curve for 3 points and return IP and EA for full
    electron adding and removal.             
    """
    #from box.data import atom_occupations
    atom = KSAllElectron(symb, txt='-', **add_args)

    # add electrons -> negative ion
    #occu=atom_occupations[symb].copy()
    w = 'negative.atom'
    occu_add = atom.occu.copy()
    occu_add[add_orb] += add
    ea = KSAllElectron(symb,
                       configuration=occu_add,
                       restart=w,
                       write=w,
                       **add_args)
    ea.run()

    # neutral atom
    w = 'neutral.atom'
    neutral = KSAllElectron(symb, restart=w, write=w, **add_args)
    neutral.run()
    valence_energies = neutral.get_valence_energies()

    # remove electrons -> positive ion
    #occu=atom_occupations[symb].copy()
    w = 'positive.atom'
    occu_remove = atom.occu.copy()
    occu_remove[remove_orb] -= remove
    ip = KSAllElectron(symb,
                       configuration=occu_remove,
                       restart=w,
                       write=w,
                       **add_args)
    ip.run()

    e0 = neutral.get_energy()
    en = ea.get_energy() - e0
    ep = ip.get_energy() - e0
    # e(x)=e0+c1*x+c2*x**2 =energy as a function of additional electrons
    c2 = (en + ep * add / remove) / (add * (remove + add))
    c1 = (c2 * remove**2 - ep) / remove
    IP = -c1 + c2
    EA = -(c1 + c2)
    return IP, EA, neutral
예제 #2
0
파일: util.py 프로젝트: molguin-qc/hotbit
def IP_EA(symb,remove_orb,add_orb,remove,add,add_args={}):
    """ Return ionization potential and electron affinity for given atom,
        and the valence energies of neutral atom.
    
    parameters: 
    -----------
    symb: element symbol
    remove_orb: orbital from where to remove atoms (e.g. '2p')
    add_orb: orbital from where to add atoms (e.g. '2p')
    remove: how many electrons to remove
    add: how many electrons to add
         (remove and add can be different from 1.0 if DFT should not
         be stable to e.g. adding one full electron)
         
    Fit second order curve for 3 points and return IP and EA for full
    electron adding and removal.             
    """
    #from box.data import atom_occupations
    atom = KSAllElectron(symb, txt='-', **add_args)

    # add electrons -> negative ion
    #occu=atom_occupations[symb].copy()
    w = 'negative.atom'
    occu_add = atom.occu.copy()
    occu_add[add_orb] += add
    ea = KSAllElectron(symb, configuration=occu_add, restart=w, write=w,
                       **add_args)
    ea.run()

    # neutral atom
    w = 'neutral.atom'
    neutral = KSAllElectron(symb, restart=w, write=w, **add_args)
    neutral.run()
    valence_energies = neutral.get_valence_energies()

    # remove electrons -> positive ion
    #occu=atom_occupations[symb].copy()
    w = 'positive.atom'
    occu_remove = atom.occu.copy()
    occu_remove[remove_orb] -= remove
    ip = KSAllElectron(symb, configuration=occu_remove, restart=w, write=w,
                       **add_args)
    ip.run()

    e0 = neutral.get_energy()
    en = ea.get_energy()-e0
    ep = ip.get_energy()-e0
    # e(x)=e0+c1*x+c2*x**2 =energy as a function of additional electrons
    c2 = (en+ep*add/remove)/(add*(remove+add))
    c1 = (c2*remove**2-ep)/remove
    IP = -c1+c2
    EA = -(c1+c2)
    return IP, EA, neutral
예제 #3
0
파일: util.py 프로젝트: pastewka/hotbit
def electron_affinity(symb, add, electrons=1.0):
    """ Return electron affinity of given atom. 
    
    parameters: 
    -----------
    symb: element symbol
    add: orbital where electron is added (e.g. '2p')
    electrons: how many electrons are added. Can be fractional number
               if DFT should not be stable. EA is scaled by
               electrons^-1 in the end to extrapolate to electrons=1.
    """
    from box.data import atom_occupations
    occu = atom_occupations[symb].copy()
    # neutral atom
    atom = KSAllElectron(symb)
    atom.run()
    e0 = atom.get_energy()
    # positive ion
    occu[add] += electrons
    ion = KSAllElectron(symb, occu=occu)
    ion.run()
    e1 = ion.get_energy()
    return (e0 - e1) / electrons
예제 #4
0
파일: util.py 프로젝트: molguin-qc/hotbit
def electron_affinity(symb,add,electrons=1.0):
    """ Return electron affinity of given atom. 
    
    parameters: 
    -----------
    symb: element symbol
    add: orbital where electron is added (e.g. '2p')
    electrons: how many electrons are added. Can be fractional number
               if DFT should not be stable. EA is scaled by
               electrons^-1 in the end to extrapolate to electrons=1.
    """
    from box.data import atom_occupations
    occu=atom_occupations[symb].copy()
    # neutral atom
    atom=KSAllElectron(symb)
    atom.run()
    e0=atom.get_energy()
    # positive ion
    occu[add]+=electrons
    ion=KSAllElectron(symb,occu=occu)
    ion.run()
    e1=ion.get_energy()
    return (e0-e1)/electrons
예제 #5
0
파일: util.py 프로젝트: pastewka/hotbit
def ionization_potential(symb, remove, electrons=1.0):
    """ Return ionization potential of given atom. 
    
    parameters: 
    -----------
    symb: element symbol
    remove: orbital from where electron is removed (e.g. '2p')
    electrons: how many electrons to remove. Can be fractional number
               if DFT should not be stable. IP is scaled by
               electrons^-1 in the end to extrapolate to electrons=1.
    
    """
    from box.data import atom_occupations
    occu = atom_occupations[symb].copy()
    # neutral atom
    atom = KSAllElectron(symb)
    atom.run()
    e0 = atom.get_energy()
    # negative ion
    occu[remove] -= electrons
    ion = KSAllElectron(symb, occu=occu)
    ion.run()
    e1 = ion.get_energy()
    return (e1 - e0) / electrons
예제 #6
0
파일: util.py 프로젝트: molguin-qc/hotbit
def ionization_potential(symb,remove,electrons=1.0):
    """ Return ionization potential of given atom. 
    
    parameters: 
    -----------
    symb: element symbol
    remove: orbital from where electron is removed (e.g. '2p')
    electrons: how many electrons to remove. Can be fractional number
               if DFT should not be stable. IP is scaled by
               electrons^-1 in the end to extrapolate to electrons=1.
    
    """
    from box.data import atom_occupations
    occu=atom_occupations[symb].copy()
    # neutral atom
    atom=KSAllElectron(symb)
    atom.run()
    e0=atom.get_energy()
    # negative ion
    occu[remove]-=electrons
    ion=KSAllElectron(symb,occu=occu)
    ion.run()
    e1=ion.get_energy()
    return (e1-e0)/electrons