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
def testModOptsCorrectInOutFile(self): platoCode = "dft2" expModdedOptDict = { "blochstates": [1, 1, 1], "e0method": 1, "xtalxcmethod": -1, "hopxcmethod": -1, "xtalVnaMethod".lower(): 1, "hopVnaMethod".lower(): -1, "xtalVnlMethod".lower(): 1, "hopVNLMethod".lower(): -1 } expModdedOptStrDict = modInp.getStrDictFromOptDict( expModdedOptDict, platoCode) testWorkFlow = tCode.CreateEosWorkFlow( self.structDict, self.modOptDicts, self.workFolder, platoCode, onlyCalcE0=True, nonE0EnergyDict=self.testE1Vals)() inpFilePaths = testWorkFlow._inpFilePaths fullInpDict = modInp.tokenizePlatoInpFile(inpFilePaths[0]) for key in expModdedOptStrDict.keys(): self.assertEqual(expModdedOptStrDict[key], fullInpDict[key])
def _writeFiles(self): inpPaths = self._inpFilePaths for inpPath, struct in it.zip_longest(inpPaths, self.structs): geomSection = modInp.getPlatoGeomDictFromUnitCell(struct) strDict = modInp.getStrDictFromOptDict(self.optDict, self._platoComm) strDict.update(geomSection) modInp.writePlatoOutFileFromDict(inpPath, strDict)
def _writeFiles(self): pathDict = self._inpFilePathsDict for sKey in self.runOptsDicts.keys(): for idx,geom in enumerate(self.structDict[sKey]): currPath = pathDict[sKey][idx] currStrDict = modInp.getStrDictFromOptDict(self.runOptsDicts[sKey], self.platoCodeStr) geomSection = modInp.getPlatoGeomDictFromUnitCell(geom) currStrDict.update(geomSection) modInp.writePlatoOutFileFromDict(currPath,currStrDict)
def _writeInpFiles(self): strDictNoGeom = modInp.getStrDictFromOptDict(self.runOpts, self.platoCodeStr) structDicts = [ modInp.getPlatoGeomDictFromUnitCell(x) for x in self.structList ] for fPath, struct in it.zip_longest(self.inpFilePaths, structDicts): currOutDict = copy.deepcopy(strDictNoGeom) currOutDict.update(struct) modInp.writePlatoOutFileFromDict(fPath, currOutDict)
def _strOptDict(self): return modInp.getStrDictFromOptDict(self._runOptsDict, self._platoComm)
def getPlatoStrDictFromOptDict_tb1OrTb2(inpDict): return platoInp.getStrDictFromOptDict(inpDict, "dft2")
def getPlatoStrDictFromOptDict_dft(optDict): return platoInp.getStrDictFromOptDict(optDict,"dft")