def __init__(self, fname=None, taskName = 'total energy', tolerance = 1, nMaxSteps = 10): """taskName - currently can be 'total energy', 'single phonon', or 'geometry' tolerance - task convergence criteria in percents nMaxSteps = maximum number of optimization steps for the optimization routines""" # Default values, see explanations below: # convergerDic = { # 'taskName': 'total energy', # 'tolerance': '1', # 'nMaxSteps': '10' # } QECalc.__init__(self,fname) # value to converge with respect to k-points or energy cutoffs # currently can be 'total energy', 'single phonon', or 'geometry': # self.taskName = self.config.get('Converger', 'taskName') # convergence criteria in percents: # self.tolerance = self.config.getfloat('Converger','tolerance') # maximum number of optimization steps: # self.nMaxSteps = self.config.getint('Converger','nMaxSteps') self.taskName = taskName self.tolerance = tolerance self.nMaxSteps = nMaxSteps self.lookupTable = { 'total energy' : (self.pwscfLauncher, self.getTotalEnergy), 'single phonon': (self.singlePhononLauncher, self.getSinglePhonon), 'geometry' : (self.pwscfLauncher, self.getLatticeParameters) # 'multiple phonon': (self.multiPhononLauncher, self.getMultiPhonon) } assert self.lookupTable.has_key(self.taskName), "Convergence \
def __init__(self, filename=None, configString=None, sectionList=None, taskList=None): QECalc.__init__(self) # tasks definition: # specify taskName/taskConstructur pairs self._taskSpec = [['pw', PWTask], ['ph', PHTask], ['d3', D3Task]] self._populateTasks(filename, configString, sectionList, taskList) #self.pw = PWTask(filename) #self.ph = PHTask(filename) #self.d3 = D3Task(filename) self.pwph = PWPHMerger(self.pw, self.ph, cleanOutDir=self.pw.input.outDir()) self.taskList = [self.pwph, self.d3] #Hack: make sure d3 task is serial (d3 does not seem to work in parallel) for task in [self.pw, self.ph, self.d3]: #task.setting.useTorque = 'False' task.setSerial() task.setting.serialPrefix = ''
def __init__(self, filename): QECalc.__init__(self) self.pw = PWTask(filename) self.ph = PHTask(filename) self.dynmat = DynmatTask(filename) self.pwph = PWPHMerger(self.pw,self.ph, cleanOutDir = self.pw.input.outDir()) self.taskList = [self.pwph, self.dynmat]
def __init__(self, filename = None, configString = None, sectionList = None, taskList = None): QECalc.__init__(self) # tasks definition: # specify taskName/taskConstructur pairs self._taskSpec = [ ['pw', PWTask], ['ph', PHTask], ['q2r', Q2RTask], ['matdyn', MatdynTask] ] # Merging map sets tasks to be merged. Last two columns identify name # of default task (its input and output objects will be directly #accessible) and last column is the name of merged task object (e.g.'pwph') #is not implemented yet !!!! self._mergingMap = [ ['pw', 'ph', 'pw','pwph'], ] self._populateTasks(filename, configString, sectionList, taskList) self.pwph = PWPHMerger(self.pw,self.ph, cleanOutDir = True) self.taskList = [self.pwph, self.q2r, self.matdyn] self._dispersion = PHDispersion(self.pw.input.structure.lattice, self.matdyn) self.dos = PhononDOS(self.matdyn)
def __init__(self, filename=None, configString=None, sectionList=None, taskList=None): QECalc.__init__(self) # tasks definition: # specify taskName/taskConstructur pairs self._taskSpec = [['pw', PWTask], ['ph', PHTask], ['q2r', Q2RTask], ['matdyn', MatdynTask]] # Merging map sets tasks to be merged. Last two columns identify name # of default task (its input and output objects will be directly #accessible) and last column is the name of merged task object (e.g.'pwph') #is not implemented yet !!!! self._mergingMap = [ ['pw', 'ph', 'pw', 'pwph'], ] self._populateTasks(filename, configString, sectionList, taskList) self.pwph = PWPHMerger(self.pw, self.ph, cleanOutDir=True) self.taskList = [self.pwph, self.q2r, self.matdyn] self._dispersion = PHDispersion(self.pw.input.structure.lattice, self.matdyn) self.dos = PhononDOS(self.matdyn)
def __init__(self, filename): QECalc.__init__(self) self.pw = PWTask(filename) self.ph = PHTask(filename) self.dynmat = DynmatTask(filename) self.pwph = PWPHMerger(self.pw, self.ph, cleanOutDir=self.pw.input.outDir()) self.taskList = [self.pwph, self.dynmat]
def __init__(self, filename = None, configString = None, sectionList = None, taskList = None): QECalc.__init__(self) # tasks definition: # specify taskName/taskConstructur pairs self._taskSpec = [ ['pw', PWTask] ] self._populateTasks(filename, configString, sectionList, taskList)
def __init__(self, filename): QECalc.__init__(self) self._freqs = None self._modes = None self._qpts = None self.pw = PWTask(filename) self.ph = PHTask(filename) self.q2r = Q2RTask(filename) self.matdyn = MatdynTask(filename) self.pwph = PWPHMerger(self.pw,self.ph, cleanOutDir = self.pw.input.outDir()) self.dispersion = PHDispersion(self.pw.input.structure, self.matdyn) self.taskList = [self.pwph, self.q2r, self.matdyn]
def __init__(self, filename): QECalc.__init__(self) self._freqs = None self._modes = None self._qpts = None self.pw = PWTask(filename) self.ph = PHTask(filename) self.q2r = Q2RTask(filename) self.matdyn = MatdynTask(filename) self.pwph = PWPHMerger(self.pw,self.ph, cleanOutDir = self.pw.input.outDir()) self.dispersion = PHDispersion(self.pw.input.structure.lattice, self.matdyn) self.dos = PhononDOS(self.matdyn) self.taskList = [self.pwph, self.q2r, self.matdyn]
def __init__(self, fname, indexRange, prcntVolume, modePrefix): """indexRange is for files' indexing. prcntVolume - coresponding volume expansions""" self.qecalc = QECalc(fname) self.__modePrefix = modePrefix self.__indexRange = indexRange self.__prcntVolume = prcntVolume if len(indexRange) != len(prcntVolume): raise Exception( "QuasiHarmonic dimensions: indexRange != prcntVolume") self.loadPhonons() self.__polyOrder = 1 self.fitMatdyn()
def __init__(self, filename): QECalc.__init__(self) self.pw = PWTask(filename) self.ph = PHTask(filename) self.d3 = D3Task(filename) self.pwph = PWPHMerger(self.pw, self.ph, cleanOutDir=self.pw.input.outDir()) self.taskList = [self.pwph, self.d3] #Hack: make sure d3 task is serial (d3 does not seem to work in parallel) for task in [self.pw, self.ph, self.d3]: task.setting.useTorque = 'False' task.setting.paraPrefix = '' task.setting.paraPostfix = ''
def hexVolOpt(a0, c0_a0, volumeExpansion): '''provide initial(equilibrium) lattice parameters a0, c0/a0, and \ desired volume expansion in percents at which one should run \ the optimization ''' qe = QECalc('config.ini') if qe.structure.lattice.ibrav != 4: raise Exception("The lattice must be hexagonal") # Initial(equilibrium) volume: c0 = a0 * c0_a0 volume = a0 * a0 * c0 volume = volume + volume * volumeExpansion / 100. # initial assumption: all latice parameters expand equally in percents cExpansion = (1. + volumeExpansion / 100.)**(1. / 3.) c = c0 * cExpansion prcntC = 0.2 # percent of c we want to bracket around it for minima search(does not have to warantee the minima is inside)s brentOut = brent(getHexEnergy, (volume, qe), (c - c * prcntC / 100, c + c * prcntC / 100), tol=1.e-5, full_output=1) print brentOut c = brentOut[0] energy = brentOut[1] a = np.sqrt(volume / c) return a, c / a, energy
def __init__(self, filename = None , configString = None, sectionList = None, taskList = None): QECalc.__init__(self) # tasks definition: # specify taskName/taskConstructur pairs self._taskSpec = [ ['pw', PWTask], ['ph', PHTask], ['dynmat', DynmatTask] ] self._populateTasks(filename, configString, sectionList, taskList) #self.pw = PWTask(filename) #self.ph = PHTask(filename) #self.dynmat = DynmatTask(filename) self.pwph = PWPHMerger(self.pw,self.ph, cleanOutDir = True) self.taskList = [self.pwph, self.dynmat]
def __init__(self, filename=None, configString=None, sectionList=None, taskList=None): QECalc.__init__(self) # tasks definition: # specify taskName/taskConstructur pairs self._taskSpec = [['pw', PWTask], ['ph', PHTask], ['dynmat', DynmatTask]] self._populateTasks(filename, configString, sectionList, taskList) #self.pw = PWTask(filename) #self.ph = PHTask(filename) #self.dynmat = DynmatTask(filename) self.pwph = PWPHMerger(self.pw, self.ph, cleanOutDir=True) self.taskList = [self.pwph, self.dynmat]
def __init__(self, fname, indexRange, prcntVolume, modePrefix): """indexRange is for files' indexing. prcntVolume - coresponding volume expansions""" self.qecalc = QECalc(fname) self.__modePrefix = modePrefix self.__indexRange = indexRange self.__prcntVolume = prcntVolume if len(indexRange) != len(prcntVolume): raise Exception("QuasiHarmonic dimensions: indexRange != prcntVolume") self.loadPhonons() self.__polyOrder = 1 self.fitMatdyn()
def __init__(self, filename = None, configString = None, sectionList = None, taskList = None): QECalc.__init__(self) # tasks definition: # specify taskName/taskConstructur pairs self._taskSpec = [ ['pw', PWTask], ['ph', PHTask], ['d3', D3Task] ] self._populateTasks(filename, configString, sectionList, taskList) #self.pw = PWTask(filename) #self.ph = PHTask(filename) #self.d3 = D3Task(filename) self.pwph = PWPHMerger(self.pw,self.ph, cleanOutDir = True) self.taskList = [self.pwph, self.d3] #Hack: make sure d3 task is serial (d3 does not seem to work in parallel) for task in [self.pw, self.ph, self.d3]: #task.setting.useTorque = 'False' task.setSerial()
def __init__(self, fname=None, taskName='total energy', tolerance=1, nMaxSteps=10): """taskName - currently can be 'total energy', 'single phonon', or 'geometry' tolerance - task convergence criteria in percents nMaxSteps = maximum number of optimization steps for the optimization routines""" # Default values, see explanations below: # convergerDic = { # 'taskName': 'total energy', # 'tolerance': '1', # 'nMaxSteps': '10' # } QECalc.__init__(self, fname) # value to converge with respect to k-points or energy cutoffs # currently can be 'total energy', 'single phonon', or 'geometry': # self.taskName = self.config.get('Converger', 'taskName') # convergence criteria in percents: # self.tolerance = self.config.getfloat('Converger','tolerance') # maximum number of optimization steps: # self.nMaxSteps = self.config.getint('Converger','nMaxSteps') self.taskName = taskName self.tolerance = tolerance self.nMaxSteps = nMaxSteps self.lookupTable = { 'total energy': (self.pwscfLauncher, self.getTotalEnergy), 'single phonon': (self.singlePhononLauncher, self.getSinglePhonon), 'geometry': (self.pwscfLauncher, self.getLatticeParameters) # 'multiple phonon': (self.multiPhononLauncher, self.getMultiPhonon) } assert self.lookupTable.has_key(self.taskName), "Convergence \
class QuasiHarmonic(): def __init__(self, fname, indexRange, prcntVolume, modePrefix): """indexRange is for files' indexing. prcntVolume - coresponding volume expansions""" self.qecalc = QECalc(fname) self.__modePrefix = modePrefix self.__indexRange = indexRange self.__prcntVolume = prcntVolume if len(indexRange) != len(prcntVolume): raise Exception( "QuasiHarmonic dimensions: indexRange != prcntVolume") self.loadPhonons() self.__polyOrder = 1 self.fitMatdyn() def fitFunc(self, p, x): return p[0] * x #+ p[1] * x * x #+ p[2] * x * x * x + p[3] * x * x * x * x def fitOmega(self, prcntOmega): # fitfunc = lambda p, x: p[0] * x + p[1] * x * x errFunc = lambda p, x, y: (y - self.fitFunc(p, x)) # initial parameters: pinit = [prcntOmega[1] / self.__prcntVolume[1]] # pinit = [1,0] v, success = leastsq(errFunc, pinit, args=(self.__prcntVolume, prcntOmega)) if success < 1 or success > 4: print success print prcntOmega print v # assert success != 1, "fitOmega: Fitting was not successful" return v def getQuasiFreqs(prcntVol): """Returns array of freqs, corresponding to the provided volume expansion""" nPoints = shape(self.__coeffOmega)[0] nModes = shape(self.__coeffOmega)[1] fittedFreqs = zeros(shape=(nPoints, nModes)) for i in range(nPoints): for j in range(nModes): p = self.__coeffOmega[i, j] fittedFreqs[i, j] = p[0] * prcntVol return (fittedFreqs + 1.0) * self.__omega0 def getFittedFreqs(prcntVol): nPoints = shape(self.__coeffOmega)[0] nModes = shape(self.__coeffOmega)[1] fittedFreqs = zeros(shape=(nPoints, nModes)) for i in range(nPoints): for j in range(nModes): p = self.__coeffOmega[i, j] fittedFreqs[i, j] = fitFunc(p, prcntVol) return (fittedFreqs + 1.0) * self.__omega0 def loadPhonons(self): fname = self.__modePrefix + str(self.__indexRange[0]) + '.modes' Pol, Omega, qPoints = self.qecalc.getMultiPhonon(fname) self.__volOmega = zeros(shape=(len(self.__indexRange), shape(Omega)[0], shape(Omega)[1])) self.__volPol = zeros(shape=(len(self.__indexRange), shape(Pol)[0], shape(Pol)[1], shape(Pol)[2], shape(Pol)[3])) self.__volPol[0] = Pol self.__volOmega[0] = Omega for i in range(1, len(indexRange)): fname = self.__modePrefix + str(self.__indexRange[i]) + '.modes' Pol, Omega, qPoints = self.qecalc.getMultiPhonon(fname) self.__volPol[i] = Pol self.__volOmega[i] = Omega # return volPol, volOmega, qPoints def fitMatdyn(self): # volPol, volOmega, qPoints = loadPhonons(indexRange, prefix) # prcntVol = array(indexRange)/1000.0 # percent change in Omegas relative to equilibrium self.__volPrcntOmega = zeros(shape(self.__volOmega)) # introduce Omega0 to get rid of 0s in denominator Omega0 = copy(self.__volOmega[0]) self.__omega0 = Omega0 for i in range(shape(Omega0)[0]): for j in range(shape(Omega0)[1]): if Omega0[i, j] == 0.: Omega0[i, j] = 1 for i in range(len(self.__indexRange)): self.__volPrcntOmega[i] = (self.__volOmega[i] - self.__volOmega[0]) / Omega0 self.__coeffOmega = zeros(shape=(shape(Omega0)[0], shape(Omega0)[1], self.__polyOrder)) nonlinearity = 0 for i in range(shape(Omega0)[0]): for j in range(shape(Omega0)[1]): self.__coeffOmega[i, j] = self.fitOmega(self.__volPrcntOmega[:, i, j]) if self.__polyOrder > 1: nonlinearity = nonlinearity + abs(self.__coeffOmega[i, j][1]) # print volPrcntOmega[:,1000,3] # print fitOmega(prcntVol, volPrcntOmega[:,1000,3]) # plot(volPrcntOmega[:,1000,3]) # show() # return prcntVol, coeffOmega, volOmega, nonlinearity def gammaDispersion(self, *pathNPoints): self.qecalc.dispersion.setPath(*pathNPoints) self.qecalc.dispersion.setValues(-self.__coeffOmega[:, :, 0]) self.qecalc.dispersion.plot()
class QuasiHarmonic(): def __init__(self, fname, indexRange, prcntVolume, modePrefix): """indexRange is for files' indexing. prcntVolume - coresponding volume expansions""" self.qecalc = QECalc(fname) self.__modePrefix = modePrefix self.__indexRange = indexRange self.__prcntVolume = prcntVolume if len(indexRange) != len(prcntVolume): raise Exception("QuasiHarmonic dimensions: indexRange != prcntVolume") self.loadPhonons() self.__polyOrder = 1 self.fitMatdyn() def fitFunc(self, p, x): return p[0] * x #+ p[1] * x * x #+ p[2] * x * x * x + p[3] * x * x * x * x def fitOmega(self, prcntOmega): # fitfunc = lambda p, x: p[0] * x + p[1] * x * x errFunc = lambda p, x, y: (y - self.fitFunc(p, x)) # initial parameters: pinit = [prcntOmega[1]/self.__prcntVolume[1]] # pinit = [1,0] v, success = leastsq(errFunc, pinit, args=(self.__prcntVolume, prcntOmega)) if success < 1 or success > 4: print success print prcntOmega print v # assert success != 1, "fitOmega: Fitting was not successful" return v def getQuasiFreqs(prcntVol): """Returns array of freqs, corresponding to the provided volume expansion""" nPoints = shape(self.__coeffOmega)[0] nModes = shape(self.__coeffOmega)[1] fittedFreqs = zeros(shape = (nPoints, nModes) ) for i in range( nPoints ): for j in range( nModes ): p = self.__coeffOmega[i,j] fittedFreqs[i,j] = p[0]*prcntVol return (fittedFreqs+1.0)*self.__omega0 def getFittedFreqs(prcntVol): nPoints = shape(self.__coeffOmega)[0] nModes = shape(self.__coeffOmega)[1] fittedFreqs = zeros(shape = (nPoints, nModes) ) for i in range( nPoints ): for j in range( nModes ): p = self.__coeffOmega[i,j] fittedFreqs[i,j] = fitFunc(p, prcntVol) return (fittedFreqs+1.0)*self.__omega0 def loadPhonons(self): fname = self.__modePrefix + str(self.__indexRange[0]) + '.modes' Pol, Omega, qPoints = self.qecalc.getMultiPhonon(fname) self.__volOmega = zeros(shape=(len(self.__indexRange), shape(Omega)[0], shape(Omega)[1] ) ) self.__volPol = zeros(shape=(len(self.__indexRange), shape(Pol)[0], shape(Pol)[1], shape(Pol)[2], shape(Pol)[3] ) ) self.__volPol[0] = Pol self.__volOmega[0] = Omega for i in range(1,len(indexRange)): fname = self.__modePrefix + str(self.__indexRange[i]) + '.modes' Pol, Omega, qPoints = self.qecalc.getMultiPhonon(fname) self.__volPol[i] = Pol self.__volOmega[i] = Omega # return volPol, volOmega, qPoints def fitMatdyn(self): # volPol, volOmega, qPoints = loadPhonons(indexRange, prefix) # prcntVol = array(indexRange)/1000.0 # percent change in Omegas relative to equilibrium self.__volPrcntOmega = zeros(shape(self.__volOmega)) # introduce Omega0 to get rid of 0s in denominator Omega0 = copy(self.__volOmega[0]) self.__omega0 = Omega0 for i in range(shape(Omega0)[0]): for j in range(shape(Omega0)[1]): if Omega0[i,j] == 0.: Omega0[i, j] = 1 for i in range(len(self.__indexRange)): self.__volPrcntOmega[i] = (self.__volOmega[i] - self.__volOmega[0])/Omega0 self.__coeffOmega = zeros( shape = ( shape(Omega0)[0], shape(Omega0)[1], self.__polyOrder) ) nonlinearity = 0 for i in range( shape(Omega0)[0] ): for j in range( shape(Omega0)[1] ): self.__coeffOmega[i,j] = self.fitOmega(self.__volPrcntOmega[:,i,j]) if self.__polyOrder > 1: nonlinearity = nonlinearity + abs(self.__coeffOmega[i,j][1]) # print volPrcntOmega[:,1000,3] # print fitOmega(prcntVol, volPrcntOmega[:,1000,3]) # plot(volPrcntOmega[:,1000,3]) # show() # return prcntVol, coeffOmega, volOmega, nonlinearity def gammaDispersion(self, *pathNPoints): self.qecalc.dispersion.setPath(*pathNPoints) self.qecalc.dispersion.setValues(-self.__coeffOmega[:,:,0]) self.qecalc.dispersion.plot()
def __init__(self, fname): QECalc.__init__(self, fname)
def __init__(self, fname): QECalc.__init__(self, fname) self.__freqs = None self.__modes = None self.__qpts = None
prcntC = 0.2 # percent of c we want to bracket around it for minima search(does not have to warantee the minima is inside)s brentOut = brent(getHexEnergy, (volume, qe), (c-c*prcntC/100, c+c*prcntC/100), tol = 1.e-7, full_output = 1) print brentOut c = brentOut[0] energy = brentOut[1] a = np.sqrt(volume/c) return a, c/a, energy if __name__ == '__main__': # volPercRange = scipy.linspace(0.1, 3.0, 29) volPercRange = scipy.linspace(0.2, 2.4 , 12) # !!!!!! Make sure you have correct starting scf.in at equilibrium qe = QECalc('config.ini') a0 = qe.structure.lattice.a c0 = qe.structure.lattice.c apar = [a0] c_apar = [c0/a0] # obtain total energy at equilibrium: qe.pwscfLauncher() energy = qe.getTotalEnergy() print volPercRange for volPrcnt in volPercRange: print "Optimizing volume at " + str(volPrcnt) + "% expansion" a, c_a, e = hexVolOpt(a0, c0/a0, volPrcnt) print e, a, c_a apar.append(a) c_apar.append(c_a) energy.append(e)
def __init__(self, filename): QECalc.__init__(self) self.pw = PWTask(filename) self.taskList = [self.pw]
brentOut = brent(getHexEnergy, (volume, qe), (c - c * prcntC / 100, c + c * prcntC / 100), tol=1.e-7, full_output=1) print brentOut c = brentOut[0] energy = brentOut[1] a = np.sqrt(volume / c) return a, c / a, energy if __name__ == '__main__': # volPercRange = scipy.linspace(0.1, 3.0, 29) volPercRange = scipy.linspace(0.2, 2.4, 12) # !!!!!! Make sure you have correct starting scf.in at equilibrium qe = QECalc('config.ini') a0 = qe.structure.lattice.a c0 = qe.structure.lattice.c apar = [a0] c_apar = [c0 / a0] # obtain total energy at equilibrium: qe.pwscfLauncher() energy = qe.getTotalEnergy() print volPercRange for volPrcnt in volPercRange: print "Optimizing volume at " + str(volPrcnt) + "% expansion" a, c_a, e = hexVolOpt(a0, c0 / a0, volPrcnt) print e, a, c_a apar.append(a) c_apar.append(c_a) energy.append(e)
v) + self.fitPhononEnergy.fittedValue(v) def minimizeTotalFreeEnergy(self, minVol, maxVol): import scipy.optimize brentOut=scipy.optimize.brent(self.totalFreeEnergy,(), (minVol, maxVol),\ tol = 1.e-5, full_output = 1) # print '\n\nBrentOut:' # print brentOut optPrcntVolume = brentOut[0] optFreeEnergy = brentOut[1] return optPrcntVolume if __name__ == "__main__": qecalc = QECalc("config.ini") voluPhon = VoluPhon("config.ini", prcntVol) voluPhon.setA(a_range[indexRange], 'polynom', 1, True) c_range = a_range * c_a_range voluPhon.setC(c_range[indexRange], 'polynom', 1, True) # Generate phonon doses from different fc files for i in indexRange: os.system('cp ' + str(i) + '_' + fc_name + ' ' + fc_name) qecalc.matdynLauncher() os.system('cp ' + matdynfldos + ' ' + str(i) + '_' + matdynfldos) #plot free energies: for temperature in temperatures: lines = '' phonon = [] for i, v in zip(indexRange, prcntVol):
# for a, c in zip(aRange, cRange): # varnameValue(task.pwscfInput, 'celldm(1)', a) # varnameValue(task.pwscfInput, 'celldm(2)', a) # varnameValue(task.pwscfInput, 'celldm(3)', c/a) # task.getLauncher() # energies.append(task.getEstimator()) # file = open('energies'+strvolumeExpansion)+'.txt','w') # for a,c, e in zip(aRange, cRange, energies): # print a, c, e if __name__ == '__main__': # volPercRange = scipy.linspace(0.1, 3.0, 29) volPercRange = scipy.linspace(0.2, 1.2, 6) qe = QECalc('config.ini') a0 = qe.structure.lattice.a c0 = qe.structure.lattice.c apar = [] c_apar = [] print volPercRange for volPrcnt in volPercRange: print "Optimizing volume at " + str(volPrcnt) + "% expansion" a, c_a, vol = hexVolOpt(a0, c0 / a0, volPrcnt) print vol, a, c_a apar.append(a) c_apar.append(c_a) print "a:" print apar print "c/a:" print c_apar
def __init__(self, fname): QECalc.__init__(self,fname)
def minimizeTotalFreeEnergy(self,minVol, maxVol): import scipy.optimize brentOut=scipy.optimize.brent(self.totalFreeEnergy,(), (minVol, maxVol),\ tol = 1.e-5, full_output = 1) # print '\n\nBrentOut:' # print brentOut optPrcntVolume = brentOut[0] optFreeEnergy = brentOut[1] return optPrcntVolume if __name__ == "__main__": qecalc = QECalc("config.ini") voluPhon = VoluPhon("config.ini", prcntVol) voluPhon.setA(a_range[indexRange], 'polynom', 1, True) c_range = a_range*c_a_range voluPhon.setC(c_range[indexRange], 'polynom', 1, True) # Generate phonon doses from different fc files # for i in indexRange: # os.system('cp ' + str(i) + '_' + fc_name + ' ' + fc_name) # qecalc.matdynLauncher() # os.system('cp ' + matdynfldos + ' ' + str(i) + '_' + matdynfldos ) #plot free energies: for temperature in temperatures: lines = '' phonon = [] for i,v in zip(indexRange, prcntVol):