##------------------------------------------------------------------ ##------------------------------------------------------------------ ##------------------------------------------------------------------ ## Plotting the average in a moving cube along a vector ##------------------------------------------------------------------ ## cube defines the size of the cube in units of mesh points (NGX/Y/Z) cube = [2,2,2] ## vector is the vector you wish to travel along vector = [1,1,0] ## cube defines the origin of the line in units of mesh points (NGX/Y/Z) origin = [0.5,0,0.5] ## magnitude defines the length of the line, in units of mesh points (NGX/Y/Z) magnitude = 280 ## IF YOU WANT TO PLOT THE POTENTIAL: cubes_potential = pot.cuboid_average(grid_pot,cube,origin,vector,NGX,NGY,NGZ,magnitude) abscissa = pot.vector_2_abscissa(vector,magnitude,resolution_x,resolution_y,resolution_z) plt.plot(abscissa, cubes_potential) plt.xlabel("$z (\AA)$") plt.ylabel("Potential (eV)") #plt.show() #fp = open('ElectricPotential.dat','w') #np.savetxt(fp,cubes_potential) ## IF YOU WANT TO PLOT THE FIELD MAGNITUDE ALSO: ## Get the gradients (of the field, if required) grad_mag = pot.gradient_magnitude(grad_x,grad_y,grad_z) cubes_field = pot.cuboid_average(grad_mag,cube,origin,vector,NGX,NGY,NGZ,magnitude) abscissa = pot.vector_2_abscissa(vector,magnitude,resolution_x,resolution_y,resolution_z) plt.plot(abscissa, cubes_field) plt.xlabel("$z (\AA)$")
##------------------------------------------------------------------ ##------------------------------------------------------------------ ##------------------------------------------------------------------ ## Plotting the average in a moving cube along a vector ##------------------------------------------------------------------ ## cube defines the size of the cube in units of mesh points (NGX/Y/Z) cube = [2, 2, 2] ## vector is the vector you wish to travel along vector = [1, 1, 0] ## cube defines the origin of the line in units of mesh points (NGX/Y/Z) origin = [0.5, 0, 0.5] ## magnitude defines the length of the line, in units of mesh points (NGX/Y/Z) magnitude = 280 ## IF YOU WANT TO PLOT THE POTENTIAL: cubes_potential = pot.cuboid_average(grid_pot, cube, origin, vector, NGX, NGY, NGZ, magnitude) abscissa = pot.vector_2_abscissa(vector, magnitude, resolution_x, resolution_y, resolution_z) plt.plot(abscissa, cubes_potential) plt.xlabel("$z (\AA)$") plt.ylabel("Potential (eV)") #plt.show() #fp = open('ElectricPotential.dat','w') #np.savetxt(fp,cubes_potential) ## IF YOU WANT TO PLOT THE FIELD MAGNITUDE ALSO: ## Get the gradients (of the field, if required) grad_mag = pot.gradient_magnitude(grad_x, grad_y, grad_z) cubes_field = pot.cuboid_average(grad_mag, cube, origin, vector, NGX, NGY, NGZ, magnitude) abscissa = pot.vector_2_abscissa(vector, magnitude, resolution_x, resolution_y,