本文整理匯總了Python中Translator.Translator.cifToAtomAndCoordinateList方法的典型用法代碼示例。如果您正苦於以下問題:Python Translator.cifToAtomAndCoordinateList方法的具體用法?Python Translator.cifToAtomAndCoordinateList怎麽用?Python Translator.cifToAtomAndCoordinateList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Translator.Translator
的用法示例。
在下文中一共展示了Translator.cifToAtomAndCoordinateList方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: error
# 需要導入模塊: from Translator import Translator [as 別名]
# 或者: from Translator.Translator import cifToAtomAndCoordinateList [as 別名]
except IOError, (errno, strerror):
print "I/O error(%s): %s" % (errno, strerror)
string = ifile.readlines()
cell_params = []
cell_dict = {}
for parser in cell_parsers:
for data, dataStart, dataEnd in parser.scanString(string):
cell_params.append(data[1])
cell_dict[data[0]]=data[1]
ifile.close()
### end of fix
t=Translator()
t.filenameIn = fileInString
ciflist = t.cifToAtomAndCoordinateList()
cellvectors = MInv(cell_params)
uc = UnitCell(cellvectors)
for item in ciflist:
X = item[0]
pos = [float(x) for x in item[1:4]]
uc.addAtom(Atom(symbol=X), pos, "")
# Note: this only works if elements' symbols in CIF are "Ab" format