Example #1
0
def test_msd():
    analyzer = ba.BilayerAnalyzer(structure='../pybilt/sample_bilayer/sample_bilayer.psf',
                                  trajectory='../pybilt/sample_bilayer/sample_bilayer_10frames.dcd',
                                  selection="resname POPC DOPE TLCL2")


    analyzer.print_analysis_protocol()

    analyzer.run_analysis()
    msd_dat_a = analyzer.get_analysis_data('msd_1')
    print("MSD from BilayerAnalyzer:")
    print(msd_dat_a)

    u = mda.Universe('../pybilt/sample_bilayer/sample_bilayer.psf', '../pybilt/sample_bilayer/sample_bilayer_10frames.dcd')
    bilayer_sel = u.select_atoms("resname POPC DOPE TLCL2")
    ct = comtraj.COMTraj(u.trajectory,bilayer_sel)
    msd_dat_b = ct.calc_msd()
    print("MSD from COMTraj:")
    print(msd_dat_b)

    print(("BilayerAnalyzer and COMTraj match: {}".format(np.isclose(msd_dat_a, msd_dat_b, rtol=0.001))))

    #redo bilayer_anlayzer calc, but use the iterator looper
    analyzer = ba.BilayerAnalyzer(structure='../pybilt/sample_bilayer/sample_bilayer.psf',
                                  trajectory='../pybilt/sample_bilayer/sample_bilayer_10frames.dcd',
                                  selection="resname POPC DOPE TLCL2")


    analyzer.print_analysis_protocol()
    for _frame in analyzer:
        pass
    msd_dat_c = analyzer.get_analysis_data('msd_1')
    print("MSD from BilayerAnalyzer obtained using iterator:")
    print(msd_dat_c)
    print(("matches first BilayerAnalyzer comp: {}".format(np.isclose(msd_dat_a, msd_dat_b, rtol=0.001))))
def test_lipid_collinearity():
    analyzer = ba.BilayerAnalyzer(
        structure='../pybilt/sample_bilayer/sample_bilayer.psf',
        trajectory='../pybilt/sample_bilayer/sample_bilayer_10frames.dcd',
        selection="resname POPC DOPE TLCL2")

    #remove the default msd analysis
    analyzer.remove_analysis('msd_1')
    analyzer.add_analysis(
        "lipid_collinearity lc leaflet lower resname_1 POPC resname_2 DOPE style order"
    )
    analyzer.adjust_rep_setting(
        'vector_frame', 'ref_atoms', {
            'DOPE': {
                'start': ['C218', 'C318'],
                'end': 'P'
            },
            'POPC': {
                'start': ['C218', 'C316'],
                'end': 'P'
            },
            'TLCL2': {
                'start': ['CA18', 'CB18', 'CC18', 'CD18'],
                'end': ['P1', 'P3']
            }
        })
    analyzer.run_analysis()
    lc_dat = analyzer.get_analysis_data('lc')
    print('Lipid Collinearities (vs time):')
    print(lc_dat)
def test_leaflet_update_interval():
    analyzer = ba.BilayerAnalyzer(
        structure='../pybilt/sample_bilayer/sample_bilayer.psf',
        trajectory='../pybilt/sample_bilayer/sample_bilayer_10frames.dcd',
        selection="resname POPC DOPE TLCL2")

    analyzer.remove_analysis('msd_1')
    analyzer.add_analysis(
        'nnf nnf_a resname_1 DOPE resname_2 POPC leaflet upper n_neighbors 6')
    analyzer.add_analysis(
        'nnf nnf_b resname_1 DOPE resname_2 DOPE leaflet upper n_neighbors 4')
    analyzer.add_analysis(
        'nnf nnf_c resname_1 DOPE resname_2 TLCL2 leaflet upper n_neighbors 8')
    print("Default Rep Settings:")
    analyzer.print_rep_settings()
    analyzer.adjust_rep_setting('leaflets', 'update_interval', 2)
    print("\nAdjusted Rep Settings:")
    analyzer.print_rep_settings()
    analyzer.print_analysis_protocol()

    analyzer.run_analysis()

    print(analyzer.get_analysis_data('nnf_a'))
    print(" ")
    print(analyzer.get_analysis_data('nnf_b'))
    print(" ")
    print(analyzer.get_analysis_data('nnf_c'))
Example #4
0
def test_vector_frame():
    analyzer = ba.BilayerAnalyzer(
        structure='../pybilt/sample_bilayer/sample_bilayer.psf',
        trajectory='../pybilt/sample_bilayer/sample_bilayer_10frames.dcd',
        selection="resname POPC DOPE TLCL2")

    #remove the default msd analysis
    analyzer.remove_analysis('msd_1')
    analyzer.add_analysis("lipid_length ll leaflet upper resname TLCL2")
    analyzer.adjust_rep_setting(
        'vector_frame', 'ref_atoms', {
            'DOPE': {
                'start': ['C218', 'C318'],
                'end': 'P'
            },
            'POPC': {
                'start': ['C218', 'C316'],
                'end': 'P'
            },
            'TLCL2': {
                'start': ['CA18', 'CB18', 'CC18', 'CD18'],
                'end': ['P1', 'P3']
            }
        })
    analyzer.run_analysis()
    ll_dat = analyzer.get_analysis_data('ll')
    print('Lipid Lengths (vs time):')
    print(ll_dat)
