from qecalc.qetask.pwtask import PWTask pw = PWTask('config.ini') pw.output.parse() energy = pw.output.property('total energy') print 'energy: ', energy print 'all properties: ', pw.output.properties() pw.setting.pwscfOutput = 'scf.full.out' pw.output.parse() energy = pw.output.property('total energy', withUnits=True) stress = pw.output.property('stress') print 'energy: ', energy print 'stress: ', stress print 'all properties: ', pw.output.properties()
# (C) 2010 All Rights Reserved # # File coded by: Nikolay Markovskiy # # See AUTHORS.txt for a list of people who contributed. # See LICENSE.txt for license information. # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ from qecalc.qetask.matdyntask import MatdynTask from qecalc.qetask.pwtask import PWTask from qeutils.phdos import PhononDOS if __name__ == "__main__": matdyn = MatdynTask(configString="") pw = PWTask(configString="") pw.syncSetting() dos = PhononDOS(matdynTask=matdyn, structure=pw.input.structure) # grid has to be huge since a simple histogramming will be used qgrid = [64, 64, 64] # generate qpoints and launch matdyn task dos.launch(nqpoints=qgrid, partialDOS=True) # this line is required if matdyn.modes exisits from previoius run and # dos.launch() is commented out #dos.loadPhonons() #dos.DOS() # partDOS will calculate DOS for each atomic site. It will also generate
'args' is a tuple with volume and task name Volume value should be directly related to lattice constants: E.g.: Vhex = a^2*c omitting all the constant factors """ volume = args[0] return self._relax(a=numpy.sqrt(volume / c), c=c) def _relax(self, ibrav = None, a = None, b = None, c = None, \ cosBC = None ,cosAC = None, cosAB = None): """ Runs geometry relaxation with given lattice parameters. Modifies structure and returns total energy """ if ibrav == None: ibrav = self.pw.input.structure.lattice.ibrav self.pw.input.structure.lattice.setLattice(ibrav = ibrav, a = a, b = b,\ c = c, cBC = cosBC, cAC = cosAC, cAB = cosAB) self.pw.input.save() self.pw.launch() self.pw.input.structure.read(filename=self.pw.setting.get('pwOutput'), format='pwoutput') self.pw.input.save() return self.pw.output.property('total energy')[0] if __name__ == '__main__': volPercRange = [0.4] #, 0.8, 1.2, 1.6, 2.0, 2.4, 2.8, 3.2, 3.6, 4.0] VolumeOptimizer(pwTask=PWTask('config.ini')).launch( volPercRange=volPercRange)
def _getHexEnergy(self, c, *args ): """ Total energy launcher for scipy "brent" routine 'args' is a tuple with volume and task name Volume value should be directly related to lattice constants: E.g.: Vhex = a^2*c omitting all the constant factors """ volume = args[0] return self._relax(a = numpy.sqrt(volume/c), c = c) def _relax(self, ibrav = None, a = None, b = None, c = None, \ cosBC = None ,cosAC = None, cosAB = None): """ Runs geometry relaxation with given lattice parameters. Modifies structure and returns total energy """ if ibrav == None: ibrav = self.pw.input.structure.lattice.ibrav self.pw.input.structure.lattice.setLattice(ibrav = ibrav, a = a, b = b,\ c = c, cBC = cosBC, cAC = cosAC, cAB = cosAB) self.pw.input.structure.save() self.pw.launch() self.pw.input.structure.parseOutput(self.pw.setting.get('pwOutput')) self.pw.input.structure.save() return self.pw.output.property('total energy')[0] if __name__ == '__main__': volPercRange = [ 0.4 ] #, 0.8, 1.2, 1.6, 2.0, 2.4, 2.8, 3.2, 3.6, 4.0] VolumeOptimizer(pwTask = PWTask('config.ini')).launch( volPercRange = volPercRange )
# See LICENSE.txt for license information. # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ from qecalc.qetask.pwtask import PWTask configString = """ [Launcher] #paraPrefix: mpiexec -n 2 #paraPostfix: -npool 2 outdir: temp/ """ if __name__ == "__main__": pw = PWTask(configString=configString) lat_params = [7.5, 7.6, 7.7] for a in lat_params: # whole lattice and structure will be auto updated on change in 'a' according # to the lattice symmetry (ibrav): pw.input.structure.lattice.a = a pw.input.save() pw.launch() print 'Stress = ', pw.output.property('stress') ecut_wfc_list = [15.5, 16, 17.5] for ecut_wfc in ecut_wfc_list: # if the variable did not exist, it will be created, othervise overwritten pw.input.namelist('system').add('ecutwfc', ecut_wfc) pw.input.save() pw.launch()
from qeutils import kmesh from qeutils.bandstobxsf import bandstobxsf configString = """ [pw.x] pwInput: scf.in pwOutput: scf.out [matdyn.x] matdynInput: matdyn.in matdynOutput: matdyn.out """ matdyn = MatdynTask(configString = configString) pw = PWTask(configString = configString) pw.input.parse() matdyn.input.parse() qmesh = [17,17,17] qpoints = kmesh.kMeshCart(qmesh,pw.input.structure.lattice.reciprocalBase()) matdyn.input.qpoints.set(qpoints) matdyn.input.save() matdyn.launch() #matdyn.syncSetting() #matdyn.output.parse()
# See LICENSE.txt for license information. # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ from qecalc.qetask.pwtask import PWTask configString = """ [Launcher] #paraPrefix: mpiexec -n 2 #paraPostfix: -npool 2 outdir: temp/ """ if __name__ == "__main__": pw = PWTask(configString = configString) lat_params = [7.5, 7.6, 7.7] for a in lat_params: # whole lattice and structure will be auto updated on change in 'a' according # to the lattice symmetry (ibrav): pw.input.structure.lattice.a = a pw.input.save() pw.launch() print 'Stress = ', pw.output.property('stress') ecut_wfc_list = [15.5, 16, 17.5] for ecut_wfc in ecut_wfc_list: # if the variable did not exist, it will be created, othervise overwritten pw.input.namelist('system').add('ecutwfc', ecut_wfc) pw.input.save() pw.launch()
# (C) 2010 All Rights Reserved # # File coded by: Nikolay Markovskiy # # See AUTHORS.txt for a list of people who contributed. # See LICENSE.txt for license information. # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ from qecalc.qetask.matdyntask import MatdynTask from qecalc.qetask.pwtask import PWTask from qeutils.phdos import PhononDOS if __name__ == "__main__": matdyn = MatdynTask(configString = "") pw = PWTask(configString = "") pw.syncSetting() dos = PhononDOS(matdynTask = matdyn, structure = pw.input.structure) # grid has to be huge since a simple histogramming will be used qgrid = [64, 64, 64] # generate qpoints and launch matdyn task dos.launch(nqpoints = qgrid, partialDOS = True ) # this line is required if matdyn.modes exisits from previoius run and # dos.launch() is commented out #dos.loadPhonons() #dos.DOS() # partDOS will calculate DOS for each atomic site. It will also generate
# See LICENSE.txt for license information. # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ from qecalc.qetask.pwtask import PWTask configString = """ [Launcher] paraPrefix: mpiexec -n 8 paraPostfix: -npool 8 outdir: temp/ """ if __name__ == "__main__": pw = PWTask(configString = configString) #parse inputs and sync with Settings: pw.syncSetting() lat_params = [5.5, 5.6, 5.7] for a in lat_params: # whole lattice and structure will be auto updated on change in 'a' according # to the lattice symmetry (ibrav): pw.input.structure.lattice.a = a # changes in structure should be propagated into the parsing object: pw.input.structure.updatePWInput() pw.input.save() # or just use pw.input.structure.save() pw.launch() print 'Stress = ', pw.output.property('stress') ecut_wfc_list = [15, 16, 17.5]
# See LICENSE.txt for license information. # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ from qecalc.qetask.pwtask import PWTask configString = """ [Launcher] #paraPrefix: mpiexec -n 2 #paraPostfix: -npool 2 outdir: temp/ """ if __name__ == "__main__": pw = PWTask(configString=configString) #parse inputs and sync with Settings: pw.syncSetting() lat_params = [7.5, 7.6, 7.7] for a in lat_params: # whole lattice and structure will be auto updated on change in 'a' according # to the lattice symmetry (ibrav): pw.input.structure.lattice.a = a pw.input.save() pw.launch() print 'Stress = ', pw.output.property('stress') ecut_wfc_list = [15.5, 16, 17.5] for ecut_wfc in ecut_wfc_list: # if the variable did not exist, it will be created, othervise overwritten pw.input.namelist('system').add('ecutwfc', ecut_wfc)
def _taskFactory(self): config = "[pw.x]\npwInput: %s\npwOutput: %s" % (self._inputFile, self._outputFile) return PWTask(configString=config)