top_Atoms = u.selectAtoms(top_selQry); top_Res = top_Atoms.resnames(); top_IDs = top_Atoms.resids(); if len(top_Res) > 0: top_flag = top_flag + 1; for i in range(len(top_Res)): top_Qry = 'resname {} and resid {} and ({})'.format(top_Res[i], top_IDs[i], selQry); #print "\t-top_Qry: {}".format(top_Qry); Tsel = u.selectAtoms(top_Qry); COM = Tsel.centerOfMass(); # finding associated BIN # location of X x = COM[0]; y = COM[1]; #print "### TOP leaflet [{}]###".format(num_frm); #print "\tCOM: x={}, y={}".format(x,y); tmp = stanalyzer.count_intervals2(x, BIN_X); loc_x = tmp.index(1); tmp = stanalyzer.count_intervals2(y, BIN_Y); loc_y = tmp.index(1); # count the frequency bin_idx = loc_x * len(BIN_Y) + loc_y; tmp_topDNST[bin_idx][2] = tmp_topDNST[bin_idx][2] + 1.0; #print "\tBIN: x={}, y={}, freq={}".format(BIN_top[bin_idx][0], BIN_top[bin_idx][1], tmp_topDNST[bin_idx][2]); ###################### #----> bottom leaflet ###################### btm_Atoms = u.selectAtoms(btm_selQry); btm_Res = btm_Atoms.resnames(); btm_IDs = btm_Atoms.resids(); if len(btm_Res) > 0: btm_flag = btm_flag + 1;
else: adjY = top_tCRDs[j,1] + csize_y; # adjusting Z axis if (top_tCRDs[j,2] >= a_mid_z): adjZ = top_tCRDs[j,2] - csize_z; else: adjZ = top_tCRDs[j,2] + csize_z; tmpCRDs = np.array([adjX, adjY, adjZ]); dist1 = np.sqrt(np.sum((top_sCRDs[i] - top_tCRDs[j]) ** 2)); dist2 = np.sqrt(np.sum((top_sCRDs[i] - tmpCRDs) ** 2)); dist = min([dist1, dist2]); tmp = np.array(stanalyzer.count_intervals2(dist, BIN)); tmp_topDNST = tmp_topDNST + tmp; if btm_flag == 2: #print "---> bottom leaflet calculation" for i in range(len(btm_sCRDs)): for j in range(len(btm_tCRDs)): # adjusting X axis if (btm_tCRDs[j,0] >= a_mid_x): adjX = btm_tCRDs[j,0] - csize_x; else: adjX = btm_tCRDs[j,0] + csize_x; # adjusting Y axis if (btm_tCRDs[j,1] >= a_mid_y): adjY = btm_tCRDs[j,1] - csize_y;
# adjusting Z axis if (top_tCRDs[j, 2] >= a_mid_z): adjZ = top_tCRDs[j, 2] - csize_z else: adjZ = top_tCRDs[j, 2] + csize_z tmpCRDs = np.array([adjX, adjY, adjZ]) dist1 = np.sqrt( np.sum((top_sCRDs[i] - top_tCRDs[j])**2)) dist2 = np.sqrt( np.sum((top_sCRDs[i] - tmpCRDs)**2)) dist = min([dist1, dist2]) tmp = np.array( stanalyzer.count_intervals2(dist, BIN)) tmp_topDNST = tmp_topDNST + tmp if btm_flag == 2: #print "---> bottom leaflet calculation" for i in range(len(btm_sCRDs)): for j in range(len(btm_tCRDs)): # adjusting X axis if (btm_tCRDs[j, 0] >= a_mid_x): adjX = btm_tCRDs[j, 0] - csize_x else: adjX = btm_tCRDs[j, 0] + csize_x # adjusting Y axis if (btm_tCRDs[j, 1] >= a_mid_y): adjY = btm_tCRDs[j, 1] - csize_y