def filter_atoms(fhandle, atomname_set):
    """Removes specific atoms that do not match a given atom name.
    """
    records = 'ATOM', 'HETATM', 'ANISOU'
    for line in fhandle:
        if line.startswith(records):
            if line[12:16].strip() not in atomname_set:
                continue
        yield line
