Example #1
0
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

Example #2
0
    ifile = open(fileInString, 'r')
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