Kc_Kt_moduli.py
def splay_modulus( leaflet, angles_in_radians, area_per_lipid, status,nbins=100, Plot=True):
    
    """ compute the distribution of splay angles using an histogram """
    histo, bins = np.histogram(angles_in_radians, bins= nbins , density=True) #bins=len(angles_first_quadrant)
    bincenters = 0.5 * (bins[1:] + bins[:-1])
    
    if status == "disordered":
        cutoff = 35
        g_range_sa = np.where(bincenters < np.radians(cutoff))[0]
        A, mu, sigma = _FitGaussian(bincenters[g_range_sa], histo[g_range_sa])
        
    else: 
        cutoff = 20
        g_range_sa = np.where(bincenters < np.radians(cutoff))[0]
        A, mu, sigma = _FitGaussian(bincenters[g_range_sa], histo[g_range_sa])
        #plt.plot(bincenters_Lo, _gauss(bincenters_Lo, Ao, muo, sigmao ))
        
    y=np.sin(bincenters)
    Area=trapz(y, bincenters)
    sin_normalized=y/Area
    #plt.plot(bincenters_Ld, sin_normalized)    
    """ normlize the probability with the sin(theta) """
    pa2 = histo / sin_normalized  
    """ PMF in KbT units """
    PMF = -np.log(pa2)
    #plt.plot(bincenters, PMF)


    ranges = [ (max(mu - i * sigma, 0), mu + i * sigma) 
                  for i in [ 1, 1.25, 1.5, 1.75, 2.0]] 
    
    print ("Using the following ranges to fit the PMF:", ranges)
    res_list = [_FitParabole(bincenters, PMF, fitting_range)
                    for fitting_range in ranges]

    K_list = [(2. * r[1])/ area_per_lipid for r in res_list]
    DeltaK = np.std(K_list)
    K = K_list[0]
    
    
    if Plot: 
        fig, ax = plt.subplots(3, 1, sharex=True, sharey=False)
        fig.subplots_adjust(hspace=0.05, wspace=0.05)
        ax[0].fill_between(bincenters, _gauss(bincenters,A, mu, sigma), alpha=0.5)
        ax[0].plot(bincenters, histo)  
        xcoords = [mu - sigma, mu, mu + sigma]
        for xc in xcoords:
            ax[0].axvline(x=xc, linestyle='--')

        ax[1].plot(bincenters, pa2,'-')
        ax[2].plot(bincenters, PMF,'-')
        ax[2].plot(bincenters, _parabole(bincenters, res_list[0][0],res_list[0][1], res_list[0][2] ), 'g--', label =r'$k$ = %3.1f $\pm$  %3.1f [$k_BT$]' %(K,DeltaK ))
        ax[2].grid('True')
        plt.xlim(0,np.pi/2)
        plt.legend()
        plt.savefig('ANALYSIS/tilts_local_normals/Splay_modulus_'+ str(leaflet)+ '_' + str(status) +'.png', dpi=300)
        plt.savefig('ANALYSIS/tilts_local_normals/Splay_modulus_'+ str(leaflet)+ '_' + str(status) +'.svg')
    return K, DeltaK, K_list
 compute the distribution of splay angles using an histogram 
compute the distribution of splay angles using an histogram
compute the distribution of splay angles using an histogram
def splay_modulus( leaflet, angles_in_radians, area_per_lipid, status,nbins=100, Plot=True):
    histo, bins = np.histogram(angles_in_radians, bins= nbins , density=True) 
    bincenters = 0.5 * (bins[1:] + bins[:-1])
    if status == "disordered":
        cutoff = 35
        g_range_sa = np.where(bincenters < np.radians(cutoff))[0]
        A, mu, sigma = _FitGaussian(bincenters[g_range_sa], histo[g_range_sa])
    else: 
        cutoff = 20
        g_range_sa = np.where(bincenters < np.radians(cutoff))[0]
        A, mu, sigma = _FitGaussian(bincenters[g_range_sa], histo[g_range_sa])
    y=np.sin(bincenters)
    Area=trapz(y, bincenters)
    sin_normalized=y/Area
    pa2 = histo / sin_normalized  
    PMF = -np.log(pa2)
    ranges = [ (max(mu - i * sigma, 0), mu + i * sigma) 
                  for i in [ 1, 1.25, 1.5, 1.75, 2.0]] 
    print ("Using the following ranges to fit the PMF:", ranges)
    res_list = [_FitParabole(bincenters, PMF, fitting_range)
                    for fitting_range in ranges]
    K_list = [(2. * r[1])/ area_per_lipid for r in res_list]
    DeltaK = np.std(K_list)
    K = K_list[0]
    if Plot: 
        fig, ax = plt.subplots(3, 1, sharex=True, sharey=False)
        fig.subplots_adjust(hspace=0.05, wspace=0.05)
        ax[0].fill_between(bincenters, _gauss(bincenters,A, mu, sigma), alpha=0.5)
        ax[0].plot(bincenters, histo)  
        xcoords = [mu - sigma, mu, mu + sigma]
        for xc in xcoords:
            ax[0].axvline(x=xc, linestyle='--')
        ax[1].plot(bincenters, pa2,'-')
        ax[2].plot(bincenters, PMF,'-')
        ax[2].plot(bincenters, _parabole(bincenters, res_list[0][0],res_list[0][1], res_list[0][2] ), 'g--', label =r'$k$ = %3.1f $\pm$  %3.1f [$k_BT$]' %(K,DeltaK ))
        ax[2].grid('True')
        plt.xlim(0,np.pi/2)
        plt.legend()
        plt.savefig('ANALYSIS/tilts_local_normals/Splay_modulus_'+ str(leaflet)+ '_' + str(status) +'.png', dpi=300)
        plt.savefig('ANALYSIS/tilts_local_normals/Splay_modulus_'+ str(leaflet)+ '_' + str(status) +'.svg')
    return K, DeltaK, K_list
