def action(index, folder): ax = axs[0] gap= axs[1] from ase.calculators.siesta.import_functions import xv_to_atoms atoms = xv_to_atoms('siesta.XV') import pyramids.plot.PlotUtility as pu pu.plot2DBZ(ax,atoms) pu.plot2DBZ(gap,atoms) eigSteps = dp.getEIGSteps() initStep, finalStep = eigSteps[0],eigSteps[-1] print initStep, finalStep energy = dp.readEigFile('siesta'+str(finalStep)+'.EIG') popStart = dp.readEigFile('siesta'+str(finalStep)+'q.EIG') popEnd = dp.readEigFile('siesta'+str(initStep)+'q.EIG') part = np.abs(popStart - popEnd) plotted = part[:,3] plotted[plotted < 0.1*np.max(plotted)] = 0.0 norm = 100.0 kcoor, kweight = dp.readKpoints() kcoorAll, klistAll = dp.recoverAllKPoints(kcoor,2*np.pi*atoms.get_reciprocal_cell(), repeat = [1,1,0], flatten = False) diffEnergy = energy[:,4] - energy[:,3] outRange = np.ones(diffEnergy.shape)*20 outRange[diffEnergy > 4.5] = 0.0 for k in kcoorAll: ct1 = ax.scatter(k[:,0], k[:,1], norm*plotted, color = colors[index], marker='h', alpha=1.0, lw=0.0) ct2 = gap.scatter(k[:,0], k[:,1], outRange, cmap=cmap, c=diffEnergy, vmin = 1.0, vmax = 5.0, marker='h', alpha=1.0, lw=0.00) ax.scatter([], [], 60, color = colors[index], label=folder, alpha=1.0, lw=0.0) if index ==0 : #plt.colorbar(ct2,ax=ax,extendrect=False) plt.colorbar(ct2,ax=gap,extendrect=False)
def action(index, folder): ax = axs[0] gap = axs[1] from ase.calculators.siesta.import_functions import xv_to_atoms atoms = xv_to_atoms('siesta.XV') import pyramids.plot.PlotUtility as pu pu.plot2DBZ(ax, atoms) pu.plot2DBZ(gap, atoms) eigSteps = dp.getEIGSteps() initStep, finalStep = eigSteps[0], eigSteps[-1] print initStep, finalStep energy = dp.readEigFile('siesta' + str(finalStep) + '.EIG') popStart = dp.readEigFile('siesta' + str(finalStep) + 'q.EIG') popEnd = dp.readEigFile('siesta' + str(initStep) + 'q.EIG') part = np.abs(popStart - popEnd) plotted = part[:, 3] plotted[plotted < 0.1 * np.max(plotted)] = 0.0 norm = 100.0 kcoor, kweight = dp.readKpoints() kcoorAll, klistAll = dp.recoverAllKPoints(kcoor, 2 * np.pi * atoms.get_reciprocal_cell(), repeat=[1, 1, 0], flatten=False) diffEnergy = energy[:, 4] - energy[:, 3] outRange = np.ones(diffEnergy.shape) * 20 outRange[diffEnergy > 4.5] = 0.0 for k in kcoorAll: ct1 = ax.scatter(k[:, 0], k[:, 1], norm * plotted, color=colors[index], marker='h', alpha=1.0, lw=0.0) ct2 = gap.scatter(k[:, 0], k[:, 1], outRange, cmap=cmap, c=diffEnergy, vmin=1.0, vmax=5.0, marker='h', alpha=1.0, lw=0.00) ax.scatter([], [], 60, color=colors[index], label=folder, alpha=1.0, lw=0.0) if index == 0: #plt.colorbar(ct2,ax=ax,extendrect=False) plt.colorbar(ct2, ax=gap, extendrect=False)
def action(index, folder): from ase.calculators.siesta.import_functions import xv_to_atoms atoms = xv_to_atoms('siesta.XV') import pyramids.plot.PlotUtility as pu pu.plot2DBZ(ax,atoms) eigSteps = dp.getEIGSteps() initStep, finalStep = eigSteps[0],eigSteps[-1] #eigenvalue = dp.readEigFile('siesta'+str(finalStep)+'.EIG') part = np.abs(dp.readEigFile('siesta'+str(finalStep)+'q.EIG') - dp.readEigFile('siesta'+str(initStep)+'q.EIG')) norm = 100.0/max(part[:,3]) kcoor, kweight = dp.readKpoints() kcoorAll, klistAll = dp.recoverAllKPoints(kcoor,2*np.pi*atoms.get_reciprocal_cell(),repeat = [1,1,0]) #evolvingBands = range(3,5) ax.scatter(kcoorAll[:,0], kcoorAll[:,1], s=norm*np.abs(part[:,3]),lw=0.0, color= color[index], label=folder)
def plotPart(num): data = [] part = partAll[num] - partAll[0] kcoor, kweight = dp.readKpoints() kall = [kcoor[:, :2] + point for point in points] kall.extend([-kcoor[:, :2] + point for point in points]) for k1 in kall: for k in range(eigen.shape[0]): x = eigen[k, :] data.extend([(k1[k, 0], k1[k, 1], value, part[k, index]) for index, value in enumerate(x) if lb < value < rb and part[k, index] > 3E-6]) if len(data) != 0: data = np.array(data) sc.remove() sc = ax.scatter(data[:, 0], data[:, 1], s=data[:, 3] * 3E3, c=data[:, 2], lw=0.0, cmap='jet')
def action(index, folder): from ase.calculators.siesta.import_functions import xv_to_atoms atoms = xv_to_atoms('siesta.XV') import pyramids.plot.PlotUtility as pu pu.plot2DBZ(ax, atoms) eigSteps = dp.getEIGSteps() initStep, finalStep = eigSteps[0], eigSteps[-1] #eigenvalue = dp.readEigFile('siesta'+str(finalStep)+'.EIG') part = np.abs( dp.readEigFile('siesta' + str(finalStep) + 'q.EIG') - dp.readEigFile('siesta' + str(initStep) + 'q.EIG')) norm = 100.0 / max(part[:, 3]) kcoor, kweight = dp.readKpoints() kcoorAll, klistAll = dp.recoverAllKPoints(kcoor, 2 * np.pi * atoms.get_reciprocal_cell(), repeat=[1, 1, 0]) #evolvingBands = range(3,5) ax.scatter(kcoorAll[:, 0], kcoorAll[:, 1], s=norm * np.abs(part[:, 3]), lw=0.0, color=color[index], label=folder)
import numpy as np from matplotlib import pyplot as plt from matplotlib import animation import pyramids.io.result as dp fig = plt.figure(figsize=(7,7)) ax = fig.add_subplot(111) kcoor, kweight = dp.readKpoints() Berry = dp.getBerry(str(3)) quiverLine = ax.quiver(kcoor[:,0], kcoor[:,1], Berry[:,0],Berry[:,1], units='x',lw=0.5, edgecolors=('k'), headaxislength=5, color='b',zorder=10,pivot='middle',alpha = 0.5) #for step in dp.getBerrySteps(): #Berry = dp.getBerry(str(step)) #print dp.getBerrySteps() def update_quiver(num, quiverLine): """updates the horizontal and vertical vector components by a fixed increment on each frame """ if num not in dp.getBerrySteps(): return Berry = dp.getBerry(str(num)) quiverLine.set_UVC(Berry[:,0],Berry[:,1])
import matplotlib.pyplot as plt import pyramids.io.result as dP import pyramids.plot.setting as ma import pyramids.plot.PlotUtility as pu from ase.dft.kpoints import get_special_points from ase.calculators.siesta.import_functions import xv_to_atoms from ase.lattice import hexagonal #------------------------------------------------------------------------------ kpath = [] cut = [0] atom = xv_to_atoms('siesta.XV') specialKPoints = [r'$M$', r'$\Gamma$', r'$K$', r'$M$'] kpoints, kwgt = dP.readKpoints() nkpts = kpoints.shape[0] for i in range(79, 2, -13): print i kpath.append(i) cut.append(len(kpath)) kpath.append(6) kpath.append(5) for i in range(12, 45, 11): print i kpath.append(i) kpath.append(i - 1) cut.append(len(kpath))
from pyramids.plot.setting import getPropertyFromPosition, setProperty, getColors from pyramids.io.fdf import tdapOptions import pyramids.io.result as dp import matplotlib.pyplot as plt import os import ase from ase.calculators.siesta.import_functions import xv_to_atoms atom_temp = xv_to_atoms('siesta.XV') atoms = ase.atoms.Atoms(symbols=atom_temp.get_chemical_symbols(), positions=atom_temp.get_positions(), cell = atom_temp.get_cell()) reciprocal_vectors = 2*np.pi*atoms.get_reciprocal_cell() kcoor, kweight = dp.readKpoints() import matplotlib.pyplot as plt cut = 1 fig = plt.figure() from mpl_toolkits.mplot3d import Axes3D ax = fig.add_subplot(1,1,1,projection='3d') points=np.array([(reciprocal_vectors[0,0:2]*i+ reciprocal_vectors[1,0:2]*j+ reciprocal_vectors[2,0:2]*k) for i in range(-1,2) for j in range(-1,2) for k in range(-1,2)]) print points[:,0].max(), points[:,0].min() from scipy.spatial import Voronoi, voronoi_plot_2d, convex_hull_plot_2d