Func_pyrough module
- Func_pyrough.G_hex(latt_param, latt_param_z)
Generate the direct metric tensor for Miller-Bravais indices for hcp structure
- Parameters:
latt_param – lattice parameter along a
latt_param_z – lattice parameter along c
- Returns:
The direct metric tensor
- Func_pyrough.Vector4to3(orien)
Convert a 4-indices vector into a normalized 3-indices vector
- Parameters:
orien (array) – [h,k,l,m] vector
- Returns:
an
- Func_pyrough.align_poly(vertices, angles)
Aligns the first facet with x-axis
- Parameters:
vertices (array) – List of nodes
angles (array) – List of angles
- Returns:
Rotated nodes
- Func_pyrough.base(radius, nfaces)
Creates the base of the faceted wire from radius and number of faces.
- Parameters:
radius (float) – Radius of the wire
nfaces (int) – Number of faces
- Returns:
Points forming the base of the wire and angles associated to each face
- Func_pyrough.box(width, length, height, ns)
Creates the box mesh
- Parameters:
width (float) – Width of the box
length (float) – Length of the box
height (float) – Height of the box
ns (float) – Mesh size
- Returns:
vertices and faces of box mesh
- Func_pyrough.cart2cyl(matrix)
Calculates cylindrical coordinates from cartesian ones.
- Parameters:
matrix (array) – List of cartesian coordinates
- Returns:
Cylindrical coordinates
- Func_pyrough.center_3d_dataset(dataset)
- Parameters:
dataset (array) – Array of positions
- Returns:
Centered position dataset
- Func_pyrough.concatenate_list_data(a_list)
Combines the elements of a list into one element in the form of a string.
- Parameters:
a_list (list) – List with elements of type int
- Returns:
A string
- Func_pyrough.convert_in_list_of_string(lattice_parameter)
Rewrite the json lattice_parameter in the correct format i.e., a list of string
- Parameters:
lattice_parameter (float or list of floats) – input from the json file
- Returns:
lattice_parameter (list of strings)
- Func_pyrough.coord_cart_sphere(C1, C2, r, vertices, t, z, y, x)
Creates a new matrix with x, y, z in cartesian coordinates
- Parameters:
C1 (float) – Roughness normalization factor
C2 (float) – Roughness normalization factor constant for sphere
r (int) – Roughness height matrix
vertices (array) – List of nodes
t (array) – x y z coordinates
z (array) – z coordinates
y (array) – y coordinates
x (array) – x coordinates
- Returns:
Cartesian coordinates
- Func_pyrough.coord_sphere(vertices)
Creates a matrix with the columns that correspond to the coordinates of either x, y, z and t which contains x y z coordinates in an array
- Parameters:
vertices (array) – List of nodes
- Returns:
Coordinates
- Func_pyrough.cube(length, ns)
Creates cube object mesh
- Parameters:
length (float) – Length of the cube
ns (float) – Mesh size
- Returns:
vertices and faces of cube mesh
- Func_pyrough.cube_faces(length)
Generates the points and faces of a cube
- Parameters:
length (float) – Size of the cube
- Returns:
Points and faces of the cube
- Func_pyrough.cyl2cart(matrix)
Calculates cartesian coordinates from cylindrical ones.
- Parameters:
matrix (array) – List of cylindrical coordinates
- Returns:
Cartesian coordinates
- Func_pyrough.cylinder(length, r, ns)
Creates the mesh of a cylinder
- Parameters:
length (float) – Length of the cylinder
r (float) – Radius of the cylinder
ns (float) – Mesh size
- Returns:
vertices and faces of cylinder mesh
- Func_pyrough.dotprod(orien1, orien2, lattice_parameter) float
Run the dot product between two vectors. Works for cubic and hexagonal basis.
- Parameters:
orien1 (list) – [h,k,l] or [h,k,i,l] vector
orien2 (list) – [h,k,l] or [h,k,i,l] vector
- Returns:
the float result of the dot product
- Func_pyrough.duplicate(side_length, orien, lattice_par, cristallo)
Takes in a length and an crystal orientation to calculate the duplication factor for atomsk.
- Parameters:
side_length (float) – Length of one of the sides of the object
orien (list) – Crystal orientation
lattice_par (string) – Lattice parameter
cristallo – cristal structure
- Returns:
Duplication factor and string of orientations
- Func_pyrough.error_quit(error_mess)
Print error message before quiting the code.
- Parameters:
error_mess (str) – error message
- Returns:
print error and quit
- Func_pyrough.faces_normals(obj_points, obj_faces)
Calculates each face’s normals.
- Parameters:
obj_points (array) – List of points
obj_faces (array) – List of faces
- Returns:
List of normals
- Func_pyrough.make_obj(surfaces, energies, n_at, lattice_structure, lattice_parameter, material, orien_x, orien_z, out_pre)
Creates an OBJ file of a faceted NP. Stores the points and faces from this file.
- Parameters:
surfaces (list) – List of surfaces for Wulff theory
energies (list) – List of energies associated to surfaces for Wulff theory
n_at (int) – Number of atoms
lattice_structure (str) – Atomic structure of the sample
lattice_parameter (float) – Lattice parameter
material (str) – Type of atom
orien_x (list) – Orientation along x-axis
orien_y (list) – Orientation along y-axis
orien_z (list) – Orientation along z-axis
out_pre (str) – Prefix for output files
- Returns:
List of points and faces of OBJ file
- Func_pyrough.make_rough(type_sample, z, nodesurf, vertices, angles)
Applies roughness to the sample.
- Parameters:
type_sample (str) – The type of the sample
z (array) – Surface roughness to apply on the sample
nodesurf (array) – List of nodes to be moved
vertices (array) – Nodes of the sample
angles (array) – List of angles to be followed by roughness (Only in the case of a faceted wire)
- Returns:
Rough sample
- Func_pyrough.make_rough_wulff(vertices, B, C1, RMS, N, M, nodesurf, node_edge, node_corner, list_n)
Applies roughness to the sample in the case of a Wulff-shaped nanoparticle.
- Parameters:
vertices (array) – Nodes of the sample
B (float) – The degree of the roughness
C1 (float) – Roughness normalization factor
RMS (float) – Root Mean Square
N (int) – Scaling cartesian position
M (int) – Scaling cartesian position
nodesurf (array) – List of surface nodes
node_edge (array) – List of nodes located on edges
node_corner (array) – List of nodes located on corners
list_n (list) – List of face’s normals
- Returns:
Rough Wulff sample
- Func_pyrough.needs_triple_correction(orien) bool
Check if a 4-indices hcp orientation vector needs the 1/3 normalization factor.
- Parameters:
orien (array) – orientation vector
- Func_pyrough.node_corner(nodesurf)
From surface nodes, finds all nodes located on edges and corners.
- Parameters:
nodesurf (array) – List of surface nodes
- Returns:
List of nodes located on edges and list of nodes located on corners
- Func_pyrough.node_indexing(vertices)
Creates a column that has an assigned index number for each row in vertices and also the nodenumbers which is an array file from 0 - length of the vertices
- Parameters:
vertices (array) – Vector for the points
- Returns:
Numbered vertices and raw numbers column.
- Func_pyrough.node_surface(sample_type, vertices, nodenumber, points, faces)
Finds the nodes at the surface of the object. These nodes will have the surface roughness applied to it.
- Parameters:
sample_type (str) – The name of the sample
vertices (array) – List of nodes
nodenumber (array) – Number of the corresponding node
points (array) – Polygon shape (Faceted wire case)
faces (array) – Facets list (Wulff case)
- Returns:
Surface nodes
- Func_pyrough.norm(vec, lattparam) float
Returns the norm of a 3- or 4-indices vector vector.
- Parameters:
vec (array) – [h,k,l] or [h,k,i,l] vector
lattparam (array) – lattice parameter(s)
- Returns:
the norm (float) of the vector vec
- Func_pyrough.normalize(surf)
Normalizes the coordinates of points composing the surface.
- Parameters:
surf (array) – List of nodes of the surface
- Returns:
Normalized surface
- Func_pyrough.phi(t, z)
Calculates the arctan2 of an array filled with vector norms and an array filled with z coordinates which are the same size.
- Parameters:
t (array) – Coordinates x y in a list
z (array) – Z coordinates
- Returns:
An array of angles in radians
- Func_pyrough.physical_norm(self, uvtw)
Returns the physically correct length of a crystallographic vector.
- Func_pyrough.poly(length, base_points, ns)
- Parameters:
length (float) – Length of the faceted wire
base_points (list) – Shape of the base
ns (float) – Mesh size
- Returns:
vertices and faces of faceted wire mesh
- Func_pyrough.radius(v)
Calculates the vector norm for the axis 1 of the values in the given array.
- Parameters:
v (array) – The vertices of the sphere
- Returns:
A vector norm
- Func_pyrough.random_numbers(sfrN, sfrM)
Generates the G and U matrices for the mathematical formulation of rough surfaces.
- Parameters:
sfrN (array) – Vector for the N decomposition
sfrM (array) – Vector for the M decomposition
- Returns:
G and U matrices
- Func_pyrough.random_surf2(sample_type, m, n, N, M, B, xv, yv, sfrM, sfrN, C1, RMS, out_pre)
Returns an array with the Z values representing the surface roughness.
- Parameters:
sample_type (str) – The type of the sample
m (array) – Wavenumbers
n (array) – Wavenumbers
N (int) – Scaling cartesian position
M (int) – Scaling cartesian position
B (float) – The degree of the roughness
xv (array) – Unique x coordinate values from the objects vertices
yv (array) – Unique y coordinate values from the objects vertices
sfrN (array) – Vector for the N decomposition
sfrM (array) – Vector for the M decomposition
C1 (float) – Roughness normalization factor
RMS (float) – Root Mean Square
out_pre (str) – Prefix of output files
- Returns:
Surface roughness
- Func_pyrough.rdnsurf(m, n, B, xv, yv, sfrM, sfrN)
Generates random surface roughness that will replace the previous z values in the vertices matrix.
- Parameters:
m (array) – Wavenumber
n (array) – Wavenumber
B (float) – The degree the roughness is dependent on
xv (array) – Unique x coordinate values from the objects vertices
yv (array) – Unique y coordinate values from the objects vertices
sfrM (array) – Matrix of random numbers that range from 1 to 2N
sfrN (array) – Matrix of random numbers that range from 1 to 2N
- Returns:
Roughness height matrix
- Func_pyrough.rdnsurf_2(m, n, B, xv, yv, sfrM, sfrN)
Generates random surface roughness that will replace the previous z values in the vertices matrix.
- Parameters:
m (array) – Wavenumber
n (array) – Wavenumber
B (float) – The degree the roughness is dependent on
xv (array) – Unique x coordinate values from the objects vertices
yv (array) – Unique y coordinate values from the objects vertices
sfrM (array) – Matrix of random numbers that range from 1 to 2N
sfrN (array) – Matrix of random numbers that range from 1 to 2N
- Returns:
Roughness height matrix
- Func_pyrough.read_stl(sample_type, raw_stl, width, length, height, radius, ns, points)
Reads an input stl file or creates a new one if no input
- Parameters:
sample_type (str) – Name of the sample
raw_stl (str) – Name of the input stl file
width (float) – Width of the box
length (float) – Length of the box/wire
height (float) – Height of the box
radius (float) – Radius of the wire/sphere
ns (int) – The number of segments desired
points (list) – List of points constituting the base (in case of faceted wire)
- Returns:
List of points and faces
- Func_pyrough.read_stl_wulff(raw_stl, obj_points, obj_faces, ns)
Reads an input stl file or creates a new one if no input (Wulff case).
- Parameters:
raw_stl (str) – Name of the input stl file
obj_points (list) – List of points from OBJ file
obj_faces (list) – List of faces from OBJ file
ns (float) – Mesh size
- Returns:
List of points and faces
- Func_pyrough.rebox(file_lmp, eps)
Fits the box dimensions to the sample.
- Parameters:
file_lmp (str) – .lmp file containing the atom positions
- Returns:
Reboxed position file
- Func_pyrough.refine_3Dmesh(type_sample, out_pre, ns, alpha, ext_fem)
- Parameters:
type_sample (str) – Type of object
out_pre (str) – Outfit file name
ns (float) – Mesh size
alpha (float) – Refine mesh factor
ext_fem (list) – FEM extensions list
- Returns:
Refined 3D meshs for all required formats
- Func_pyrough.refine_box(out_pre, ns, alpha, angle, ext_fem)
- Parameters:
out_pre (str) – Outfit file name
ns (float) – Mesh size
alpha (float) – Refine mesh factor
angle (float) – Angle value for facets detection
ext_fem (list) – FEM extensions list
- Returns:
Refined box mesh
- Func_pyrough.refine_sphere(out_pre, ns, alpha, angle, ext_fem)
- Parameters:
out_pre (str) – Outfit file name
ns (float) – Mesh size
alpha (float) – Refine mesh factor
angle (float) – Angle value for facets detection
ext_fem (list) – FEM extensions list
- Returns:
Refined sphere mesh
- Func_pyrough.refine_wire(out_pre, ns, alpha, angle, ext_fem)
- Parameters:
out_pre (str) – Outfit file name
ns (float) – Mesh size
alpha (float) – Refine mesh factor
angle (float) – Angle value for facets detection
ext_fem (list) – FEM extensions list
- Returns:
Refined wire mesh
- Func_pyrough.remove_duplicates_2d_ordered(data)
- Parameters:
data (list) – Initial list
- Returns:
List with no duplicates
- Func_pyrough.rho(x, y)
The Pythagorean theorem equation is used to obtain a value for a side of a triangle.
- Parameters:
x (int) – Represents the length of a side in the triangle
y (int) – Represents the length of a side in the triangle
- Returns:
The length of hypotenuse
- Func_pyrough.rms_calc(Z)
Calculates the RMS of a height distribution
- Parameters:
z (array) – height matrix
- Returns:
RMS
- Func_pyrough.rot(surf, n1)
Rotates a surface oriented along n1 axis in order to be oriented along z-axis.
- Parameters:
surf (array) – List of nodes from the surface
n1 (array) – Surface normal
- Returns:
Rotated surface
- Func_pyrough.rot_matrix(n, theta)
Generates the rotation matrix. Initial orientation is n, and the angle of rotation is theta. Final orientation is the z-axis.
- Parameters:
n (list) – Initial orientation
theta (float) – Rotation angle
- Returns:
Rotation matrix
- Func_pyrough.rotate_obj_wulff(obj_points, orien_x, orien_z)
- Parameters:
obj_points (array) – Points describing the facets of the wulff-shape
orien_x (list) – Orientation along x-axis
orien_z (list) – Orientation along z-axis
- Returns:
Points respecting the desired orientation
- Func_pyrough.rough_matrix_sphere(nbPoint, B, thetaa, phii, vert_phi_theta, r)
Creates the displacement values of the nodes on the surface of the sphere
- Parameters:
nbPoint (int) – Number of points on the sphere
B (float) – The degree the roughness is dependent on
thetaa (array) – Arctan2 of x and y coordinates
phii (array) – Arctan2 of vector norms and z coordinates
vert_phi_theta (array) – Array filled with two elements that are the angles corresponding to the position of the node on the sphere.
r (int) – Roughness height matrix
- Returns:
Rough matrix
- Func_pyrough.segment_intersects_plane(S, P, a, b, c, d)
- Parameters:
S (list) – Point defining segment with the origin
P (list) – Plane normal
a (float) – Plane equation (ax + by + cz + d = 0)
b (float) – Plane equation (ax + by + cz + d = 0)
c (float) – Plane equation (ax + by + cz + d = 0)
d (float) – Plane equation (ax + by + cz + d = 0)
- Returns:
Boolean value for plane intersection or not
- Func_pyrough.sphere(r, ns)
- Parameters:
r (float) – Radius of the sphere
ns (float) – Mesh size
- Returns:
vertices and faces of sphere mesh
- Func_pyrough.stat_analysis(z, N, M, C1, B, sample_type, out_pre)
Displays the statistical analysis of the surface roughness generator
- Parameters:
z (float) – Roughness height matrix
N (int) – Scaling cartesian position
M (int) – Scaling cartesian position
C1 (float) – Roughness normalization factor
B (float) – The degree the roughness is dependent on
sample_type (str) – The name of the sample
out_pre (str) – Prefix of output files
- Func_pyrough.stl_file(vertices, faces, out_pre)
Creates an stl file from the vertices and faces of the desired object.
- Parameters:
vertices (array) – The coordinates obtained from the mesh
faces – The faces of the triangles generated from the mesh
out_pre (str) – Prefix of the output files
- Func_pyrough.strain_file1_to_file2(file1, file2)
Strain file1 to match file2 dimensions
- Parameters:
file1
file2
- Returns:
reprocessed file1
- Func_pyrough.test_pyrough_execution(dir)
Check if all .json files in examples/ folder can be computed without error
- Parameters:
dir (str) – examples/ folder
- Func_pyrough.theta(x, y)
Calculates the arctan2 of two given arrays whose size are the same.
- Parameters:
x (array) – x coordinates
y (array) – y coordinates
- Returns:
An array of angles in radians
- Func_pyrough.two_odd_one_even(orien)
Test if 2 indices amongst [h,k,l] are odd
- Parameters:
orien (array) – [h,k,l] vector
- Returns:
True or False
- Func_pyrough.vectors(N, M)
Creates vector of integers between -N and N. Same for M
- Parameters:
N (int) – Scaling cartesian position
M (int) – Scaling cartesian position
- Returns:
2 vectors
- Func_pyrough.vertex_tp(x, y, t, z)
Creates an array filled with two elements that are the angles corresponding to the position of the node on the sphere.
- Parameters:
x (array) – X coordinates
y (array) – Y coordinates
t (array) – x & y coordinates stored in a list
z (array) – Z coordinates
- Returns:
An array with angles as elements
- Func_pyrough.write_stl(filename, vertices, face_list)
Creates an STL file from faces and vertices.
- Parameters:
filename (str) – name of the STL file
vertices (array) – list of vertices
face_list (array) – list of faces
- Func_pyrough.wulff(points, faces, ns)
- Parameters:
points (list) – Vertices of Wulff-shape
faces (list) – Facets of Wulff-shape
ns (float) – Mesh size
- Returns:
vertices and faces of Wulff mesh