pyprocar.core package

Submodules

pyprocar.core.dos module

Created on Wed Aug 19 20:49:03 2020

@author: Pedram Tavadze, Logan Lang

class pyprocar.core.dos.DensityOfStates(energies=None, total=None, projected=None, interpolation_factor=None)[source]

Bases: object

Methods

dos_sum([atoms, principal_q_numbers, …])

dos_sum(atoms=None, principal_q_numbers=[- 1], orbitals=None, spins=None)[source]
Parameters
  • atoms (list int, optional) – list of atom index needed to be sumed over. count from zero with the same order as input. The default is None.

  • principal_q_numbers (list int, optional) – list of . The default is [-1].

  • orbitals (TYPE, optional) – DESCRIPTION. The default is None.

  • spins (TYPE, optional) – DESCRIPTION. The default is None.

Returns

ret – .

Return type

list float

pyprocar.core.dos.interpolate(x, y, factor=2)[source]

Interplates the function y=f(x) by increasing the x points by the factor.

Parameters
  • x (list float) – points of x.

  • y (list float) – points of y=f(x).

  • factor (int, optional) – Multiplies the number of x points by this factor. The default is 2.

Returns

  • xs (list float) – points in which y was interpolated.

  • ys (list float) – interpolated points.

pyprocar.core.elements module

pyprocar.core.elements.atomic_mass(element)[source]

Given a element symbol or element atomic number returns atomic mass.

Parameters

element (int,str) – atomic symbol or atomic number.

Returns

atomic mass.

Return type

float

pyprocar.core.elements.atomic_number(element)[source]

Given element symbol returns atomic number.

Parameters

element (str) – Atomic symbol.

Returns

Atomic number.

Return type

int

pyprocar.core.elements.atomic_symbol(atomic_number)[source]

Given atomic number returns atomic symbol.

Parameters

atomic_number (int) – Atomic number.

Returns

Atomic symbol.

Return type

str

pyprocar.core.isosurface module

class pyprocar.core.isosurface.Isosurface(XYZ=None, V=None, isovalue=None, V_matrix=None, algorithm='lewiner', interpolation_factor=1, padding=None, transform_matrix=None, boundaries=None, file=None)[source]

Bases: pyprocar.core.surface.Surface

Attributes
X

Returns ——- TYPE numpy array DESCRIPTION.

Y

Returns ——- TYPE numpy array DESCRIPTION.

Z

Returns ——- TYPE numpy array DESCRIPTION.

center_of_mass

Center of mass of the vertices.

centers

Centers of faces Returns ——- centers : list of floats (n,3) A list of centers of faces.

dxyz

Returns ——- list DESCRIPTION.

nX

Returns ——- TYPE int DESCRIPTION.

nY

Returns ——- TYPE int DESCRIPTION.

nZ

Returns ——- TYPE int DESCRIPTION.

nfaces

Number of faces Returns ——- int Number of faces in the surface.

nverts

Number or vertices.

surface_boundaries

This function tries to find the isosurface using no interpolation to find the

Methods

clip(S1, S2)

This function clips S1 using the boundaries of S2 and returns

export([file_obj, file_type])

This function uses the export function from trimesh

set_color_with_cmap([cmap, vmin, vmax])

Sets colors for the trimesh object using the color map provided

set_scalars(scalars)

Sets/Updates the scalars of the surface.

set_vectors

property X

returns: DESCRIPTION. list of grids in X direction :rtype: TYPE numpy array

property Y

returns: DESCRIPTION. list of grids in Y direction :rtype: TYPE numpy array

property Z

returns: DESCRIPTION. list of grids in Z direction :rtype: TYPE numpy array

clip(S1, S2)[source]

This function clips S1 using the boundaries of S2 and returns

Parameters
  • S1 (TYPE pyprocar surface) – DESCRIPTION.

  • S2 (TYPE pyprocar surface) – DESCRIPTION.

Returns

Return type

verts,faces

property dxyz

returns: DESCRIPTION. length between points in each direction :rtype: list

property nX

returns: DESCRIPTION. number of points in the grid in X direction :rtype: TYPE int

property nY

returns: DESCRIPTION. number of points in the grid in Y direction :rtype: TYPE int

property nZ

returns: DESCRIPTION. number of points in the grid in Z direction :rtype: TYPE int

property surface_boundaries

This function tries to find the isosurface using no interpolation to find the correct positions of the surface to be able to shift to the interpolated one to the correct position

Returns

DESCRIPTION. [(mins[0],maxs[0]),(mins[1],maxs[1]),(mins[2],maxs[2])]

Return type

list of tuples

pyprocar.core.isosurface.fft_interpolate(function, interpolation_factor=2)[source]

if I = interpolation_factor This function withh recieve f(x,y,z) with dimensions of (nx,ny,nz) and returns f(x,y,z) with dimensions of (nx*I,ny*I,nz*I)

pyprocar.core.isosurface.map2matrix(XYZ, V)[source]

mapps an Irregular grid to a regular grid

