def aldLife(filename):
    dummy = np.loadtxt(filename, skiprows=1)

    kpt = dummy[:, 0:3]

    freq = dummy[:, 3] / (2.0 * np.pi) / ct.value("pico")

    # Quantum Values
    freqShiftQ = dummy[:, 4] / (2.0 * np.pi) / ct.value("pico")
    lifeQ = dummy[:, 5] * ct.value("pico")

    # Clasical Values
    freqShiftC = dummy[:, 6] / (2.0 * np.pi) / ct.value("pico")
    lifeC = dummy[:, 7] * ct.value("pico")

    vel = dummy[:, 8:11]

    return kpt, freq, freqShiftQ, lifeQ, freqShiftC, lifeC, vel
sys.path.append('/home/kevin/projects/ntpl/Codes') # Needed to recognize ntpy module
import ntpy.param.lj as lj
import ntpy.param.const as ct
import ntpy.gulp as gp

temps = [20, 50, 80]
strains = [-0.12, -0.10, -0.08, -0.06, -0.04, -0.02, -0.01, 0.0, \
			0.005, 0.01, 0.015, 0.02, 0.04, 0.06, 0.08, 0.10, 0.12]
numTemps = len(temps)
numStrains = len(strains)
# numKpts = 100
numKpts = 50
numAtomsUC = 4 # Number of atoms in the unit cell
numFreq = 3 * numAtomsUC
numVel = numFreq
mass = 1.0 * lj.value('mass') * ct.value('kilo') * ct.value('avog')
gulpName = 'gulp.temp' # Gulp template file
tempName = 'input.gulp'

# Lattice Constants
alat = np.array( [lj.value('lat20'), lj.value('lat50'), lj.value('lat80')] ) 

# Data Arrays
vel = np.zeros( (numTemps, numStrains, numKpts, 3, numFreq, 3),	dtype=float)

freqConv = 2.0 * np.pi * ct.value('c') * ct.value('tocenti') * lj.value('tau')

# velConv = ((1.0 / ct.value('centi')) * ct.value('c')) / (1.0 / (lj.value('lat20') * ct.value('ang')))
# print velConv

for itemp in range(numTemps):
sys.path.append('/home/kevin/projects/ntpl/Codes') # Needed to recognize ntpy module
import ntpy.lattice as lt
import ntpy.param.lj as lj
import ntpy.param.const as ct
import ntpy.gulp as gp

temps = [20, 50, 80]
strains = [-0.12, -0.10, -0.08, -0.06, -0.04, -0.02, -0.01, 0.0, \
			0.005, 0.01, 0.015, 0.02, 0.04, 0.06, 0.08, 0.10, 0.12]
numTemps = len(temps)
numStrains = len(strains)
numKpts = 100
numAtomsUC = 4 # Number of atoms in the unit cell
numFreq = 3 * numAtomsUC
numVel = numFreq
mass = 1.0 * lj.value('mass') * ct.value('kilo') * ct.value('avog')
gulpName = 'gulp.temp' # Gulp template file
tempName = 'input.gulp'

# Lattice Constants
alat = np.array( [lj.value('lat20'), lj.value('lat50'), lj.value('lat80')] ) 

# Data Arrays
eig = np.zeros( (numTemps, numStrains, numKpts, 3, numFreq, numFreq), \
				dtype=complex)

for itemp in range(numTemps):
	for istrain in range(numStrains):
		# 100 Direction, Create kpts
		kpt = np.zeros( (numKpts, 3), dtype=float)
		kpt[:, 0] = np.linspace(0, 0.5, num=numKpts)
Exemple #4
0
## ## ## Kevin Parrish		## ## ##
## ## ## nmd.py config file	## ## ##
import numpy as np
import sys
ntpyPath = '/opt/mcgaugheygroup/ntpy'
sys.path.append(ntpyPath) # Needed to recognize ntpy module
import ntpy.lattice as lt
import ntpy.param.lj as lj
import ntpy.param.const as ct

## ## ## BEGIN USER INPUT	## ## ##

## Lattice Parameters
dim = [4, 4, 4]
latType = 'fcc'
realMass = 1.0 * lj.value('mass') * ct.value('kilo') * ct.value('avog')
ljMass = 1.0
realLat = lj.value('lat20') * (1.0+ 0.0)
ljLat = ((lj.value('lat20') / lj.value('sigma')) * 1e-10) * (1.0 + 0.0)

## Name Parameters

gulpName = 'gulp.template'				# Gulp Template Name
gulpTrans = 'input.gulp'				# Gulp Transient Name
gulpExe = 'gulp_ifort'					# Gulp Executable Name

lammpsName = 'lammps.template'			# Lammps Template Name
lammpsRunName = 'in.lammps'				# Lammps Run Name

lammpsSubName = 'lammps.sub.template'	# Lammps Submission Template Name
lammpsSubRunName = 'tmp.lammps.sub'		# Lammps Submission Run Name
		values = np.polyfit(1.0 / rSizes, 1.0 / tmpKappa[itemp,istrain,:], 1)
		kappa[itemp, istrain] = 1.0 / values[1]
		print kappa[itemp, istrain]
		np.savez('post.nmd.cond.npz', kappa=kappa, tmpKappa=tmpKappa, strains=rstrains)


## Plot accumulation function
for itemp in range(1):
	for istrain in range(1):
		for isize in range(3):
			# Import run data
			file = np.load('post.nmd.'+ job[isize]+ '.npz')
			life = file['life']
			vel = file['vel']
			V = file['V']
			heatCap = ct.value('kb')
			print 'life\t'+ str(np.max(life[:,:]))
			print 'vel\t'+ str(np.max(vel[:,:,:]))
			print 'heatCap\t'+ str(heatCap)
			print 'V\t'+ str(V)
			accumCond, accumMfp = accumFunc(life, vel, heatCap, V)

			plt.semilogx(accumMfp, accumCond) 
			plt.xlim(xmin=1e-9)
			plt.title('NMD Accumulation Function')
			plt.xlabel(r'$\Lambda \/ (m)$')
			plt.ylabel(r'$k \/ \left(\frac{W}{m-K}\right)$')
			plt.savefig('pic.accum.'+ job[isize]+ '.png')
			plt.show()
			plt.clf()
            qCond, cCond = aldThermCond(jobName)

            tmpKappa[itemp, istrain, isize] = cCond[0]

            # # Save Data
            np.savez(
                "post.ald.new." + str(itemp) + "." + str(istrain) + "." + str(isize) + ".npz",
                newKpt=newKpt,
                newFreq=newFreq,
                newLife=newLife,
                newVel=newVel,
                newEigVec=newEigVec,
            )

            # # Plot accumulation function
            heatCap = ct.value("kb")
            # print "life\t"+ str(np.max(newLife[:]))
            # print "vel\t"+ str(np.max(newVel[:,:]))
            # print "heatCap\t"+ str(heatCap)
            # print "V\t"+ str(V)

            accumCond, accumMfp = accumFunc(newLife, newVel, heatCap, V)

            plt.semilogx(accumMfp, accumCond)
            plt.xlim(xmin=1e-9)
            plt.title("Ald Accumulation Function")
            plt.xlabel(r"$\Lambda \/ (m)$")
            plt.ylabel(r"$k \/ \left(\frac{W}{m-K}\right)$")
            plt.savefig("pic.accum." + tStr + "." + sStr + "." + zStr + ".png")
            plt.clf()