filtering = filtering + " or (" + element + ")"
    except NameError:
        if len(conditions) > 1:
            element = "(" + element + ")"
        filtering = element
if asa == True:
    import asa_config
    import asa_module
    atoms = asa_module.generate_atom_list(mol)
    areas_dict = asa_module.calculate_asa(atoms, asa_config.distance)
    scale_dict = asa_module.normalize_areas(areas_dict)
elif asa == False:
    scale_dict = None

(mol, z_1, z_2) = apply_main(mol, filtering, f_structure_a_n,
                             my_normalized_hydrophobicies, mem_window,
                             scale_dict, solvation, max_it)

mem1 = dummy_leaflet(pmin, pmax, z_1)
mem2 = dummy_leaflet(pmin, pmax, z_2)
allmol = mol.copy()
allmol.append(mem1)
allmol.append(mem2)
allmol.center()
if opm_molecule_path != None:
    opm = Molecule(opm_molecule_path)
    opm.center()
    if superpose != True:
        opm.moveBy([50, 0, 0])
    allmol.append(opm)
allmol.reps.add(sel='protein', style='NewCartoon')
    try:
        filtering = filtering + " or (" + element + ")"
    except NameError:
        if len(conditions) > 1:
            element = "(" + element + ")"
        filtering = element
if asa == True:
    import asa_config
    import asa_module
    atoms = asa_module.generate_atom_list(mol)
    areas_dict = asa_module.calculate_asa(atoms, asa_config.distance)
    scale_dict = asa_module.normalize_areas(areas_dict)
elif asa == False:
    scale_dict = None

(mol, z_1, z_2) = apply_main(mol, filtering, f_structure_a_n, my_normalized_hydrophobicies, mem_window, scale_dict, solvation, max_it, 0)

mem1 = dummy_leaflet(pmin,pmax,z_1)
mem2 = dummy_leaflet(pmin,pmax,z_2)
allmol=mol.copy()
allmol.append(mem1)
allmol.append(mem2)
allmol.center()
if opm_molecule_path != None:
    opm=Molecule(opm_molecule_path)
    opm.center()
    if superpose != True:
        opm.moveBy([50,0,0])
    allmol.append(opm)
allmol.reps.add(sel='protein', style='NewCartoon')
allmol.reps.add(sel='resname DUM', style='Licorice')