Parameters
  • XYZ (TYPE) – DESCRIPTION.

  • V (TYPE) – DESCRIPTION.

Returns

mapped_func – DESCRIPTION.

Return type

TYPE

pyprocar.core.structure module

class pyprocar.core.structure.Structure(atoms=None, fractional_coordinates=None, lattice=None)[source]

Bases: object

Attributes
atomic_numbers

List of atomic numbers

density

Density of the cell.

masses

list of masses of each atom.

natoms

Number of atoms

nspecies

Number of species present in the cell.

species

list of different species present in the cell.

volume

Volume of the unit cell.

property atomic_numbers

List of atomic numbers

Returns

List of atomic numbers.

Return type

list

property density

Density of the cell.

Returns

Density of the cell.

Return type

float

property masses

list of masses of each atom.

Returns

Masses of each atom.

Return type

list float

property natoms

Number of atoms

Returns

Number of atoms.

Return type

int

property nspecies

Number of species present in the cell.

Returns

Number of species present in the cell.

Return type

int

property species

list of different species present in the cell.

Returns

List of different species present in the cell.

Return type

list str

property volume

Volume of the unit cell.

Returns

Volume of the unit cell(m).

Return type

float

pyprocar.core.surface module

class pyprocar.core.surface.Surface(verts=None, faces=None, face_normals=None, vert_normals=None, face_colors=None, vert_colors=None, vectors=None, scalars=None)[source]

Bases: object

Surface is a class that holds information about a surface To create a surface the minimum requirements are verts and faces

Parameters
  • verts (list of float (nverts,3)) – The list of verticies that create the surface.

  • faces (list of integers (nfaces,3)) – The default is None. The list of connectivity between verts that create the surface.

  • face_normals (list of float (nfaces,3)) – The list of normal vectors to each face.

  • vert_normals (list of float (nverts,3)) – The list of normal vectors to each vertex.

  • face_colors (list of tuples floats (nfaces,3)) – The list of colors of each face. example:face_colors=[(1,0,0),(1,0.5,0),...,(1,0,0)]

  • vert_colors (list of tuples floats (nfaces,3)) – The list of colors of each vertex.

  • vectors (list of floats (nfaces,3)) – The list of vectors one wants to attach to the surface(glyphs) Only useful in pyvista objects

  • scalars (list of floats (nfaces,)) – The list of scalars for each face. This can represent the color using a color map

Attributes
center_of_mass

Center of mass of the vertices.

centers

Centers of faces Returns ——- centers : list of floats (n,3) A list of centers of faces.

nfaces

Number of faces Returns ——- int Number of faces in the surface.

nverts

Number or vertices.

Methods

export([file_obj, file_type])

This function uses the export function from trimesh

set_color_with_cmap([cmap, vmin, vmax])

Sets colors for the trimesh object using the color map provided

set_scalars(scalars)

Sets/Updates the scalars of the surface.

set_vectors

property center_of_mass

Center of mass of the vertices. :returns: Center of mass of vertices. :rtype: list float

property centers

Centers of faces :returns: centers – A list of centers of faces. :rtype: list of floats (n,3)

export(file_obj='output.glb', file_type='glb')[source]

This function uses the export function from trimesh

Parameters
  • file_obj (TYPE, optional) – DESCRIPTION. The default is ‘output.glb’.

  • file_type (TYPE, optional) – DESCRIPTION. The default is ‘glb’.

Returns

Return type

None.

property nfaces

Number of faces :returns: Number of faces in the surface. :rtype: int

property nverts

Number or vertices. :returns: Number of verticies in in the surface. :rtype: int

set_color_with_cmap(cmap='viridis', vmin=None, vmax=None)[source]

Sets colors for the trimesh object using the color map provided

Parameters
  • cmap (TYPE, string) – DESCRIPTION. The default is ‘viridis’.

  • vmin (TYPE, float) – DESCRIPTION. The default is None.

  • vmax (TYPE, optional) – DESCRIPTION. The default is None.

set_scalars(scalars)[source]

Sets/Updates the scalars of the surface. Scalars represent a color using a color map.

Parameters

scalars (list) – Scalars should be the same size as the number of faces.

set_vectors(vectors_X, vectors_Y, vectors_Z)[source]
pyprocar.core.surface.boolean_add(surfaces)[source]

This functtion uses boolean add from PyVista

Parameters

surfaces (TYPE list of pyprocar.Surface) – DESCRIPTION.

Returns

surf – DESCRIPTION. The unionized surface from surfaces

Return type

TYPE pyprocar surface

pyprocar.core.surface.convert_from_pyvista_faces(pyvista_obj)[source]

pyvista mesh faces are written in a 1d array, This function returns faces in a conventional way. A list of lists, where each list contains integers numbers of vert conections

Parameters

pyvista_obj (TYPE PyVista mesh) – DESCRIPTION.

Returns

  • new_faces (TYPE list of lists) – DESCRIPTION. A list of lists, where each list contains integers numbers of

  • vert conections

Module contents