示例#1
0
 def avgchrg(self, inpfname):
     """
     Read charge from PW output file, compute the average z-charge
     The most cost routine in the Class
     """
     chrgdata = PlotIORead(inpfname, "ang")
     slabchrg = ChrgAvgZ(chrgdata.ary3d, chrgdata.cell)
     avgchrg = slabchrg.xyavg()  # *slabchrg.xyarea()
     return avgchrg
示例#2
0
 def __init__(self, slabdict):
     """
     Example input `slabdict` structure:
     { 'elem':'Au', 'ort':'111', 'bands':[60,35], 'flds':[0.0, 0.1] },
     """
     self.elem = slabdict["elem"]
     self.ort = slabdict["ort"]
     self.bands = slabdict["bands"]
     self.flds = slabdict["flds"]
     self.shift = slabdict["shift"]
     self.slablmt = slabdict["slablmt"]
     # get info from 0-field charge output
     inpf = self.inpfname(self.bands[0], 0.0)
     slabinit = PlotIORead(inpf, "ang")
     self.cell = slabinit.cell
     slabinfo = ChrgAvgZ(slabinit.ary3d, slabinit.cell)
     atom_coord = slabinit.atom_coord
     self.xyarea = slabinfo.xyarea()
     # z-shift dependent variables
     self.zatom = slabinfo.zatompos(atom_coord)
     self.zaxis = slabinfo.zgrid()
     # get 0-field averaged z-charge densities
     self.chrgz = [self.get_chrgz(0.0)]