ext = ix.split('ctrl.')[1] break elif 'ctrls.' in ix: ext = ix.split('ctrls.')[1] break titleinput = 'POSCAR_'+ext openfile = open(argvs[1]).read().split('\n') perfectopen = convctrl.fileopen(openfile) variable_val = convctrl.constlist(openfile) print 'defined variables are:',variable_val for const in range(len(variable_val)): exec variable_val[const] variable_name = convctrl.keywordname(variable_val) ALATone = convctrl.alat(perfectopen,variable_name) ALATone[0][1] = eval(ALATone[0][1]) angstrom = 0.529177 ALAT = ALATone[0][1]*angstrom # ALAT in angstrom PLAT_list = convctrl.plat(perfectopen,variable_name) #print 'plat=',PLAT_list for line_ing in range(len(PLAT_list)): PLAT_list[line_ing] = re.sub('/','/1.0/',PLAT_list[line_ing]) # this trick replace 5/3 with 5/1.0/3. In python 2 this gives difference (5/3=1 in python2). PLAT_list[line_ing] = eval(PLAT_list[line_ing]) atomlist = convctrl.atom(perfectopen,variable_name) #print atomlist for line_all in range(len(atomlist)):
for ix in argvs: #Get extensions for ctrl.ext or ctrls.ext if 'ctrl.' in ix: ext = ix.split('ctrl.')[1] break elif 'ctrls.' in ix: ext = ix.split('ctrls.')[1] break titleinput = 'POSCAR_'+ext openfile = open(argvs[1]).read().split('\n') perfectopen = convctrl.fileopen(openfile) keyword_val = convctrl.constlist(openfile) for const in range(len(keyword_val)): exec keyword_val[const] keyword_name = convctrl.keywordname(keyword_val) ALATone = convctrl.alat(perfectopen,keyword_name) ALATone[0][1] = eval(ALATone[0][1]) angstrom = 0.529177 ALAT = ALATone[0][1]*angstrom # ALAT in angstrom PLAT_list = convctrl.plat(perfectopen,keyword_name) print 'plat=',PLAT_list for line_ing in range(len(PLAT_list)): PLAT_list[line_ing] = re.sub('/','/1.0/',PLAT_list[line_ing]) PLAT_list[line_ing] = eval(PLAT_list[line_ing]) atomlist = convctrl.atom(perfectopen,keyword_name) for line_all in range(len(atomlist)): for line_each in range(1,4): # / is replaced by /1.0/ to avoid "integer division" in python2.x
ext = ix.split('ctrl.')[1] break elif 'ctrls.' in ix: ext = ix.split('ctrls.')[1] break titleinput = 'POSCAR_' + ext openfile = open(argvs[1]).read().split('\n') perfectopen = convctrl.fileopen(openfile) variable_val = convctrl.constlist(openfile) print 'defined variables are:', variable_val for const in range(len(variable_val)): exec variable_val[const] variable_name = convctrl.keywordname(variable_val) ALATone = convctrl.alat(perfectopen, variable_name) ALATone[0][1] = eval(ALATone[0][1]) angstrom = 0.529177 ALAT = ALATone[0][1] * angstrom # ALAT in angstrom PLAT_list = convctrl.plat(perfectopen, variable_name) #print 'plat=',PLAT_list for line_ing in range(len(PLAT_list)): PLAT_list[line_ing] = re.sub( '/', '/1.0/', PLAT_list[line_ing] ) # this trick replace 5/3 with 5/1.0/3. In python 2 this gives difference (5/3=1 in python2). PLAT_list[line_ing] = eval(PLAT_list[line_ing]) atomlist = convctrl.atom(perfectopen, variable_name)