def create_valid_lists(list):
    point_monomer = {}
    monomer_list = []
    position_set = set()

    for line in list:
        type = line[0]
        ll = np.array(line[1:]) * scale

        position = tuple(ll)

        m = DummyMonomer(position, type, Lattice.get_neighbours(tuple(position)))

        point_monomer[position] = m
        monomer_list.append(m)
        position_set.add(position)

    return point_monomer, monomer_list, position_set
def process(file, step=None, output_file=None):

    if isinstance(file, str):
        f = open(file)
    else:
        f = file
    try:
        line = f.readlines()
        nr = int(line[0].replace("\n", ""))
    except:
        print line
        sys.exit(1)

    data = np.loadtxt(file, dtype=str, skiprows=1)

    # data = f.readlines()[1:]

    point_monomer = {}
    monomer_list = []
    position_set = set()

    if parser.scale == -1 and "." in data[0]:
        print "Atom position are float, please set -scale parameter to rescale them!"
        sys.exit(1)

    for line in data:
        # tmp = line.replace("\n","").split(" ")
        type = line[0]
        ll = map(float, line[1:])

        x = int(ll[0] * scale)
        y = int(ll[1] * scale)
        z = int(ll[2] * scale)

        position = (x, y, z)

        m = DummyMonomer(position, type, Lattice.get_neighbours(tuple(position)))

        point_monomer[position] = m
        monomer_list.append(m)
        position_set.add(position)

    return point_monomer, monomer_list, position_set