Ejemplo n.º 1
0
 def time_optimize_cutoff(self, sparse, pbc):
     """Benchmark optimize_cutoff for test lipid
     membrane system using default network distance
     range.
     """
     leaflet.optimize_cutoff(universe=self.u,
                             select=self.headgroup_sel,
                             pbc=pbc,
                             sparse=sparse)
Ejemplo n.º 2
0
def test_optimize_cutoff(universe, lipid_heads):
    cutoff, N = optimize_cutoff(universe, lipid_heads, pbc=True)
    assert N == 2
    assert_almost_equal(cutoff, 10.5, decimal=4)
Ejemplo n.º 3
0
    for i in list(lipidTypeDic.values()):
        defFlipFlopHeadgroups += i.getNoneLeafletSelection(syst)

    #LOGGER.info('FlipFlopHeadgroups = {}'.format(defFlipFlopHeadgroups))

    # --------------------------------------------------------------------------
    # Define top/bottom leaflets

    # Get beads that define the bilayer leaflets
    # (not in bilayer middle, but closly packed, use linker + first tail bead of lipids that do not flip-flop)
    defHeadgroups = MDAnalysis.core.groups.AtomGroup([], syst)
    for i in list(lipidTypeDic.values()):
        defHeadgroups += i.getLeafletSelection(syst)

    # get leaflets
    rcutoff, n = optimize_cutoff(syst, defHeadgroups)
    lfls = LeafletFinder(syst, defHeadgroups, cutoff=rcutoff, pbc=True)

    grps = lfls.groups()

    if len(grps) == 2:
        LOGGER.info('Found {} leaflet groups'.format(len(grps)))

    # check if they're even
    top_head = grps[0]
    bot_head = grps[1]

    rt = float(len(top_head)) / len(bot_head)
    if rt > 1.3 or rt < 0.77:
        raise ValueError('Found uneven leaflets. top = {}, bot = {}'.format(
            len(top_head), len(bot_head)))
Ejemplo n.º 4
0
 def test_optimize_cutoff(self):
     from MDAnalysis.analysis.leaflet import optimize_cutoff
     cutoff, N = optimize_cutoff(self.universe, self.lipid_heads, pbc=True)
     assert_equal(N, 2)
     assert_almost_equal(cutoff, 10.5, decimal=4)
Ejemplo n.º 5
0
        structure = args[0]
    except IndexError:
        raise ValueError("Need structure file (pdb, gro, ...) as input")

    if not os.path.exists(structure):
        raise IOError(errno.ENOENT, "Structure file not found", structure)

    if not options.topology:
        options.topology = structure

    u = MDAnalysis.Universe(options.topology, structure)

    if options.optimize:
        print "# Finding best cutoff (--optimize)..."
        try:
            cutoff, N = optimize_cutoff(u, options.selection, pbc=options.pbc,
                                        max_imbalance=options.max_imbalance)
        except:
            raise RuntimeError("Failed cutoff optimization, try without --optimize")
        print "# Optimized cutoff=%(cutoff).1f A, finding %(N)d disconnected groups" % vars()
    else:
        cutoff = options.cutoff
        print "# Using fixed cutoff=%(cutoff).1f A" % vars()

    LF = LeafletFinder(u, options.selection, cutoff=cutoff, pbc=options.pbc)
    p = get_membrane_parameters(u, LF)

    # show results
    print "#" + 60 * "="
    print "thickness tmem = %(thickness).2f A" % p
    print "center    zmem = %(zmem).2f A" % p
    print "#" + 60 * "="
Ejemplo n.º 6
0
    except IndexError:
        raise ValueError("Need structure file (pdb, gro, ...) as input")

    if not os.path.exists(structure):
        raise IOError(errno.ENOENT, "PQR file not found", structure)

    if not options.topology:
        options.topology = structure

    u = MDAnalysis.Universe(options.topology, structure)

    if options.optimize:
        print "# Finding best cutoff (--optimize)..."
        try:
            cutoff, N = optimize_cutoff(u,
                                        options.selection,
                                        pbc=options.pbc,
                                        max_imbalance=options.max_imbalance)
        except:
            raise RuntimeError(
                "Failed cutoff optimization, try without --optimize")
        print "# Optimized cutoff={cutoff:.1f} A, finding {N:d} disconnected groups".format(
            **vars())
    else:
        cutoff = options.cutoff
        print "# Using fixed cutoff={cutoff:.1f} A".format(**vars())

    LF = LeafletFinder(u, options.selection, cutoff=cutoff, pbc=options.pbc)

    print "# group sizes = {0!r} ".format(LF.sizes())

    # two leaflets
Ejemplo n.º 7
0
 def estimate_bilayerDist(self):
     try: 
         self.bilayerDist = optimize_cutoff(self.universe, self.phosphates)
     except IndexError:
         print "Unable to determine cutoff value. Skipping sample %s" % self.name