linecolor2 = ['lightsteelblue', 'lightblue', 'lightskyblue', 'royalblue', 'blue', 'mediumblue', 'darkblue'] #fig, axs = plt.subplots(2, 1, sharex=True) #fig.subplots_adjust(hspace=0) for i in range(len(strtype)): pathstring.append('../alsi/polymer/quenchedpoly/{:s}'.format(str(chargeratio[i])) + '/{:s}/'.format(str(strtype[i]))) plotlines=[] fig = [] for j in range(len(pathstring)): fig.append([]) for p in sorted(Path(str(pathstring[j])).glob('zero/ph*/cylinder_shell.list')): print(p) e = mu.getDistribution(p, 'opt_d gr:3') f = mu.getDistribution(p, 'zden gr:3') if '40n' in p.parts[-4]: labelstring = 'neg, pH = {:d}'.format(int(p.parts[-2][2])) else: labelstring = 'pos, pH = {:d}'.format(int(p.parts[-2][2])) print(p.parts) print(p.parts[-2]) print(p.parts[-2][2]) ph.append(p.parts[-2][2]) e_errdown = e[:,1] - 0.5*e[:,2] e_errup = e[:,1] + 0.5*e[:,2] f_errdown = f[:,1] - 0.5*f[:,2] f_errup = f[:,1] + 0.5*f[:,2]
plot_lines = [] legend1 = [] legend2 = [] fig, axs = plt.subplots(2, 1, sharex=True) # Remove horizontal space between axes fig.subplots_adjust(hspace=0) # Plot each graph, and manually set the y tick values errdown = [] errup = [] for p in sorted( Path('../alsi/polymer/quenchedpoly/0/m40nretry/zero/').glob( 'ph*/cylinder_shell.list')): print(p) d = mu.getDistribution(p, 'rg pa') #e = mu.getDistribution(p, 'ree pa') # labelstring = 'ph = {:d}'.format( int(p.parts[1][2]) ) labelstring = 'neg, pH = {:d}'.format(int(p.parts[-2][2])) print(p.parts) print(p.parts[-2]) print(p.parts[-2][2]) ph.append(p.parts[-2][2]) errdown = np.zeros(len(d)) errup = np.zeros(len(d)) errdown[:] = d[:, 1] - 0.5 * d[:, 2] errup[:] = d[:, 1] + 0.5 * d[:, 2] # m40nree.append(d) # m40nreelabel.append(labelstring)
ax1.plot(ph, alpha_1, marker='o', markersize=10, label='alumina (Al100)')#linestyle='None') ax1.plot(ph, alpha_2, marker='v', markersize=10, label='silica (Si100)') ax1.plot(ph, alpha_al, color='tab:orange', marker='o', markersize=10, label='alumina (Al240)')#linestyle='None') ax1.plot(ph, alpha_si, color='tab:orange', marker='v', markersize=10, label='silica (Si240)') ax1.plot(ph, alpha_al500, linestyle='--', marker='o', markersize=10, label='alumina (Al500)')#linestyle='None') ax1.plot(ph, alpha_si500, linestyle='--', marker='v', markersize=10, label='silica (Si500)') ax1.legend() #fig1.savefig('alumina_silicatitration.pdf') #Extract distributions from .list files and plot them fig2, ax2 = plt.subplots(1,1) for p in sorted(Path('test/').glob('pH*/*.list')): d = mu.getDistribution(p, 'rdf ion-counterion') labelstring = 'pH = {:d}'.format( int(p.parts[1][2]) ) ax2.plot( d[:,0], d[:,1], label=labelstring ) # d[:,0] extracts the first column from d, d[:,1] the second ax2.legend() # Show legend/labels in ax2 ''' Show plots ''' plt.show()
ph = [] linecolor = [ 'wheat', 'gold', 'orange', 'darkorange', 'chocolate', 'sienna', 'saddlebrown' ] linecolor2 = [ 'powderblue', 'lightblue', 'lightskyblue', 'royalblue', 'blue', 'mediumblue', 'darkblue' ] for p in sorted( Path('alsi/polymer/quenchedpoly/m20m10/zero/').glob( 'ph*/cylinder_shell.list')): print(p) d = mu.getDistribution(p, 'ree pa') # labelstring = 'ph = {:d}'.format( int(p.parts[1][2]) ) labelstring = 'ph = {:d}'.format(int(p.parts[-2][2])) print(p.parts) print(p.parts[-2]) print(p.parts[-2][2]) ph.append(p.parts[-2][2]) reetemp = d m40nree.append(d) m40nreelabel.append(labelstring) plt.figure(1) # plt.subplot(211) plt.plot(d[:, 0], d[:, 1], label=labelstring,
rg = [] #linecolor = ['wheat', 'gold', 'orange', 'darkorange', 'chocolate', 'sienna', 'saddlebrown'] #linecolor2 = ['powderblue', 'lightblue', 'lightskyblue', 'royalblue', 'blue', 'mediumblue', 'darkblue'] for i in range(len(strtype)): pathstring.append( 'alsi/polymer/quenchedpoly/{:s}'.format(str(chargeratio[i])) + '/{:s}/'.format(str(strtype[i]))) reesum = pd.DataFrame startcount = 1 for j in range(len(pathstring)): for p in sorted( Path(str(pathstring[j])).glob('zero/ph*/cylinder_shell.list')): print(p) reesingle = mu.getDistribution(p, 'ree pa') rgsingle = mu.getDistribution(p, 'rg pa') #f = mu.getDistribution(p, 'rg pa') labelstring = 'ph = {:d}'.format(int(p.parts[-2][2])) print(p.parts) print(p.parts[-2]) print(p.parts[-2][2]) ph.append(p.parts[-2][2]) ree = pd.DataFrame(reesingle, columns=['Monomer index', 'Prob', 'Err']) ree['pH'] = int(p.parts[-2][2]) ree['Structure'] = str(p.parts[-4]) ree['Polymer type'] = polymer[j] ree['Charge ratio'] = str(p.parts[-5]) ree['Monomer number'] = monomernumber[j]