示例#1
0
symbols = coords.get_chemical_symbols()
ox_coords = []

for i, atom in enumerate(coords):
    if symbols[i] == species:
        ox_coords.append(scaled_coords[i])
grid_position = np.zeros(shape=(3))
potentials_list = []
i = 0
num_bins = 20
for coord in ox_coords:
    i = i + 1
    grid_position[0] = coord[0]
    grid_position[1] = coord[1]
    grid_position[2] = coord[2]
    cube = sample_cube  # The size of the cube x,y,z in units of grid resolution.
    origin = [grid_position[0] - 2, grid_position[1] - 2, grid_position[2] - 1]
    travelled = [0, 0, 0]  # Should be left as it is.
    cube_potential, cube_var = pot.cube_potential(origin, travelled, cube,
                                                  grid_pot, NGX, NGY, NGZ)
    potentials_list.append(cube_potential)
n, bins, patches = plt.hist(potentials_list,
                            num_bins,
                            normed=100,
                            facecolor='#6400E1',
                            alpha=0.5)
plt.xlabel('Hartree potential (V)', fontsize=22)
plt.ylabel('% of centres', fontsize=22)
plt.savefig('Potentials.png', dpi=300)
plt.show()
示例#2
0
from ase.io import write  # Only add this if want to read in coordinates
from ase.io import vasp   # Only add this if want to read in coordinates

coords = ase.io.vasp.read_vasp(coordinate_file)
scaled_coords = coords.get_scaled_positions()
ox_coords = []
i = -1
for atom in coords:
    i = i + 1
    if atom.get_symbol() == species:
        ox_coords.append(scaled_coords[i])
grid_position = np.zeros(shape=(3))
potentials_list = []
i = 0
num_bins = 20
for coord in ox_coords:
    i = i + 1
    grid_position[0] = coord[0]
    grid_position[1] = coord[1]
    grid_position[2] = coord[2]
    cube = sample_cube    # The size of the cube x,y,z in units of grid resolution.
    origin = [grid_position[0]-2,grid_position[1]-2,grid_position[2]-1]
    travelled = [0,0,0] # Should be left as it is.
    cube_potential, cube_var = pot.cube_potential(origin,travelled,cube,grid_pot,NGX,NGY,NGZ)
    potentials_list.append(cube_potential)
n, bins, patches = plt.hist(potentials_list, num_bins,normed=100, facecolor='#6400E1', alpha=0.5)
plt.xlabel('Hartree potential (V)',fontsize = 22)
plt.ylabel('% of O centres',fontsize = 22)
plt.savefig('Potentials.png',dpi=300)
plt.show()