def getCutoffValuesAllElements(elementList, dFolderPath): outDict = dict() for ele in elementList: adtPath = os.path.join(dFolderPath, ele + ".adt") cutoffVal = parseTbint.parseAdtFile(adtPath)["orbRadius"] outDict[ele] = cutoffVal return outDict
def createZrAngMomShellIndices(): dft2ModelAbs = modInp.getAbsolutePathForPlatoTightBindingDataSet(dft2Model) dft2AdtPath = os.path.join(dft2ModelAbs, "Zr.adt") shellToAngMomDict = parseTbint.parseAdtFile(dft2AdtPath)["shellToAngMom"] angMomIndices = list() for key in range(len(shellToAngMomDict.keys())): angMomIndices.append( shellToAngMomDict[key] ) return angMomIndices
def createShellMapperFromAdtFile(inpFile): angMomToLabel = {0:"s", 1:"p", 2:"d"} parsedFile = parseTbint.parseAdtFile(inpFile) shellToAngMomMap = parsedFile["shellToAngMom"] shellOrder = list() for key in sorted(shellToAngMomMap.keys()): currShellAngMom = shellToAngMomMap[key] currShellLabel = angMomToLabel[currShellAngMom] shellOrder.append( currShellLabel ) outObj = ShellMapper.fromShellOrderings(shellOrder) return outObj
def getTbintHoppingListStructFormat(tbintPath, intType="hopping", convToEv=False): allInts = parseTbint.getIntegralsFromBdt(tbintPath) adtPaths = parseTbint.getAdtFilePathsFromBdt(tbintPath) shellsA, shellsB = parseTbint.parseAdtFile( adtPaths[0])["numbShells"], parseTbint.parseAdtFile( adtPaths[1])["numbShells"] intTypesToConvToEv = [ "hopping", "HopXcContrib", ] if convToEv and (intType not in intTypesToConvToEv): raise AttributeError( "{} is an invalid integral type to convert to electron volts". format(intType)) #Put all the info in the required structure (TODO: extract this method somehow w/strat patt.) allBondTypes = ["sigma", "pi", "delta"] outLists = list() for shellAIdx in range(shellsA): currListA = list() for shellBIdx in range(shellsB): currDict = dict() for bondType in allBondTypes: currDict[bondType] = getTbintIntegralTableFromObjDict( allInts, shellAIdx, shellBIdx, bondType, intType=intType) if (intType in intTypesToConvToEv) and (convToEv) and ( currDict[bondType] is not None): currDict[bondType][:, 1] *= uConvs.RYD_TO_EV currListA.append(currDict) outLists.append(currListA) return outLists
def testParseAdtFile(self): expectedshellIdxToAngMom = {0: 0, 1: 1} expectedVals = { "symbol": "Mg", "coreCharge": 2, "numbShells": 2, "numbOrbitals": 4, "orbRadius": 7.5, "atomEnergy": -1.090379, "shellToAngMom": expectedshellIdxToAngMom } inpAdtFile = "Mg.adt" actualVals = tCode.parseAdtFile(inpAdtFile) for key in expectedVals: #NOTE: This tests for actual equality first; hence will only throw # an error related to type (e.g. not a float) if that initial test fails self.assertAlmostEqual(expectedVals[key], actualVals[key])