def read_xyz(filename, noHydrogens):
    """
    Reads an xyz file into lists
    filename - name of xyz file
    noHydrogens - if true, hydrogens are ignored; if not, hydrogens are included

    Returns a tuple (a, b)
        where a is a list of coordinate labels and b is a set of coordinates
    (i.e) a = ["O", "H", "H"], b = [[x0,y0,z0],[x1,y1,z1],[x2,y2,z2]]
    """
    with open(filename, "r") as xyz:
        num_atoms = int(xyz.readline().strip())
        xyz.readline()

        unsorted_labels = []
        unsorted_coords = []
        for _ in range(num_atoms):
            line = xyz.readline().strip().split()
            if noHydrogens and line[0].upper().startswith("H") :
                continue
            else:
                unsorted_labels.append(line[0].upper())
                unsorted_coords.append([float(line[1]), float(line[2]), float(line[3])])
    NA = len(unsorted_labels)
    return unsorted_labels, unsorted_coords, NA