Example #1
0
    def genPart2D(self, partName, geometry, sliceName=None, material=None,
                  objType=None, domainType=None, boundaryConditions=None,
                  descriptors=None, bandOffset=None, surfaceChargeDensity=None,
                  bulkDoping=None, subtractList=None):
        '''Generate a 2D slice part and add it to the modelDict.
            
            sliceName: simulation slice that the part belongs to.

        '''
        twoDParts = self.modelDict['slices']
        # Establish the index of the current slice:
        if sliceName is None:
            sliceName = '0'
            if len(twoDParts) > 1 or len(twoDParts) == 1 and sliceName not in twoDParts:
                raise RuntimeError('sliceName cannot be unspecified if there are several slices')
        if sliceName not in twoDParts:
            twoDParts[sliceName] = {'sliceInfo': {'sliceName': sliceName}, 'parts': {}}
        sliceParts = twoDParts[sliceName]['parts']
        # Load in materials if we need them...
        matLib = qmt.Materials()
        slicePart = {}
        # Set material:
        if material is None:
            slicePart['material'] = None
        elif material not in self.modelDict['materials']:
            # The material needs to be generated (it's probably an alloy)
            self.modelDict['materials'][material] = matLib[material].serializeDict()
            slicePart['material'] = material
        else:
            slicePart['material'] = material
        # Set object type:
        if objType not in ['background', 'domain', 'boundary', None]:
            raise ValueError('objType not in list of known types.')
        else:
            slicePart['type'] = objType
        # Set domainType:
        if domainType not in ['semiconductor', 'metalFloating', 'metalGate', 'virtual',
                              'dielectric', None]:
            raise ValueError('domainType not in list of known types.')
        else:
            slicePart['domainType'] = domainType
        # Set band offset
        if bandOffset is not None:
            slicePart['bandOffset'] = bandOffset
        if surfaceChargeDensity is not None:
            slicePart['surfaceChargeDensity'] = surfaceChargeDensity
        if bulkDoping is not None:
            slicePart['bulkDoping'] = bulkDoping
        if subtractList is None:
            subtractList = []
        slicePart['subtractList'] = subtractList
        # Set boundary condition:
        slicePart['boundaryCondition'] = boundaryConditions
        # Set descriptors, used for misc., non-standard properties
        slicePart['descriptors'] = descriptors
        slicePart['geometry'] = geometry
        sliceParts[partName] = slicePart
        self.modelDict['buildOrder'][len(self.modelDict['buildOrder'])] = partName
Example #2
0
 def getSimZero(self, parts=None):
     """Retrieve the zero level for the electric potential [in Volts]."""
     zeroLevelPart, zeroLevelProp = self.modelDict['comsolInfo'][
         'zeroLevel']
     if zeroLevelPart is None:
         return 0.0
     matLib = qmt.Materials(matDict=self.modelDict['materials'])
     parts = parts or self.modelDict['3DParts']
     zeroLevelMatName = parts[zeroLevelPart]['material']
     mat_dict = matLib.find(zeroLevelMatName, eunit='eV')
     return mat_dict[zeroLevelProp]
Example #3
0
pythonPath = 'PATH_TO_QMT_ENV/envs/qmt/python'
jdkPath = 'PATH_TO_JDK/jdk1.8.0_144'

numParallelJobs = 2

####################
####################

# Make the model file. This is a json file that handles all of the inter-module
# communication and also serves as a record regarding what has been run.
modelPath = os.path.join(rootPath, 'model.json')
runModel = qmt.Model(modelPath=modelPath)
runModel.modelDict = runModel.genEmptyModelDict()

# Import the materials we need:
matLib = qmt.Materials()
runModel.modelDict['materials'] = matLib.serializeDict()

# Tell FreeCAD what to do with the names we passed in. All the units here are in microns.
# The simplest type of object directive is an extrude, which just takes one 2D
# shape and makes it into a 3D prism.
runModel.addPart('substrate', 'Rectangle', 'extrude', 'dielectric',
                 material='GaAs', z0=(-0.5 - 0.004 - 0.005),
                 thickness=0.5, meshMaxSize=0.1)
runModel.addPart('backBarrier', 'Rectangle', 'extrude', 'dielectric',
                 material='GaAs', z0=(- 0.004 - 0.005),
                 thickness=0.004, meshMaxSize=0.02)
runModel.addPart('quantumWell', 'Rectangle', 'extrude', 'semiconductor',
                 material='InAs', z0=(- 0.005),
                 thickness=0.005, meshMaxSize=0.02)
runModel.addPart('topBarrier', 'Rectangle', 'extrude', 'dielectric',