Example #1
0
    def __init__(self, InitJson):

        self.type = InitJson['proj']['type']
        self.logFile = InitJson['proj']['logFile']
        self.outFile = InitJson['proj']['outFile']
        self.nsys = int(InitJson['syst']['nsys'])
        self.nmod = int(InitJson['syst']['nmod'])
        self.npsd = int(InitJson['bath']['npsd'])
        self.iniSite = int(InitJson['prop']['iniSite'])
        self.nmax = int(InitJson['prop']['nmax'])
        self.lmax = int(InitJson['prop']['lmax'])
        self.tolr = float(InitJson['prop']['toler'])
        self.nstep = int(InitJson['prop']['nstep'])
        self.nchk = int(InitJson['prop']['nchk'])
        self.dt = float(InitJson['prop']['dt'])
        self.tem = float(InitJson['bath']['tem'])
        self.nper = self.npsd + 1
        if self.temUnit == 'K':
            self.tem *= kt2au
        elif self.temUnit == 'cm-1':
            self.tem *= cm2au
        self.nind = self.nmod * self.nper
        self.hams, self.qmds = syst.init()
        self.etal, self.etar, self.etaa, self.expn, self.wres = bath.init()
Example #2
0
    def __init__(self, InitJson):

        self.type = InitJson["proj"]["type"]
        self.logFile = InitJson["proj"]["logFile"]
        self.outFile = InitJson["proj"]["outFile"]
        self.nsys = int(InitJson["syst"]["nsys"])
        self.nmod = int(InitJson["syst"]["nmod"])
        self.npsd = int(InitJson["bath"]["npsd"])
        self.iniSite = int(InitJson["prop"]["iniSite"])
        self.nmax = int(InitJson["prop"]["nmax"])
        self.lmax = int(InitJson["prop"]["lmax"])
        self.tolr = float(InitJson["prop"]["toler"])
        self.nstep = int(InitJson["prop"]["nstep"])
        self.nchk = int(InitJson["prop"]["nchk"])
        self.dt = float(InitJson["prop"]["dt"])
        self.tem = float(InitJson["bath"]["tem"])
        self.nper = self.npsd + 1
        if self.temUnit == "K":
            self.tem *= kt2au
        elif self.temUnit == "cm-1":
            self.tem *= cm2au
        self.nind = self.nmod * self.nper
        self.hams, self.qmds = syst.init()
        self.etal, self.etar, self.etaa, self.expn, self.wres = bath.init()
Example #3
0
if __name__ == '__main__':

    with open('_default.json') as f:
        ini = json.load(f)

    # syst
    hams = np.zeros((2, 2), dtype=complex)
    hams[0, 0] = hams[0, 1] = hams[1, 0] = 1.0
    hams[1, 1] = -1.0
    qmds = np.zeros((1, 2, 2), dtype=complex)
    qmds[0, 0, 0] = 1.0
    qmds[0, 1, 1] = -1.0
    dips = np.zeros((2, 2), dtype=complex)
    syst.init(ini['syst'], hams, qmds, dips)

    # bath
    ini['bath']['temp'] = 1.0
    ini['bath']['jsdr'] = [{'lams': 1.0, 'omgs': 5.0, 'gams': 1.0}]
    ini['bath']['nmod'] = qmds.shape[0]
    ini['bath']['pade'] = 2
    ini['bath']['npsd'] = 1
    bath.init(ini['bath'])

    # hidx
    ini['hidx']['lmax'] = 15
    ini['hidx']['nmax'] = 30000
    ini['hidx']['ferr'] = 2.0e-6

    with open('input.json', 'w') as f:
        json.dump(ini, f, indent=4)