def splay_modulus ( leaflet , angles_in_radians , area_per_lipid , status , nbins = 100 , Plot = True ) : histo , bins = np . histogram ( angles_in_radians , bins = nbins , density = True ) bincenters = 0.5 * ( bins [ 1 : ] + bins [ : - 1 ] ) if status == "disordered" : cutoff = 35 g_range_sa = np . where ( bincenters < np . radians ( cutoff ) ) [ 0 ] A , mu , sigma = _FitGaussian ( bincenters [ g_range_sa ] , histo [ g_range_sa ] ) else : cutoff = 20 g_range_sa = np . where ( bincenters < np . radians ( cutoff ) ) [ 0 ] A , mu , sigma = _FitGaussian ( bincenters [ g_range_sa ] , histo [ g_range_sa ] ) y = np . sin ( bincenters ) Area = trapz ( y , bincenters ) sin_normalized = y / Area """ normlize the probability with the sin(theta) """ pa2 = histo / sin_normalized """ PMF in KbT units """ PMF = - np . log ( pa2 ) ranges = [ ( max ( mu - i * sigma , 0 ) , mu + i * sigma ) for i in [ 1 , 1.25 , 1.5 , 1.75 , 2.0 ] ] print ( "Using the following ranges to fit the PMF:" , ranges ) res_list = [ _FitParabole ( bincenters , PMF , fitting_range ) for fitting_range in ranges ] K_list = [ ( 2. * r [ 1 ] ) / area_per_lipid for r in res_list ] DeltaK = np . std ( K_list ) K = K_list [ 0 ] if Plot : fig , ax = plt . subplots ( 3 , 1 , sharex = True , sharey = False ) fig . subplots_adjust ( hspace = 0.05 , wspace = 0.05 ) ax [ 0 ] . fill_between ( bincenters , _gauss ( bincenters , A , mu , sigma ) , alpha = 0.5 ) ax [ 0 ] . plot ( bincenters , histo ) xcoords = [ mu - sigma , mu , mu + sigma ] for xc in xcoords : ax [ 0 ] . axvline ( x = xc , linestyle = '--' ) ax [ 1 ] . plot ( bincenters , pa2 , '-' ) ax [ 2 ] . plot ( bincenters , PMF , '-' ) ax [ 2 ] . plot ( bincenters , _parabole ( bincenters , res_list [ 0 ] [ 0 ] , res_list [ 0 ] [ 1 ] , res_list [ 0 ] [ 2 ] ) , 'g--' , label = r'$k$ = %3.1f $\pm$  %3.1f [$k_BT$]' % ( K , DeltaK ) ) ax [ 2 ] . grid ( 'True' ) plt . xlim ( 0 , np . pi / 2 ) plt . legend ( ) plt . savefig ( 'ANALYSIS/tilts_local_normals/Splay_modulus_' + str ( leaflet ) + '_' + str ( status ) + '.png' , dpi = 300 ) plt . savefig ( 'ANALYSIS/tilts_local_normals/Splay_modulus_' + str ( leaflet ) + '_' + str ( status ) + '.svg' ) return K , DeltaK , K_list
compute the distribution of splay angles using an histogram
compute the distribution of splay angles using an histogram
""" compute the distribution of splay angles using an histogram """ #bins=len(angles_first_quadrant) #plt.plot(bincenters_Lo, _gauss(bincenters_Lo, Ao, muo, sigmao )) #plt.plot(bincenters_Ld, sin_normalized)     """ normlize the probability with the sin(theta) """ """ PMF in KbT units """ #plt.plot(bincenters, PMF)
leaflet
angles_in_radians
area_per_lipid
status
nbins
Plot