Example of TPA adsorption script : Tensor Renormalization Group (TRG)

Download test_trg_TPA.py and TPA.7z

from math import sqrt
from susmost import *

lt = load_lattice_task('models/TPA')
lt = joined_cells_lattice_task(lt, 3)   # for long-range interactions use 3x3
# surface suprecell per single lattice site

k_B = 0.0083            # Boltzmann constant kJ/K
mu = 18.0                       # adsoprtion energy, kJ
T = 300                         # temperature, K
max_count = 32          # number of singular values to keep in TRG algorithm

def calc_lnZ(mu, beta):
        '''
                Compute logarithm of partition function per surface unit cell
                Parameters:
                        :mu: adsoprtion energy for TPA adsoprtion complex
                        :beta: thermodynamic beta
        '''
        lt.set_ads_energy('TPA', mu)
        W = make_tensor(lt, beta)  # create tensor network model representation
        lnZ = solve_TRG(W, max_count=max_count)  # logarithm of partition function per lattice site
        lnZ /= 9  # get logarithm of partition function per surface unit cell dividing by supercell size
        return lnZ

'''
Compute density via numeric differentiation of free energy by adsorption energy
'''

dmu = 0.1
beta = 1./(k_B * T)
lnZ1 = calc_lnZ(mu, beta)
lnZ2 = calc_lnZ(mu+dmu, beta)
dG = (lnZ1 - lnZ2)/beta
rho = dG/dmu
print ("Monolayer density", rho)