def createPlatoElasCalcsFileObjs(targFolder: "str, folder path",
                                 startStruct: "UnitCell class obj",
                                 strainParams: list,
                                 inpOptDict: dict,
                                 crystType,
                                 dftFiles=False):

    allStrainedStructs = elastic.getStrainedStructsForElasticConsts(
        startStruct, strainParams, crystType=crystType)

    if dftFiles:
        fileDict = platoInp.getDefOptDict("dft")
    else:
        fileDict = platoInp.getDefOptDict("dft2")

    fileDict.update(
        inpOptDict)  #User options always overwrite the defaults when given

    if dftFiles:
        fileStrDict = platoInp.getStrDictFromOptDict(fileDict, "dft")
    else:
        fileStrDict = platoInp.getStrDictFromOptDict(fileDict, "dft2")

    allOutObjs = list()

    for idx, structSet in enumerate(allStrainedStructs):
        currObjs = _createPlatoFilesOneStrainPattern(targFolder, structSet,
                                                     idx, strainParams,
                                                     fileStrDict)
        allOutObjs.append(currObjs)

    return allOutObjs
Exemple #2
0
 def testExpectedGridOptPresent(self):
     inpParam = 0.4
     basicOptDict = modInp.getDefOptDict("dft")
     self.assertNotAlmostEqual(inpParam,
                               basicOptDict["fftGridSpacing".lower()])
     self.runTestFunct(basicOptDict, inpParam)
     self.assertAlmostEqual(inpParam,
                            basicOptDict["fftGridSpacing".lower()])
 def optDict(self):
     outDict = {
         k.lower(): v
         for k, v in modInp.getDefOptDict(self.platoCode).items()
     }
     wFlowHelpers.modOptDictBasedOnCorrTypeAndPlatoCode(
         outDict, self.varyType, self.platoCode)
     outDict.update(self.modOptsDict)
     return outDict
Exemple #4
0
 def testExpectedGridOptPresent(self):
     inpParam = 40
     basicOptDict = modInp.getDefOptDict("dft2")
     expectedVal = [
         basicOptDict["integralmeshspacing"][0], inpParam, inpParam
     ]
     self.assertTrue(expectedVal != basicOptDict["integralmeshspacing"])
     self.runTestFunct(basicOptDict, inpParam)
     self.assertEqual(expectedVal, basicOptDict["integralmeshspacing"])
	def optDicts(self):
		outDict = dict()
		for key in self.structDict.keys():
			baseDict = {k.lower():v for k,v in modInp.getDefOptDict(self.platoCode).items()}
			currModDict = {k.lower():v for k,v in self.modOptsDict[key].items()}
			self._modDictBasedOnCorrType(currModDict)
			if self.onlyCalcE0:
				self._modDictForE0Only(currModDict)
			baseDict.update(currModDict)
			outDict[key] = baseDict
		return outDict
Exemple #6
0
def _getBaseModOptsDictFromVaryTypeEleConfigAndStructKey(
        varyType, eleConfig, structKey):
    platoCode = eleConfig.getPlatoCodeFromVaryType(varyType)
    kPoints = eleConfig.getDefKPoints(structKey)
    gridParams = eleConfig.getDefaultMeshSpacing(structKey, varyType)
    gridKwarg = eleConfig.getMeshSpacingKwarg(varyType)
    modOptsDict = modInp.getDefOptDict(
        platoCode)  #Need full dict or error thrown by paramToOptDictMapper
    modOptsDict["blochstates"] = kPoints
    modOptsDict[gridKwarg] = gridParams
    return modOptsDict
 def getRunOptsDict(self):
     outDict = modInp.getDefOptDict(self.platoComm)
     outDict.update(self.modOptDict)
     return outDict
Exemple #8
0
def loadDefaultTb2OptDict():
	return platoInp.getDefOptDict("dft2")
Exemple #9
0
def loadDefaultTb1OptDict():
	return platoInp.getDefOptDict("tb1")
def loadDefaultDftOptDict():
	return platoInp.getDefOptDict("dft")
Exemple #11
0
 def testExpectedValsPresent(self):
     inpParam = [5, 5, 4]
     basicOptDict = modInp.getDefOptDict("dft2")
     basicOptDict["BlochStates".lower()] = [3, 2, 1]
     self.runTestFunct(basicOptDict, inpParam)
     self.assertEqual(inpParam, basicOptDict["blochstates"])
Exemple #12
0
 def testRaisesErrorIfGridTypeWrong(self):
     inpParam = 40
     basicOptDict = modInp.getDefOptDict("dft2")
     basicOptDict["integralmeshtype"] = "uniform"
     with self.assertRaises(AssertionError):
         self.runTestFunct(basicOptDict, inpParam)