minor fix for EPW postprocessing

This commit is contained in:
noemas 2019-04-26 16:06:05 +00:00
parent 306ea50b74
commit 212e57055a
1 changed files with 319 additions and 317 deletions

View File

@ -1,317 +1,319 @@
#!/usr/bin/python #!/usr/bin/python
# #
# Post-processing script from of PH data in format used by EPW # Post-processing script from of PH data in format used by EPW
# 14/07/2015 - Creation of the script - Samuel Ponce # 14/07/2015 - Creation of the script - Samuel Ponce
# 14/03/2018 - Automatically reads the number of q-points - Michael Waters # 14/03/2018 - Automatically reads the number of q-points - Michael Waters
# 14/03/2018 - Detect if SOC is included in the calculation - Samuel Ponce # 14/03/2018 - Detect if SOC is included in the calculation - Samuel Ponce
# 13/11/2018 - Write dyn files in xml format for SOC case - Shunhong Zhang (USTC) # 13/11/2018 - Write dyn files in xml format for SOC case - Shunhong Zhang (USTC)
# #
import numpy as np import numpy as np
import os import os
from xml.dom import minidom from xml.dom import minidom
# Convert the dyn files to the xml form, for SOC case - Shunhong Zhang (USTC) # Convert the dyn files to the xml form, for SOC case - Shunhong Zhang (USTC)
def dyn2xml(prefix): def dyn2xml(prefix):
ndyn=int(os.popen('head -2 {0}.dyn0|tail -1'.format(prefix)).read()) ndyn=int(os.popen('head -2 {0}.dyn0|tail -1'.format(prefix)).read())
for idyn in range(1,ndyn+1): for idyn in range(1,ndyn+1):
print '{0}.dyn{1} to {0}.dyn_q{1}.xml'.format(prefix,idyn) print '{0}.dyn{1} to {0}.dyn_q{1}.xml'.format(prefix,idyn)
dynmat=dyn(prefix,idyn) dynmat=dyn(prefix,idyn)
dynmat._write_xml() dynmat._write_xml()
def get_geom_info(): def get_geom_info():
if os.path.isfile('ph.out')==False: if os.path.isfile('ph.out')==False:
print 'cannot extract geometry info from ph.out' print 'cannot extract geometry info from ph.out'
return 1 return 1
else: else:
volm=float(os.popen('grep -a volume ph.out 2>/dev/null|tail -1').readline().split()[-2]) volm=float(os.popen('grep -a volume ph.out 2>/dev/null|tail -1').readline().split()[-2])
get_at=os.popen('grep -a -A 3 "crystal axes" ph.out 2>/dev/null|tail -3').readlines() get_at=os.popen('grep -a -A 3 "crystal axes" ph.out 2>/dev/null|tail -3').readlines()
at=np.array([[float(item) for item in line.split()[3:6]] for line in get_at]) at=np.array([[float(item) for item in line.split()[3:6]] for line in get_at])
get_bg=os.popen('grep -a -A 3 "reciprocal axes" ph.out 2>/dev/null|tail -3').readlines() get_bg=os.popen('grep -a -A 3 "reciprocal axes" ph.out 2>/dev/null|tail -3').readlines()
bg=np.array([[float(item) for item in line.split()[3:6]] for line in get_bg]) bg=np.array([[float(item) for item in line.split()[3:6]] for line in get_bg])
return volm,at,bg return volm,at,bg
class dyn(object): class dyn(object):
def __init__(self,prefix,idyn): def __init__(self,prefix,idyn):
self._prefix=prefix self._prefix=prefix
self._idyn=idyn self._idyn=idyn
fil='{0}.dyn{1}'.format(prefix,idyn) fil='{0}.dyn{1}'.format(prefix,idyn)
f=open(fil) f=open(fil)
self._comment=f.readline() self._comment=f.readline()
f.readline() f.readline()
line=f.readline().split() line=f.readline().split()
self._ntype=int(line[0]) self._ntype=int(line[0])
self._natom=int(line[1]) self._natom=int(line[1])
self._ibrav=int(line[2]) self._ibrav=int(line[2])
self._nspin=1 self._nspin=1
self._cell_dim=np.array([float(ii) for ii in line[3:]]) self._cell_dim=np.array([float(ii) for ii in line[3:]])
self._volm=0 self._volm=0
self._at=np.zeros((3,3),float) self._at=np.zeros((3,3),float)
self._bg=np.zeros((3,3),float) self._bg=np.zeros((3,3),float)
try: self._volm,self._at,self._bg = get_geom_info() try: self._volm,self._at,self._bg = get_geom_info()
except: print 'warning: lattice info not found' except: print 'warning: lattice info not found'
self._species=[]; for i in range(0, 4):
self._mass=[] f.readline()
for i in range(self._ntype): self._species=[];
line=f.readline().split() self._mass=[]
self._species.append(line[1].strip("'")) for i in range(self._ntype):
self._mass.append(float(line[-1])/911.4442) # normalize to atomic mass line=f.readline().split()
self._atom_type=np.zeros(self._natom,int) self._species.append(line[1].strip("'"))
self._pos=np.zeros((self._natom,3),float) self._mass.append(float(line[-1])/911.4442) # normalize to atomic mass
for i in range(self._natom): self._atom_type=np.zeros(self._natom,int)
line=f.readline().split() self._pos=np.zeros((self._natom,3),float)
self._atom_type[i]=int(line[1]) for i in range(self._natom):
for j in range(3): self._pos[i,j]=float(line[j+2]) line=f.readline().split()
self._nqpt=int(os.popen('grep -c "Dynamical Matrix" {0}'.format(fil)).read().split()[0]) self._atom_type[i]=int(line[1])
self._qpt=[] for j in range(3): self._pos[i,j]=float(line[j+2])
self._dynmat=np.zeros((self._nqpt,self._natom,self._natom,3,3,2),float) self._nqpt=int(os.popen('grep -c "Dynamical Matrix" {0}'.format(fil)).read().split()[0])
f.readline() self._qpt=[]
for iqpt in range(self._nqpt): self._dynmat=np.zeros((self._nqpt,self._natom,self._natom,3,3,2),float)
f.readline(); f.readline()
f.readline() for iqpt in range(self._nqpt):
line=f.readline().split() f.readline();
self._qpt.append(np.array([float(item) for item in line[3:6]])) f.readline()
f.readline() line=f.readline().split()
for i in range(self._natom): self._qpt.append(np.array([float(item) for item in line[3:6]]))
for j in range(self._natom): f.readline()
f.readline() for i in range(self._natom):
data=np.fromfile(f,sep=' ',count=18,dtype=float).reshape(3,3,2) for j in range(self._natom):
self._dynmat[iqpt,i,j]=data f.readline()
self._qpt=np.array(self._qpt) data=np.fromfile(f,sep=' ',count=18,dtype=float).reshape(3,3,2)
for i in range(5): f.readline() self._dynmat[iqpt,i,j]=data
self._freq=np.zeros((self._natom*3,2),float) self._qpt=np.array(self._qpt)
self._disp=np.zeros((self._natom*3,self._natom,3,2),float) for i in range(5): f.readline()
for i in range(self._natom*3): self._freq=np.zeros((self._natom*3,2),float)
line=f.readline().split() self._disp=np.zeros((self._natom*3,self._natom,3,2),float)
self._freq[i,0]=float(line[4]) for i in range(self._natom*3):
self._freq[i,1]=float(line[7]) line=f.readline().split()
for j in range(self._natom): self._freq[i,0]=float(line[4])
line=f.readline().split()[1:-1] self._freq[i,1]=float(line[7])
data=np.array([float(item) for item in line]).reshape(3,2) for j in range(self._natom):
self._disp[i,j]=data line=f.readline().split()[1:-1]
data=np.array([float(item) for item in line]).reshape(3,2)
def _write_xml(self): self._disp[i,j]=data
doc=minidom.Document()
root = doc.createElement('Root') def _write_xml(self):
doc.appendChild(root) doc=minidom.Document()
geom_info=doc.createElement('GEOMETRY_INFO') root = doc.createElement('Root')
tags=('NUMBER_OF_TYPES','NUMBER_OF_ATOMS','BRAVAIS_LATTICE_INDEX','SPIN_COMPONENTS') doc.appendChild(root)
numbers=(self._ntype,self._natom,self._ibrav,self._nspin) geom_info=doc.createElement('GEOMETRY_INFO')
for i,(tag,num) in enumerate(zip(tags,numbers)): tags=('NUMBER_OF_TYPES','NUMBER_OF_ATOMS','BRAVAIS_LATTICE_INDEX','SPIN_COMPONENTS')
inode=doc.createElement(tag) numbers=(self._ntype,self._natom,self._ibrav,self._nspin)
inode.setAttribute('type','integer') for i,(tag,num) in enumerate(zip(tags,numbers)):
inode.setAttribute('size','1') inode=doc.createElement(tag)
inode.text=num inode.setAttribute('type','integer')
inode.appendChild(doc.createTextNode(str(num))) inode.setAttribute('size','1')
geom_info.appendChild(inode) inode.text=num
cell_dim=doc.createElement('CELL_DIMENSIONS') inode.appendChild(doc.createTextNode(str(num)))
cell_dim.setAttribute('type','real') geom_info.appendChild(inode)
cell_dim.setAttribute('size','6') cell_dim=doc.createElement('CELL_DIMENSIONS')
for i in range(6): cell_dim.setAttribute('type','real')
cell_dim.appendChild(doc.createTextNode('{0:16.10f}'.format(self._cell_dim[i]))) cell_dim.setAttribute('size','6')
geom_info.appendChild(cell_dim) for i in range(6):
tags=['AT','BG'] cell_dim.appendChild(doc.createTextNode('{0:16.10f}'.format(self._cell_dim[i])))
for tag,lat in zip(tags,(self._at,self._bg)): geom_info.appendChild(cell_dim)
inode=doc.createElement(tag) tags=['AT','BG']
inode.setAttribute('type','real') for tag,lat in zip(tags,(self._at,self._bg)):
inode.setAttribute('size','9') inode=doc.createElement(tag)
inode.setAttribute('columns','3') inode.setAttribute('type','real')
for i in range(3): inode.setAttribute('size','9')
text=' '.join(['{0:16.10f}'.format(item) for item in lat[i]]) inode.setAttribute('columns','3')
inode.appendChild(doc.createTextNode(text)) for i in range(3):
geom_info.appendChild(inode) text=' '.join(['{0:16.10f}'.format(item) for item in lat[i]])
volm=doc.createElement('UNIT_CELL_VOLUME_AU') inode.appendChild(doc.createTextNode(text))
volm.setAttribute('type','real') geom_info.appendChild(inode)
volm.setAttribute('size','1') volm=doc.createElement('UNIT_CELL_VOLUME_AU')
volm.appendChild(doc.createTextNode('{0:16.10f}'.format(self._volm))) volm.setAttribute('type','real')
geom_info.appendChild(volm) volm.setAttribute('size','1')
for itype in range(self._ntype): volm.appendChild(doc.createTextNode('{0:16.10f}'.format(self._volm)))
nt=doc.createElement('TYPE_NAME.{0}'.format(itype+1)) geom_info.appendChild(volm)
nt.setAttribute('type','character') for itype in range(self._ntype):
nt.setAttribute('size','1') nt=doc.createElement('TYPE_NAME.{0}'.format(itype+1))
nt.setAttribute('len','3') nt.setAttribute('type','character')
nt.appendChild(doc.createTextNode('{0}'.format(self._species[itype]))) nt.setAttribute('size','1')
na=doc.createElement('MASS.{0}'.format(itype+1)) nt.setAttribute('len','3')
na.setAttribute('type','real') nt.appendChild(doc.createTextNode('{0}'.format(self._species[itype])))
na.setAttribute('size','1') na=doc.createElement('MASS.{0}'.format(itype+1))
na.appendChild(doc.createTextNode('{0:16.10f}'.format(self._mass[itype]))) na.setAttribute('type','real')
geom_info.appendChild(nt) na.setAttribute('size','1')
geom_info.appendChild(na) na.appendChild(doc.createTextNode('{0:16.10f}'.format(self._mass[itype])))
for iat in range(self._natom): geom_info.appendChild(nt)
at=doc.createElement('ATOM.{0}'.format(iat+1)) geom_info.appendChild(na)
at.setAttribute('SPECIES','{0}'.format(self._species[self._atom_type[iat]-1])) for iat in range(self._natom):
at.setAttribute('INDEX',str(iat+1)) at=doc.createElement('ATOM.{0}'.format(iat+1))
pos=' '.join(['{0:16.10f}'.format(item) for item in self._pos[iat]]) at.setAttribute('SPECIES','{0}'.format(self._species[self._atom_type[iat]-1]))
at.setAttribute('TAU',pos) at.setAttribute('INDEX',str(iat+1))
geom_info.appendChild(at) pos=' '.join(['{0:16.10f}'.format(item) for item in self._pos[iat]])
nqpt=doc.createElement('NUMBER_OF_Q') at.setAttribute('TAU',pos)
nqpt.setAttribute('type','integer') geom_info.appendChild(at)
nqpt.setAttribute('size','1') nqpt=doc.createElement('NUMBER_OF_Q')
nqpt.appendChild(doc.createTextNode(str(self._nqpt))) nqpt.setAttribute('type','integer')
geom_info.appendChild(nqpt) nqpt.setAttribute('size','1')
root.appendChild(geom_info) nqpt.appendChild(doc.createTextNode(str(self._nqpt)))
for iqpt in range(self._nqpt): geom_info.appendChild(nqpt)
dynmat=doc.createElement('DYNAMICAL_MAT_.{0}'.format(iqpt+1)) root.appendChild(geom_info)
qpt=doc.createElement('Q_POINT') for iqpt in range(self._nqpt):
qpt.setAttribute('type','real') dynmat=doc.createElement('DYNAMICAL_MAT_.{0}'.format(iqpt+1))
qpt.setAttribute('size','3') qpt=doc.createElement('Q_POINT')
qpt.setAttribute('columns','3') qpt.setAttribute('type','real')
tnode=doc.createTextNode(' '.join(['{0:16.10f}'.format(item) for item in self._qpt[iqpt]])) qpt.setAttribute('size','3')
qpt.appendChild(tnode) qpt.setAttribute('columns','3')
dynmat.appendChild(qpt) tnode=doc.createTextNode(' '.join(['{0:16.10f}'.format(item) for item in self._qpt[iqpt]]))
for iat in range(self._natom): qpt.appendChild(tnode)
for jat in range(self._natom): dynmat.appendChild(qpt)
ph=doc.createElement('PHI.{0}.{1}'.format(iat+1,jat+1)) for iat in range(self._natom):
ph.setAttribute('type','complex') for jat in range(self._natom):
ph.setAttribute('size','9') ph=doc.createElement('PHI.{0}.{1}'.format(iat+1,jat+1))
ph.setAttribute('columns','3') ph.setAttribute('type','complex')
for i in range(3): ph.setAttribute('size','9')
for j in range(3): ph.setAttribute('columns','3')
text='{0:16.10f} {1:16.10f}'.format(self._dynmat[iqpt,iat,jat,i,j,0],self._dynmat[iqpt,iat,jat,i,j,1]) for i in range(3):
ph.appendChild(doc.createTextNode(text)) for j in range(3):
dynmat.appendChild(ph) text='{0:16.10f} {1:16.10f}'.format(self._dynmat[iqpt,iat,jat,i,j,0],self._dynmat[iqpt,iat,jat,i,j,1])
root.appendChild(dynmat) ph.appendChild(doc.createTextNode(text))
mode=doc.createElement('FREQUENCIES_THZ_CMM1') dynmat.appendChild(ph)
for iomega in range(self._natom*3): root.appendChild(dynmat)
inode=doc.createElement('OMEGA.{0}'.format(iomega+1)) mode=doc.createElement('FREQUENCIES_THZ_CMM1')
inode.setAttribute('type','real') for iomega in range(self._natom*3):
inode.setAttribute('size','2') inode=doc.createElement('OMEGA.{0}'.format(iomega+1))
inode.setAttribute('columns','2') inode.setAttribute('type','real')
inode.appendChild(doc.createTextNode('{0:16.10f} {1:16.10f}'.format(self._freq[iomega,0],self._freq[iomega,1]))) inode.setAttribute('size','2')
idisp=doc.createElement('DISPLACEMENT.{0}'.format(iomega+1)) inode.setAttribute('columns','2')
idisp.setAttribute('tpye','complex') inode.appendChild(doc.createTextNode('{0:16.10f} {1:16.10f}'.format(self._freq[iomega,0],self._freq[iomega,1])))
idisp.setAttribute('size','3') idisp=doc.createElement('DISPLACEMENT.{0}'.format(iomega+1))
for iat in range(self._natom): idisp.setAttribute('tpye','complex')
for j in range(3): idisp.setAttribute('size','3')
tnode=doc.createTextNode('{0:16.10f} {1:16.10f}'.format(self._disp[iomega,iat,j,0],self._disp[iomega,iat,j,1])) for iat in range(self._natom):
idisp.appendChild(tnode) for j in range(3):
mode.appendChild(inode) tnode=doc.createTextNode('{0:16.10f} {1:16.10f}'.format(self._disp[iomega,iat,j,0],self._disp[iomega,iat,j,1]))
mode.appendChild(idisp) idisp.appendChild(tnode)
root.appendChild(mode) mode.appendChild(inode)
fp = open('{0}.dyn_q{1}.xml'.format(self._prefix,self._idyn), 'w') mode.appendChild(idisp)
doc.writexml(fp, addindent=' ', newl='\n') root.appendChild(mode)
fp = open('{0}.dyn_q{1}.xml'.format(self._prefix,self._idyn), 'w')
# Return the number of q-points in the IBZ doc.writexml(fp, addindent=' ', newl='\n')
def get_nqpt(prefix):
fname = '_ph0/' +prefix+'.phsave/control_ph.xml' # Return the number of q-points in the IBZ
def get_nqpt(prefix):
fid = open(fname,'r') fname = '_ph0/' +prefix+'.phsave/control_ph.xml'
lines = fid.readlines() # these files are relatively small so reading the whole thing shouldn't be an issue
fid.close() fid = open(fname,'r')
lines = fid.readlines() # these files are relatively small so reading the whole thing shouldn't be an issue
line_number_of_nqpt = 0 fid.close()
while 'NUMBER_OF_Q_POINTS' not in lines[line_number_of_nqpt]: # increment to line of interest
line_number_of_nqpt +=1 line_number_of_nqpt = 0
line_number_of_nqpt +=1 # its on the next line after that text while 'NUMBER_OF_Q_POINTS' not in lines[line_number_of_nqpt]: # increment to line of interest
line_number_of_nqpt +=1
nqpt = int(lines[line_number_of_nqpt]) line_number_of_nqpt +=1 # its on the next line after that text
return nqpt nqpt = int(lines[line_number_of_nqpt])
# Check if the calculation include SOC return nqpt
def hasSOC(prefix):
fname = prefix+'.save/data-file-schema.xml' # Check if the calculation include SOC
def hasSOC(prefix):
xmldoc = minidom.parse(fname) fname = prefix+'.save/data-file-schema.xml'
item = xmldoc.getElementsByTagName('spinorbit')[0]
lSOC = item.childNodes[0].data xmldoc = minidom.parse(fname)
item = xmldoc.getElementsByTagName('spinorbit')[0]
return lSOC lSOC = item.childNodes[0].data
# Check if the calculation was done in sequential return lSOC
def isSEQ(prefix):
fname = '_ph0/'+str(prefix)+'.dvscf' # Check if the calculation was done in sequential
if (os.path.isfile(fname)): def isSEQ(prefix):
lseq = True fname = '_ph0/'+str(prefix)+'.dvscf'
else: if (os.path.isfile(fname)):
lseq = False lseq = True
else:
return lseq lseq = False
# Enter the number of irr. q-points return lseq
user_input = raw_input('Enter the prefix used for PH calculations (e.g. diam)\n')
prefix = str(user_input) # Enter the number of irr. q-points
user_input = raw_input('Enter the prefix used for PH calculations (e.g. diam)\n')
# Test if SOC prefix = str(user_input)
SOC = hasSOC(prefix)
# Test if SOC
# If SOC detected, but dyn is not in XML and we want to convert it SOC = hasSOC(prefix)
if SOC=='true':
user_input = raw_input('Calculation with SOC detected. Do you want to convert dyn in XML format [y/n]?\n') # If SOC detected, but dyn is not in XML and we want to convert it
if str(user_input) == 'y': if SOC=='true':
dyn2xml(prefix) user_input = raw_input('Calculation with SOC detected. Do you want to convert dyn in XML format [y/n]?\n')
os.system('mv {0}.dyn*.xml save'.format(prefix)) if str(user_input) == 'y':
dyn2xml(prefix)
# If no SOC detected, do you want to convert into XML format os.system('mv {0}.dyn*.xml save'.format(prefix))
if SOC=='false':
user_input = raw_input('Calculation without SOC detected. Do you want to convert to xml anyway [y/n]?\n') # If no SOC detected, do you want to convert into XML format
if str(user_input) == 'y': if SOC=='false':
SOC = 'true' user_input = raw_input('Calculation without SOC detected. Do you want to convert to xml anyway [y/n]?\n')
dyn2xml(prefix) if str(user_input) == 'y':
os.system('mv {0}.dyn*.xml save'.format(prefix)) SOC = 'true'
dyn2xml(prefix)
# Test if seq. or parallel run os.system('mv {0}.dyn*.xml save'.format(prefix))
SEQ = isSEQ(prefix)
# Test if seq. or parallel run
if True: # this gets the nqpt from the outputfiles SEQ = isSEQ(prefix)
nqpt = get_nqpt(prefix)
if True: # this gets the nqpt from the outputfiles
else: nqpt = get_nqpt(prefix)
# Enter the number of irr. q-points
user_input = raw_input('Enter the number of irreducible q-points\n') else:
nqpt = user_input # Enter the number of irr. q-points
try: user_input = raw_input('Enter the number of irreducible q-points\n')
nqpt = int(user_input) nqpt = user_input
except ValueError: try:
raise Exception('The value you enter is not an integer!') nqpt = int(user_input)
except ValueError:
os.system('mkdir save 2>/dev/null') raise Exception('The value you enter is not an integer!')
for iqpt in np.arange(1,nqpt+1): os.system('mkdir save 2>/dev/null')
label = str(iqpt)
for iqpt in np.arange(1,nqpt+1):
# Case calculation in seq. label = str(iqpt)
if SEQ:
# Case with SOC # Case calculation in seq.
if SOC == 'true': if SEQ:
os.system('cp '+prefix+'.dyn0 '+prefix+'.dyn0.xml') # Case with SOC
os.system('cp '+prefix+'.dyn'+str(iqpt)+'.xml save/'+prefix+'.dyn_q'+label+'.xml') if SOC == 'true':
if (iqpt == 1): os.system('cp '+prefix+'.dyn0 '+prefix+'.dyn0.xml')
os.system('cp _ph0/'+prefix+'.dvscf* save/'+prefix+'.dvscf_q'+label) os.system('cp '+prefix+'.dyn'+str(iqpt)+'.xml save/'+prefix+'.dyn_q'+label+'.xml')
os.system('cp -r _ph0/'+prefix+'.phsave save/') if (iqpt == 1):
os.system('cp '+prefix+'.fc.xml save/ifc.q2r.xml') os.system('cp _ph0/'+prefix+'.dvscf* save/'+prefix+'.dvscf_q'+label)
else: os.system('cp -r _ph0/'+prefix+'.phsave save/')
os.system('cp _ph0/'+prefix+'.q_'+str(iqpt)+'/'+prefix+'.dvscf* save/'+prefix+'.dvscf_q'+label) os.system('cp '+prefix+'.fc.xml save/ifc.q2r.xml')
os.system('rm _ph0/'+prefix+'.q_'+str(iqpt)+'/*wfc*' ) else:
# Case without SOC os.system('cp _ph0/'+prefix+'.q_'+str(iqpt)+'/'+prefix+'.dvscf* save/'+prefix+'.dvscf_q'+label)
if SOC == 'false': os.system('rm _ph0/'+prefix+'.q_'+str(iqpt)+'/*wfc*' )
os.system('cp '+prefix+'.dyn'+str(iqpt)+' save/'+prefix+'.dyn_q'+label) # Case without SOC
if (iqpt == 1): if SOC == 'false':
os.system('cp _ph0/'+prefix+'.dvscf save/'+prefix+'.dvscf_q'+label) os.system('cp '+prefix+'.dyn'+str(iqpt)+' save/'+prefix+'.dyn_q'+label)
os.system('cp -r _ph0/'+prefix+'.phsave save/') if (iqpt == 1):
os.system('cp '+prefix+'.fc save/ifc.q2r') os.system('cp _ph0/'+prefix+'.dvscf save/'+prefix+'.dvscf_q'+label)
else: os.system('cp -r _ph0/'+prefix+'.phsave save/')
os.system('cp _ph0/'+prefix+'.q_'+str(iqpt)+'/'+prefix+'.dvscf save/'+prefix+'.dvscf_q'+label) os.system('cp '+prefix+'.fc save/ifc.q2r')
os.system('rm _ph0/'+prefix+'.q_'+str(iqpt)+'/*wfc*' ) else:
os.system('cp _ph0/'+prefix+'.q_'+str(iqpt)+'/'+prefix+'.dvscf save/'+prefix+'.dvscf_q'+label)
else: os.system('rm _ph0/'+prefix+'.q_'+str(iqpt)+'/*wfc*' )
# Case with SOC
if SOC == 'true': else:
os.system('cp '+prefix+'.dyn0 '+prefix+'.dyn0.xml') # Case with SOC
os.system('cp '+prefix+'.dyn'+str(iqpt)+'.xml save/'+prefix+'.dyn_q'+label+'.xml') if SOC == 'true':
if (iqpt == 1): os.system('cp '+prefix+'.dyn0 '+prefix+'.dyn0.xml')
os.system('cp _ph0/'+prefix+'.dvscf1 save/'+prefix+'.dvscf_q'+label) os.system('cp '+prefix+'.dyn'+str(iqpt)+'.xml save/'+prefix+'.dyn_q'+label+'.xml')
os.system('cp -r _ph0/'+prefix+'.phsave save/') if (iqpt == 1):
os.system('cp '+prefix+'.fc.xml save/ifc.q2r.xml') os.system('cp _ph0/'+prefix+'.dvscf1 save/'+prefix+'.dvscf_q'+label)
else: os.system('cp -r _ph0/'+prefix+'.phsave save/')
os.system('cp _ph0/'+prefix+'.q_'+str(iqpt)+'/'+prefix+'.dvscf1 save/'+prefix+'.dvscf_q'+label) os.system('cp '+prefix+'.fc.xml save/ifc.q2r.xml')
os.system('rm _ph0/'+prefix+'.q_'+str(iqpt)+'/*wfc*' ) else:
# Case without SOC os.system('cp _ph0/'+prefix+'.q_'+str(iqpt)+'/'+prefix+'.dvscf1 save/'+prefix+'.dvscf_q'+label)
if SOC == 'false': os.system('rm _ph0/'+prefix+'.q_'+str(iqpt)+'/*wfc*' )
os.system('cp '+prefix+'.dyn'+str(iqpt)+' save/'+prefix+'.dyn_q'+label) # Case without SOC
if (iqpt == 1): if SOC == 'false':
os.system('cp _ph0/'+prefix+'.dvscf1 save/'+prefix+'.dvscf_q'+label) os.system('cp '+prefix+'.dyn'+str(iqpt)+' save/'+prefix+'.dyn_q'+label)
os.system('cp -r _ph0/'+prefix+'.phsave save/') if (iqpt == 1):
os.system('cp '+prefix+'.fc save/ifc.q2r') os.system('cp _ph0/'+prefix+'.dvscf1 save/'+prefix+'.dvscf_q'+label)
else: os.system('cp -r _ph0/'+prefix+'.phsave save/')
os.system('cp _ph0/'+prefix+'.q_'+str(iqpt)+'/'+prefix+'.dvscf1 save/'+prefix+'.dvscf_q'+label) os.system('cp '+prefix+'.fc save/ifc.q2r')
os.system('rm _ph0/'+prefix+'.q_'+str(iqpt)+'/*wfc*' ) else:
os.system('cp _ph0/'+prefix+'.q_'+str(iqpt)+'/'+prefix+'.dvscf1 save/'+prefix+'.dvscf_q'+label)
os.system('rm _ph0/'+prefix+'.q_'+str(iqpt)+'/*wfc*' )