Example #5
0
def test_ndcorr():
    analyzer = ba.BilayerAnalyzer(structure='../pybilt/sample_bilayer/sample_bilayer.psf',
                                  trajectory='../pybilt/sample_bilayer/sample_bilayer_10frames.dcd',
                                  selection="resname POPC DOPE TLCL2")
    analyzer.add_analysis('ndcorr ndcorr_a')
    analyzer.remove_analysis('msd_1')
    analyzer.print_analysis_protocol()
    #use the phosphorous atoms instead of full lipid center of mass
    analyzer.run_analysis()
    print((analyzer.get_analysis_data('ndcorr_a')))
Example #6
0
def test_ba_ap_dispveccorravg():
    analyzer = ba.BilayerAnalyzer(structure='../pybilt/sample_bilayer/sample_bilayer.psf',
                                  trajectory='../pybilt/sample_bilayer/sample_bilayer_10frames.dcd',
                                  selection="resname POPC DOPE TLCL2")

    analyzer.remove_analysis('msd_1')
    analyzer.add_analysis('disp_vec_corr_avg disp_vec_corr_avg leaflet upper interval 2')

    analyzer.print_analysis_protocol()

    analyzer.run_analysis()

    print(analyzer.get_analysis_data('disp_vec_corr_avg'))
    return
def test_halperin_nelson():
    analyzer = ba.BilayerAnalyzer(
        structure='../pybilt/sample_bilayer/sample_bilayer.psf',
        trajectory='../pybilt/sample_bilayer/sample_bilayer_10frames.dcd',
        selection="resname POPC DOPE TLCL2")

    analyzer.remove_analysis('msd_1')
    analyzer.add_analysis('halperin_nelson hn leaflet upper')

    analyzer.print_analysis_protocol()

    analyzer.run_analysis()

    print(analyzer.get_analysis_data('hn'))
def test_ba_ap_dispveccorravg():
    analyzer = ba.BilayerAnalyzer(structure='../pybilt/sample_bilayer/sample_bilayer.psf',
                                  trajectory='../pybilt/sample_bilayer/sample_bilayer_10frames.dcd',
                                  selection="resname POPC DOPE TLCL2")

    analyzer.remove_analysis('msd_1')
    analyzer.add_analysis('spatial_velocity_corr spatial_velocity_corr leaflet lower interval 3 n_bins 120 range_outer 60.0 resname_1 POPC resname_2 POPC')

    analyzer.print_analysis_protocol()

    analyzer.run_analysis()

    bins, averages = analyzer.get_analysis_data('spatial_velocity_corr')
    plt.plot(bins, averages)
    #plt.show()
    return
Example #9
0
def test_flip_flop():
    analyzer = ba.BilayerAnalyzer(
        structure='../pybilt/sample_bilayer/sample_bilayer.psf',
        trajectory=
        '../pybilt/sample_bilayer/sample_bilayer_10frames_flipflop.dcd',
        selection="resname POPC DOPE TLCL2")

    analyzer.remove_analysis('msd_1')
    analyzer.add_analysis('flip_flop flip_flop')
    analyzer.print_analysis_protocol()

    analyzer.run_analysis()

    print(analyzer.get_analysis_data('flip_flop'))

    return
Example #10
0
def test_msd_multi():
    analyzer = ba.BilayerAnalyzer(structure='../pybilt/sample_bilayer/sample_bilayer.psf',
                                  trajectory='../pybilt/sample_bilayer/sample_bilayer_10frames.dcd',
                                  selection="resname POPC DOPE TLCL2")


    #analyzer.remove_analysis('msd_1')
    analyzer.add_analysis('msd_multi msd_multi_1 resname all leaflet both n_tau 10 n_sigma 10')
    analyzer.add_analysis('msd_multi msd_multi_2 resname all leaflet both n_tau 3 n_sigma 3')
    analyzer.print_analysis_protocol()

    analyzer.run_analysis()

    print(analyzer.get_analysis_data('msd_multi_1'))
    print(analyzer.get_analysis_data('msd_1'))
    print(analyzer.get_analysis_data('msd_multi_2'))

    return
def test_com_frame_multi_bead():
    analyzer = ba.BilayerAnalyzer(
        structure='../pybilt/sample_bilayer/sample_bilayer.psf',
        trajectory='../pybilt/sample_bilayer/sample_bilayer_10frames.dcd',
        selection="resname POPC DOPE TLCL2")

    analyzer.remove_analysis('msd_1')
    analyzer.rep_settings['com_frame']['name_dict'] = {
        'DOPE': ['C2'],
        'POPC': ['C2'],
        'TLCL2': ['C13', 'C32']
    }
    analyzer.rep_settings['com_frame']['multi_bead'] = True
    analyzer.add_analysis(
        'halperin_nelson halperin_nelson_upper leaflet upper')
    analyzer.run_analysis()
    com_halp = analyzer.get_analysis_data('halperin_nelson_upper')
    nbeads = len(analyzer.reps['com_frame'])
    print(("There are {} COM beads.".format(nbeads)))
    print(com_halp)