Example #4
0
def main ():

    with open('morse.json','r') as f:
        d = json.load(f)
    ie = d['ie']
    ne = ie+1
    modes = d['modes']
    gxy = d['gxy']
    for m in modes:
        m['m0'] *= am2au
        m['ri'] /= au2ar
        m['rf'] /= au2ar
        m['re'] /= au2ar
    vmn = [[v*cm2au for v in colv] for colv in gxy]

    n_list = np.array([m['nr'] for m in modes])
    ndim = np.prod(n_list)
    nmod = len(modes)
    cum_prod = np.zeros(nmod,dtype=int)
    cum_prod[0] = modes[nmod-1]['nr']
    for i in xrange(1,nmod):
        cum_prod[i] = cum_prod[i-1]*modes[nmod-i-1]['nr']

    with open('wavetrun.dat','r') as f:
        wavefunc=np.loadtxt(f)
    with open('energr.dat','r') as f:
        energies=np.loadtxt(f)

    qmod = []
    hami = []
    dipo = []
    dip2 = []
    for imod in xrange(nmod):
        m = modes[imod]
        q = np.empty(ndim,dtype=float)
        d = np.empty(ndim,dtype=float)
        d2= np.empty(ndim,dtype=float)
        for i in xrange(ndim):
            i_list = decode(i,cum_prod,nmod)
            d[i] = m['ri']+i_list[imod]*(m['rf']-m['ri'])/m['nr']
            d2[i]= (d[i]-m['re'])*(d[i]-m['re'])
            q[i] = m['q2']*(d[i]-m['re'])*(d[i]-m['re'])/2+m['q1']*(d[i]-m['re']) 
        qwave = np.array([[q[i]*wavefunc[i,j] for j in xrange(ne)] for i in xrange(ndim)])
        dwave = np.array([[d[i]*wavefunc[i,j] for j in xrange(ne)] for i in xrange(ndim)])
        d2wave= np.array([[d2[i]*wavefunc[i,j] for j in xrange(ne)] for i in xrange(ndim)])
        qmod.append(np.dot(wavefunc.T,qwave) )
        dipo.append(np.dot(wavefunc.T,dwave) )
        dip2.append(np.dot(wavefunc.T,d2wave))
#test new geninput
        ini={
    	"syst": {
    	    "hamsFile": "inp_hams.mat",
    	    "qmdsFile": "inp_qmds.mat",
    	    "dipsFile": "inp_dips.mat"
    	},
    	"bath": {
            "npsd": 1,
            "pade": 2,
            "temp": 300.0,
	    "modeFile": "inp_mode.mat",
    	    "etalFile": "inp_etal.mat",
    	    "etarFile": "inp_etar.mat",
    	    "etaaFile": "inp_etaa.mat",
    	    "expnFile": "inp_expn.mat",
    	    "bdipFile": "inp_bdip.mat",
    	    "delrFile": "inp_delr.mat"
        },
    	"hidx": {
    		"lmax": 5,
    		"nmax": 5000,
    		"ferr": 2.0e-7,
	    "expnFile": "inp_expn.mat"
    	}
    }

    qmds = np.array(qmod)*(1.0+0.0J)
    hams = np.diag(np.array(energies))*(1.0+0.0J)
    syst.init(ini['syst'],hams,qmds)
    mutot = np.empty(ne,dtype=float)
    pitot = np.empty(ne,dtype=float)
    qutot = np.empty(ne,dtype=float)
    for imod in xrange(nmod):
	    mutot=mutot+modes[imod]['d1']*dipo[imod]+modes[imod]['d2']*dip2[imod]

    # bath
    print ("temperature is K\n",ini['bath']['temp'])
    ini['bath']['temp'] *= kt2au
    ini['bath']['jomg'] = []
    for m in modes:
        lamd = m['jdru'][0]['lamd']*cm2au
        gamd = m['jdru'][0]['gamd']*cm2au
        drupara ={
                'jdru': [(lamd,gamd)],
                 }
        ini['bath']['jomg'].append(drupara)
    ini['bath']['amod'] = ['dru' for i in xrange(nmod)]
    ini['bath']['fmod'] = [0.0 for i in xrange(nmod)]
    ini['bath']['nmod'] = qmds.shape[0] 
    bath.init (ini['bath'])
    jsonInit = {"deom":ini,
    "rhot": {
        "dt": 0.005, 
        "nk": 10, 
        "nt": 2000, 
        "inistate": 0
    },
           }
    with open('input.json','w') as f:
        json.dump(jsonInit,f,indent=4) 
Example #5
0
if __name__ == '__main__':

    with open('_default.json') as f:
        ini = json.load(f)
    
    # syst
    hams = np.zeros((2,2),dtype=complex)
    hams[0,0] = hams[0,1] = hams[1,0] = 1.0
    hams[1,1] = -1.0
    qmds = np.zeros((1,2,2),dtype=complex)
    qmds[0,0,0] =  1.0
    qmds[0,1,1] = -1.0
    dips = np.zeros((2,2),dtype=complex)
    syst.init (ini['syst'],hams,qmds,dips)
   
    # bath
    ini['bath']['temp'] = 1.0
    ini['bath']['jsdr'] = [{'lams':1.0,'omgs':5.0,'gams':1.0}]
    ini['bath']['nmod'] = qmds.shape[0]
    ini['bath']['pade'] = 2
    ini['bath']['npsd'] = 1
    bath.init (ini['bath'])
    
    # hidx
    ini['hidx']['lmax'] = 15
    ini['hidx']['nmax'] = 30000
    ini['hidx']['ferr'] = 2.0e-6
    
    with open('input.json','w') as f:
        json.dump(ini,f,indent=4)