예제 #1
0
파일: create.nmd.py 프로젝트: csgorham/ntpy
	nmd.lmpInFile['SEED'] = str((iseed + 1) * 11111)
	nmd.lmpInFile['FFT_LOG_FILE'] = 'out.lammps.fft'+ ext
	nmd.lmpInFile['OUT_VEL'] = 'out.lammps.vel'+ ext
	nmd.lmpInFile['W_STEP'] = nmd.wStep
	nmd.lmpInFile['T_FFT'] = nmd.tFft
	nmd.lmpInFile['T_TOTAL'] = nmd.tTotal

	lmpSubFile = dict({ 'NUM_CPU' : nmd.lmpCpu,
					'LMP_TEMP' : nmd.lammpsRunName+ ext,
					'EXECPATH' : nmd.lammpsExecPath,
					'EXECUTABLE' : 'lmp_generic',
					'RUNPATH' : nmd.runpath
					})

	# Lammps Run file
	st.sed(nmd.lmpInFile, nmd.lammpsName, nmd.lammpsRunName+ ext)

	# Lammps Submission file
	st.sed(lmpSubFile, nmd.lammpsSubName, nmd.lammpsSubRunName+ ext+ '.sh')

	# Make a single submission script
	lmpF.write(r'qsub -l walltime='+ str(nmd.lmpWallTime)+ ':00:00 -l nodes=1:ppn='+ \
				str(nmd.lmpCpu)+ ' '+ str(nmd.lammpsSubRunName)+ ext+ '.sh\n')
lmpF.close()


## ## NMD CALCULATION ## ##
print "Begin nmd file creation"

# File for single submission script
removeFile(nmd.nmdSubRunName+ '.sh')
예제 #2
0
import sys
sys.path.append("/home/kevin/projects/Codes")
import ntpy.strchg as st
import numpy as np

# String change
strchange = dict({'KPT' : str(kpt[0])+ '\t'+ str(kpt[1])+ '\t'+ \
						  str(kpt[2]),
				  'MASS' : str(mass)
				  })

st.sed(strchange, orig, new)
# Grep out eigenvectors

eigvec = np.zeros( (3 * num_atoms_cell, 3 * num_atoms_cell) )
예제 #3
0
파일: create.nmd.py 프로젝트: csgorham/ntpy
for iseed in range(nt.numSeeds):
	ext = '.'+ str(iseed)

	## Extra Lammps String Subsitutions
	nt.lmpInFile['MAIN_LOG_FILE'] = 'out.lammps.main'+ ext
	nt.lmpInFile['IN_POS'] = nt.inPosName
	nt.lmpInFile['LMP_TMP'] = nt.lammpsRunName+ext
	nt.lmpInFile['SEED'] = str((iseed + 1) * 11111)
	nt.lmpInFile['FFT_LOG_FILE'] = 'out.lammps.fft'+ ext
	nt.lmpInFile['OUT_VEL'] = 'out.lammps.vel'+ ext
	nt.lmpInFile['W_STEP'] = nt.wStep
	nt.lmpInFile['T_FFT'] = nt.tFft
	nt.lmpInFile['T_TOTAL'] = nt.tTotal

	# Lammps Run file
	st.sed(nt.lmpInFile, nt.lammpsName, nt.lammpsRunName+ ext)



## ## NMD CALCULATION ## ##
print "Begin nmd file creation"

# File for single submission script
removeFile(nt.nmdSubRunName+ '.sh')
nmdF = open(nt.nmdSubRunName+ '.sh', 'a')

for iseed in range(nt.numSeeds):
	seed = '.'+ str(iseed)
	ext = seed
	## NMD Processing Sub files
	nmdSubFile = dict({ 'NUM_CPU' : nt.pyCpu,
예제 #4
0
import sys
sys.path.append(ntplPATH)  # Needed to link the ntplpy module
import ntpy.strchg as st

## ## We will use the sed command. First, create a dict of key value pairs.
## ## Each key is an original string and each value is the new string.

##	First, create a key:value dict.
mydict = dict({'sed': 'MARIO', 'dict': 'LUIGI'})
# The following methods are equivalent ways.
# mydict = dict(TEMP_PARAM='80', STRAIN_PARAM='0.02')
# mydict = dict(zip(('TEMP_PARAM', 'STRAIN_PARAM'), ('80', '0.02')))
# mydict = dict([['TEMP_PARAM', '80'], ['STRAIN_PARAM', '0.02']])

## Then simply call the function with the original and new file names.
st.sed(mydict, 'strchgtest.py', 'tmp.newfile')
### And you're done!!!

## If you want to edit the file in-place, i.e. not create a new file,
## then simply make the new file name a blank string.
st.sed(mydict, 'tmp.newfile', '')

## You can also use relative or absolute pathways for the file names.
mydict = dict({'sed': 'MARIO', 'dict': 'LUIGI'})
orig = ntplPATH + '/strchgmod/strchgtest.py'
new = './tmp.newfile'
st.sed(mydict, orig, new)

## ## Now we will try the grep command. This grep implementation uses
## ## the grep -A command.
예제 #5
0
import numpy as np
import sys
sys.path.append("/home/kevin/projects/Codes")
import ntpy.strchg as st

def freq(kpt, num_atoms_cell, mass, main_file, run_file, name)
# String change
	strchange = dict({'KPT' : str(kpt[0])+ '\t'+ str(kpt[1])+ '\t'+ \
							  str(kpt[2]),
					  'runpath' : main_file
					  'MASS' : str(mass)
					  })

	orig = #name of original file
	new = #name of new file
	st.sed(strchange, orig, new)
	os.system('Some system command')

	# Grep out freqencies
	st.grep('Frequency', 'out.disp.'+ main_file, 
			'out.freq.'+ main_file+ str('.grep'))
	strchange = dict({'Frequency' : ''})
	st.sed(strchange, 'out.freq.'+ main_file+ str('.grep'), 
			'out.freq.'+ main_file+ str('.grep.2'))
	
	# Read in freqencies to sort
	dummy = np.loadtxt('out.freq.'+ main_file, comments='--')
	freq[:] = dummy[0,:] * constc?? * 2.0 * np.pi

	os.system('rm out.freq'+ main_file)
예제 #6
0
파일: strchgtest.py 프로젝트: csgorham/ntpy
import sys
sys.path.append(ntplPATH) # Needed to link the ntplpy module
import ntpy.strchg as st

## ## We will use the sed command. First, create a dict of key value pairs.
## ## Each key is an original string and each value is the new string.

##	First, create a key:value dict.
mydict = dict({'sed': 'MARIO', 'dict': 'LUIGI'})
# The following methods are equivalent ways.
# mydict = dict(TEMP_PARAM='80', STRAIN_PARAM='0.02')
# mydict = dict(zip(('TEMP_PARAM', 'STRAIN_PARAM'), ('80', '0.02')))
# mydict = dict([['TEMP_PARAM', '80'], ['STRAIN_PARAM', '0.02']])

## Then simply call the function with the original and new file names.
st.sed(mydict, 'strchgtest.py', 'tmp.newfile')
### And you're done!!!

## If you want to edit the file in-place, i.e. not create a new file,
## then simply make the new file name a blank string.
st.sed(mydict, 'tmp.newfile', '')

## You can also use relative or absolute pathways for the file names.
mydict = dict({'sed': 'MARIO', 'dict': 'LUIGI'})
orig = ntplPATH + '/strchgmod/strchgtest.py'
new = './tmp.newfile'
st.sed(mydict, orig, new)

## ## Now we will try the grep command. This grep implementation uses
## ## the grep -A command.