# 需要导入模块: import locale [as 别名]
# 或者: from locale import atoi [as 别名]
def unpickleVars(pdb2pqrID):
""" Converts instance pickle from PDB2PQR into a dictionary for APBS """
apbsOptions = {}
#pfile = open("/home/samir/public_html/pdb2pqr/tmp/%s-input.p" % pdb2pqrID, 'r')
pfile = open("%s%s%s/%s-input.p" % (INSTALLDIR, TMPDIR, pdb2pqrID, pdb2pqrID), 'r')
inputObj = pickle.load(pfile)
pfile.close()
myElec = inputObj.elecs[0]
apbsOptions['pqrname'] = pdb2pqrID+'.pqr'
apbsOptions['pdbID'] = inputObj.pqrname[:-4]
if myElec.cgcent[0:3] == "mol":
apbsOptions['coarseGridCenterMethod'] = "molecule"
apbsOptions['coarseGridCenterMoleculeID'] = locale.atoi(myElec.cgcent[4:])
else:
apbsOptions['coarseGridCenterMethod'] = "coordinate"
apbsOptions['coarseGridCenter'] = myElec.cgcent
if myElec.fgcent[0:3] == "mol":
apbsOptions['fineGridCenterMethod'] = "molecule"
apbsOptions['fineGridCenterMoleculeID'] = locale.atoi(myElec.fgcent[4:])
else:
apbsOptions['fineGridCenterMethod'] = "coordinate"
apbsOptions['fineGridCenter'] = myElec.fgcent
if myElec.gcent[0:3] == "mol":
apbsOptions['gridCenterMethod'] = "molecule"
apbsOptions['gridCenterMoleculeID'] = locale.atoi(myElec.gcent[4:])
else:
apbsOptions['gridCenterMethod'] = "coordinate"
apbsOptions['gridCenter'] = myElec.gcent
if myElec.lpbe == 1:
apbsOptions['solveType'] = 'linearized'
elif myElec.npbe == 1:
apbsOptions['solveType'] = 'nonlinearized'
if len(myElec.ion) == 0:
apbsOptions['mobileIonSpecies[0]'] = None
else:
apbsOptions['mobileIonSpecies[1]'] = myElec.ion
if len(myElec.write) <= 1:
apbsOptions['format'] = 'dx'
else:
apbsOptions['format'] = myElec.write[1]
apbsOptions['calculationType'] = myElec.method
apbsOptions['dime'] = myElec.dime
apbsOptions['pdime'] = myElec.pdime
apbsOptions['async'] = myElec.async