def _createPlatoFilesOneStrainPattern(
        targFolder: "str, folder path", strainedStructs: "list of ucell objs",
        pattIdx: "int, idx for naming files", strainCoeffs: list,
        optStrDict: "plato option dict, with all except geom fields defined"):

    #1 create folder + sort out all the file paths
    baseFileFmt = "calc_elastic_{}_{}.in"
    pathlib.Path(targFolder).mkdir(parents=True, exist_ok=True)
    basePath = os.path.abspath(os.path.join(targFolder, baseFileFmt))

    #Create the files
    outObjs = list()
    for currStrain, currStruct in it.zip_longest(strainCoeffs,
                                                 strainedStructs):
        currDict = copy.deepcopy(
            optStrDict
        )  #V.likely overkill, since i only mod geom-fields which should be absent anyway
        geomSection = platoInp.getPlatoGeomDictFromUnitCell(currStruct)
        currDict.update(geomSection)
        strainStr = "{:.4f}".format(currStrain).replace(".", "pt").replace(
            "-", "m")
        currPath = basePath.format(pattIdx, strainStr)
        platoInp.writePlatoOutFileFromDict(currPath, currDict)
        outObjs.append(ElasticCalcObj(currStrain, pattIdx, currPath))

    return outObjs
 def _writeInterFile(self):
     outPath = self._inpFilePathDict["inter"]
     geomSection = modInp.getPlatoGeomDictFromUnitCell(
         self._interstitStruct)
     strDict = self._strOptDict
     strDict.update(geomSection)
     modInp.writePlatoOutFileFromDict(outPath, strDict)
 def writeFile(self):
     pathlib.Path(self.startFolder).mkdir(exist_ok=True, parents=True)
     geomStrDict = platoInp.getPlatoGeomDictFromUnitCell(self.uCellGeom)
     outStrDict = copy.deepcopy(
         self.strDict
     )  #Probably overkill, since dict should ONLY contain strings
     outStrDict.update(geomStrDict)
     platoInp.writePlatoOutFileFromDict(self.inpPath, outStrDict)
예제 #4
0
 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 getStrDictWithStruct(self, struct: "ucell obj"):
     strDict = self.getStrDictFromOptDict(self.optDict)
     geomDict = platoInp.getPlatoGeomDictFromUnitCell(struct)
     strDict.update(geomDict)
     return strDict
예제 #8
0
 def testForGeomA(self):
     actDict = tCode.getPlatoGeomDictFromUnitCell(self.testUCellA)
     self.assertEqual(self.expDictA, actDict)