Example #1
0
    def runStructures(self, structures, path, calcStates=True):
        '''Run simulations for all structures in the given structure list with
        the base path "path". This method dispatches all processes and returns
        the user has to wait for processes to finish before accessing results.

        Stores started processes in self.processes
        '''

        local = Local()
        for ss in structures:
            spath = Path.joinpath(path, str(ss.dirname))
            su.mkdir(spath)
            if calcStates:
                self.initdir(ss, spath)
                #proc = su.dispatch(self.progWS, "",spath)
                proc = self.pltfm.submitjob(self.progWS, [], spath, 1, "00:10")
                self.processes.append(proc)
        if calcStates:
            dbg.debug("Starting calcWS program.....\n",
                      dbg.verb_modes["verbose"], self)
            dbg.flush()
        # TODO do not wait for all processes-start each strucrure when ready!
        self.waitforproc(1)
        dbg.debug("Starting lqcl.....\n", dbg.verb_modes["verbose"], self)
        dbg.flush()
        #del processes
        #processes = []
        for ss in structures:
            spath = Path.joinpath(path, str(ss.dirname))

            proc = self.pltfm.submitjob(self.proglqcl, [],
                                        Path.joinpath(spath, self.datpath))

            self.processes.append(proc)
        return self.processes
Example #2
0
 def initdir(self, ss, path):
     '''Initialize the dierctory for Structure s, with base path "path".'''
     pathdata = Path.joinpath(path, self.datpath)
     pathwannier = Path.joinpath(path, self.wannierpath)
     su.mkdir(pathdata)
     su.mkdir(pathwannier)
     self.writeWannier(ss, pathwannier)
     self.writeMaterial(self.wellmat, "# " + str(self.wellmat.name),
                        pathwannier)
     self.writeNumpar(path)
     self.wellmat.save(path, "wellmaterial")
     ss.save(path)
Example #3
0
    def initdir(self, structure, spath):
        '''Initialize the dierctory for Structure s, with base path "path".'''
        su.mkdir(spath)
        self.writeSampleFile(structure, spath)
        self.writeScriptFile(spath)

        start = self.numpar["efield0"]
        step = self.numpar["defield"]
        stop = step * (self.numpar["Nefield"] - 1) + start

        for i in range(self.numpar["Nefield"]):
            efield = start + step * i
            efield = np.round(efield * 10000) / 10000
            su.mkdir(spath + "/" + str(efield))
Example #4
0
    def gatherResults(self,
                      structures,
                      pathwd,
                      pathresults=None,
                      runprog=True):
        '''Write results to pathresults/results.log and run hdiag and bandplot
        in pathwd/s.dirname/self.datpath/eins/x/ for each i and x. Stores WS
        resutls as a new attribute levels[directory][WS level][data field] in
        each Structure object in the list structures.
        '''

        if (pathresults is None):
            pathresults = pathwd

        with open(pathresults + '/results.log', 'a') as f:
            f.write('# Results for structures:\nID | merit | \
            N times layer width | Ndop times (zi, zf, nvol) | N times x \n')
            for ss in structures:
                spath = Path.joinpath(pathwd, str(ss.dirname))

                ss.merit = self.getMerit(ss, pathwd)

                f.write(str(ss.dirname) + " ")
                f.write(str(ss.merit) + " ")
                for layer in ss.layers:
                    f.write(str(layer.width) + " ")
                for doping in ss.dopings:
                    for val in doping:
                        f.write(str(val) + " ")
                for layer in ss.layers:
                    f.write(str(layer.material.x) + " ")

                f.write("\n")
                if self.merit == self.merits["Chi2"]:
                    su.mkdir(pathresults + ss.dirname)
                    with open(pathresults + ss.dirname + "/chi2.log",
                              'w') as chif:
                        chif.write("Not implemented yet in Ilqcl!")
Example #5
0
from aftershoq.interface import Inextnano
from aftershoq.materials import GaAs, AlGaAs
from aftershoq.numerics.runplatf import Local
from aftershoq.qcls import EV2416
import aftershoq.utils.systemutil as su
import aftershoq.utils.debug as dbg

pathwd = "../demo/NextNano"
su.mkdir(pathwd)

dbg.open(dbg.verb_modes["chatty"], outfile=pathwd + "/debug.log")

nnroot = "C:/Users/Martin Franckie/Documents/nextnanoQCL_2018_03_29/nextnano/2018_03_29/nextnano.QCL/"

lic = nnroot + "../License/License_nnQCL.lic"

model = Inextnano(nnroot, Local(), GaAs(), lic)

s = EV2416()

for l in s.layers:
    if l.material.name == "AlGaAs":
        l.material.name = "Al(x)Ga(1-x)As"
print(s)

model.numpar["efield0"] = 0.050
model.numpar["defield"] = 0.005
model.numpar["Nefield"] = 5
model.numpar["NE"] = 400
model.numpar["Nk"] = 400
model.numpar["Nz"] = 100
Example #6
0
from aftershoq.materials import *
from aftershoq.structure import Sgenerator
from aftershoq.numerics.runplatf import Local
import aftershoq.utils.systemutil as su
import aftershoq.utils.debug as dbg
from aftershoq.interface import Isewself, Inegf
from aftershoq.numerics import Paraopt, Gaussopt
from matplotlib import pyplot as pl
import aftershoq.utils.const as const

if __name__ == '__main__':

    # the working directory:
    path = "/Users/martin/Projects/Optimization/ASQW/ASQWchi2/Mehrans/v3/"
    #path = os.getcwd()+"/"+path
    su.mkdir(path)

    # Setup debugger:
    dbg.open(dbg.verb_modes['verbose'], path + "/debug.log")
    dbg.debug("Debug file \n\n")
    dbg.flush()

    sep = '\n----------------------------------------------\n'

    print('--- Welcome to the "sewself" demonstration of ---\n')
    print('               "AFTERSHOQ" \n\n')
    print('       Written by Martin Franckie 2018.')
    print('       Please give credit where credit')
    print('                   is due\n')
    print(sep)
    print('Creating semiconductor materials and alloys:\n')
Example #7
0
 def initdir(self, structure, spath):
     su.mkdir(spath)
     self.writeParameterFile(spath)
     self.writeSewselfPar(spath)
     self.writeStructFile(structure, spath)
Example #8
0
from aftershoq.structure import Sgenerator, doping_modes as sgdm
from aftershoq.materials import *
from aftershoq.numerics.runplatf import Local
import aftershoq.utils.systemutil as su
import aftershoq.utils.debug as dbg
from aftershoq.interface import Inegf
from aftershoq.numerics import Paraopt, Gaussopt
from matplotlib import pyplot as pl
from aftershoq.qcls import EV2416

if __name__ == '__main__':

    # the working directory:
    path = "../../demo/EV2416/"
    path = os.getcwd() + "/" + path
    su.mkdir(path)

    # results directory:
    pathresults = "../../demo/results/"

    su.mkdir(pathresults)

    # Setup debugger:
    dbg.open(dbg.verb_modes['chatty'], pathresults + "/debug.log")
    dbg.debug("Debug file \n\n")
    dbg.flush()

    sep = '\n----------------------------------------------\n'

    print('--- Welcome to the "NEGF" demonstration of ---\n')
    print('               "AFTERSHOQ" \n\n')