Example #12
0
def test_com_frame_sub_selection():
    analyzer = ba.BilayerAnalyzer(
        structure='../pybilt/sample_bilayer/sample_bilayer.psf',
        trajectory='../pybilt/sample_bilayer/sample_bilayer_10frames.dcd',
        selection="resname POPC DOPE TLCL2")

    analyzer.run_analysis()
    com_msd = analyzer.get_analysis_data('msd_1')
    #reset
    analyzer.reset()
    #use the phosphorous atoms instead of full lipid center of mass
    analyzer.rep_settings['com_frame']['name_dict'] = {
        'DOPE': ['P'],
        'POPC': ['P'],
        'TLCL2': ['P1', 'P3']
    }

    analyzer.run_analysis()

    analyzer.get_analysis_data('msd_1')
    phospho_msd = analyzer.get_analysis_data('msd_1')

    #reset
    analyzer.reset()
    #use the phosphorous and nitrogen atoms instead of full lipid center of mass -- TLCL2 has no nitrogen
    analyzer.rep_settings['com_frame']['name_dict'] = {
        'DOPE': ['P', 'N'],
        'POPC': ['P', 'N'],
        'TLCL2': ['P1', 'P3']
    }
    analyzer.run_analysis()
    PN_msd = analyzer.get_analysis_data('msd_1')

    print('Center of Mass MSD:')
    print(com_msd)
    print('Phosphorous MSD:')
    print(phospho_msd)
    print('Phosphorous and Nitrogen MSD:')
    print(PN_msd)
Example #13
0
def test_ba_ap_dv_stm():
    analyzer = ba.BilayerAnalyzer(
        structure='../pybilt/sample_bilayer/sample_bilayer.psf',
        trajectory='../pybilt/sample_bilayer/sample_bilayer_10frames.dcd',
        selection="resname POPC DOPE TLCL2")

    analyzer.remove_analysis('msd_1')
    analyzer.add_analysis(
        'disp_vec disp_vec interval 5 wrapped True leaflet upper scale_to_max True'
    )
    analyzer.add_analysis(
        'disp_vec disp_vec_b interval 1 wrapped True leaflet upper scale_to_max True'
    )

    analyzer.print_analysis_protocol()

    analyzer.run_analysis()

    output = analyzer.get_analysis_data('disp_vec')
    dv_res = output[0]
    pgf.plot_step_vectors(dv_res,
                          save=False,
                          show=False,
                          scaled=True,
                          wrapped=True)
    dv_res = output[len(output) - 1]
    pgf.plot_step_vectors(dv_res,
                          save=False,
                          show=False,
                          scaled=True,
                          wrapped=True)
    output = analyzer.get_analysis_data('disp_vec_b')
    pgf.plot_step_vectors_stroboscopic(output,
                                       index=0,
                                       scaled=True,
                                       wrapped=True,
                                       save=False,
                                       show=False)
Example #14
0
def test_nnf():
    analyzer = ba.BilayerAnalyzer(
        structure='../pybilt/sample_bilayer/sample_bilayer.psf',
        trajectory='../pybilt/sample_bilayer/sample_bilayer_10frames.dcd',
        selection="resname POPC DOPE TLCL2")

    analyzer.remove_analysis('msd_1')
    analyzer.add_analysis(
        'nnf nnf_a resname_1 DOPE resname_2 POPC leaflet upper n_neighbors 6')
    analyzer.add_analysis(
        'nnf nnf_b resname_1 DOPE resname_2 DOPE leaflet upper n_neighbors 4')
    analyzer.add_analysis(
        'nnf nnf_c resname_1 DOPE resname_2 TLCL2 leaflet upper n_neighbors 8')

    analyzer.print_analysis_protocol()

    analyzer.run_analysis()

    print analyzer.get_analysis_data('nnf_a')
    print " "
    print analyzer.get_analysis_data('nnf_b')
    print " "
    print analyzer.get_analysis_data('nnf_c')
Example #15
0
#Same protocol as sample_script_1 without using the input setup file.

import pybilt.bilayer_analyzer.bilayer_analyzer as ba

analyzer = ba.BilayerAnalyzer(
    structure='../../sample_bilayer/sample_bilayer.psf',
    trajectory='../../sample_bilayer/sample_bilayer_10frames.dcd',
    selection='resname POPC DOPE TLCL')
analyzer.add_analysis('msd msd_1')
analyzer.add_analysis('msd msd_2 leaflet upper resname POPC')
analyzer.add_plot('msd msd_p msd_1 DOPE-U msd_2 POPC-U')
analyzer.run_analysis()

analyzer.show_plot('msd_p')
Example #16
0
#Setup using an input file

import pybilt.bilayer_analyzer.bilayer_analyzer as ba

analyzer = ba.BilayerAnalyzer(input_file='../sample_input_script/sample_1.in')

analyzer.run_analysis()

analyzer.show_plot('msd_p')