def i(): p, zpe, spec, bonds, offd, angs, torp, hbs = read_lib(libfile='ffield') fj = open('ffield.json', 'w') j = {'p': p, 'm': [], 'eb_layer': []} js.dump(j, fj, sort_keys=True, indent=2) fj.close()
def plro(lab='sigma'): p,zpe,spec,bonds,offd,angs,torp,hbs= \ read_lib(libfile='ffield',zpe=False) r = np.arange(0.0001, 3.0, 0.1) ro = np.arange(0.75, 1.85, 0.15) plt.figure() plt.ylabel('Uncorrected ' + lab + 'Bond Order') plt.xlabel(r'$Radius$ $(Angstrom)$') plt.xlim(0, 3.0) plt.ylim(0, 1.01) bd = 'C-C' # for i,bd in enumerate(bonds): b = bd.split('-') bdn = b[0] if b[0] == b[1] else bd for i, rosi in enumerate(ro): b = get_bo(r, rosi=rosi, bo1=p['bo1_' + bd], bo2=p['bo2_' + bd]) plt.plot(r, b, label=r'$r_{sigma}=%f$' % rosi, color=colors[i % len(colors)], linewidth=2, linestyle='--') plt.legend() plt.savefig('bovsro.eps') plt.close()
def plbo3d(lab='sigma'): p,zpe,spec,bonds,offd,angs,torp,hbs= \ read_lib(libfile='ffield',zpe=False) r = np.linspace(0.0001, 3.0, 50) bo2_ = np.linspace(0.001, 18.0, 50) bo1_ = np.linspace(-0.9, -0.0001, 50) bo1_, bo2_ = np.meshgrid(bo1_, bo2_) bd = 'C-C' b = bd.split('-') bdn = b[0] if b[0] == b[1] else bd b = get_bo(r, rosi=p['rosi_' + bdn], bo1=bo1_, bo2=bo2_) fig = plt.figure() ax = Axes3D(fig) # plt.xlabel("Delta'") ax = plt.subplot(111, projection='3d') ax.plot_surface(bo1_, bo2_, b, cmap=plt.get_cmap('rainbow')) ax.contourf(bo1_, bo2_, b, zdir='z', offset=0.0, cmap=plt.get_cmap('rainbow')) plt.savefig('bovsbo23d.eps') plt.close()
def plbo(lab='sigma'): p,zpe,spec,bonds,offd,angs,torp,hbs= \ read_lib(libfile='ffield',zpe=False) r = np.arange(0.0001, 3.0, 0.1) plt.figure() plt.ylabel('Uncorrected ' + lab + 'Bond Order') plt.xlabel(r'$Radius$ $(Angstrom)$') # plt.xlim(0,2.5) # plt.ylim(0,1.01) for i, bd in enumerate(bonds): b = bd.split('-') bdn = b[0] if b[0] == b[1] else bd if lab == 'sigma': bo_ = get_bo(r, rosi=p['rosi_' + bdn], bo1=p['bo1_' + bd], bo2=p['bo2_' + bd]) bo = sigmoid(p['bosiw1_' + bd] * bo_ + p['bosib1_' + bd]) elif lab == 'pi': bo_ = get_bo(r, rosi=p['ropi_' + bdn], bo1=p['bo3_' + bd], bo2=p['bo4_' + bd]) bo = sigmoid(bo_ * p['bopiw1_' + bd] + p['bopib1_' + bd]) elif lab == 'pp': bo_ = get_bo(r, rosi=p['ropp_' + bdn], bo1=p['bo5_' + bd], bo2=p['bo6_' + bd]) bo = sigmoid(bo_ * p['boppw1_' + bd] + p['boppb1_' + bd]) plt.plot(r, bo, label=r'$%s$' % bd, color=colors[i % len(colors)], linewidth=2, linestyle='--') plt.legend() plt.savefig('bo_%s.eps' % lab) plt.close()
def jj(): lf = open('ffield.json', 'r') j = js.load(lf) p_ = j['p'] m_ = j['m'] bo_layer = j['bo_layer'] ea_layer = j['ea_layer'] eb_layer = j['eb_layer'] lf.close() spec, bonds, offd, angs, torp, hbs = init_bonds(p_) p, zpe, spec, bonds, offd, angs, torp, hbs = read_lib(libfile='ffield') system('mv ffield.json ffield_.json') fj = open('ffield.json', 'w') j = { 'p': p, 'm': m_, 'bo_layer': bo_layer, 'ea_layer': ea_layer, 'eb_layer': eb_layer } js.dump(j, fj, sort_keys=True, indent=2) fj.close()
def plf4(): ''' get parameters from ffield ''' p,zpe,spec,bonds,offd,angs,torp,hbs= \ read_lib(libfile='ffield',zpe=False) df4 = np.linspace(-2.500, -1.0, 100) plt.figure() plt.ylabel('f4') plt.xlabel(r'bo - $\Delta$') for i, bd in enumerate(bonds): f4_ = get_f4(boc3=p['boc3_' + bd], boc4=p['boc4_' + bd], D=df4) f4 = sigmoid(p['f4w1_' + bd] * f4_ + p['f4b1_' + bd]) plt.plot(df4, f4, label=r'$%s$' % bd, color=colors[i % len(colors)], linewidth=2, linestyle='--') plt.legend() plt.savefig('f4.eps') plt.close()
def ii(): p, zpe, spec, bonds, offd, angs, torp, hbs = read_lib(libfile='ffield') write_lib(p_, spec, bonds, offd, angs, torp, hbs, libfile='ffield_')
def q(gen='packed.gen'): p, zpe, spec, bonds, offd, angs, torp, hbs = read_lib(libfile='ffield') A = read(gen) q = qeq(p=p, atoms=A) q.calc()