jarvis.analysis.structure.neighbors
¶
This module provides classes to specify atomic structure.
Module Contents¶
Classes¶
Get neighbor informations (RDF,ADF,DDF) for Atoms object. |
Functions¶
|
Check type and shape of np.ndarray. |
|
Multiple dimensional arange. |
|
Calcuate a dictionary of structure data. |
- jarvis.analysis.structure.neighbors.check_array(arr, type_=None, shape=None)[source]¶
Check type and shape of np.ndarray.
Follwing arguments are needed. Args:
x: array to check
type_: the type of the array (int, float), None to not check
- shape: the shape of the array, None to not check, -1 to ignore a
dimension
- jarvis.analysis.structure.neighbors.special_arange(dims)[source]¶
Multiple dimensional arange.
This could be extended to any dimension. Args:
dims: sequence of ints of length 3
- Returns:
an array of shape (np.prod(dims), 3) with each index having a different arrangement of arange.
This function implements the equivalent of a multidimensional for loop, which feels like multidimensional arange (see the test)
>>> dim0, dim1, dim2 = 2, 4, 3 >>> arr_test = np.zeros((dim0 * dim1 * dim2, 3), dtype=int) >>> counter = 0 >>> for i in np.arange(dim0): ... for j in np.arange(dim1): ... for k in np.arange(dim2): ... arr_test[counter, 0] = i ... arr_test[counter, 1] = j ... arr_test[counter, 2] = k ... counter += 1
>>> arr_actual = special_arange((dim0, dim1, dim2)) >>> print(arr_actual) [[0 0 0] [0 0 1] [0 0 2] [0 1 0] [0 1 1] [0 1 2] [0 2 0] [0 2 1] [0 2 2] [0 3 0] [0 3 1] [0 3 2] [1 0 0] [1 0 1] [1 0 2] [1 1 0] [1 1 1] [1 1 2] [1 2 0] [1 2 1] [1 2 2] [1 3 0] [1 3 1] [1 3 2]] >>> assert np.all(arr_actual == arr_test)
- jarvis.analysis.structure.neighbors.calc_structure_data(coords, box, all_symbs, c_size)[source]¶
Calcuate a dictionary of structure data.
Args:
coords: the coordinates for each element
box: the lattic matrix
all_symbs: the elements
c_size: the c size
- Returns:
a set of structure data
>>> coords = np.array([[0, 0, 0], [0.25, 0.2, 0.25]]) >>> lat = [[2.715, 2.715, 0], [0, 2.715, 2.715], [2.715, 0, 2.715]] >>> box = np.array(lat) >>> elements = ["Si", "Si"] >>> c_size = 10.0 >>> data = calc_structure_data(coords, box, elements, c_size) >>> assert len(data['coords']) == 128 >>> assert np.allclose(data['coords'][9], [0. , 0.5 , 0.25 ]) >>> assert np.all(data['dim'] == [4, 4, 4]) >>> assert len(data['new_symbs']) == 128
- class jarvis.analysis.structure.neighbors.NeighborsAnalysis(atoms=None, max_n=500, rcut1=None, max_cut=10.0, rcut2=None, verbose=False)[source]¶
Bases:
object
Get neighbor informations (RDF,ADF,DDF) for Atoms object.
- property get_all_distributions¶
Get all distributions.
- get_dist_cutoffs()[source]¶
Get different distance cut-offs.
Args:
s: Structure object
- Returns:
rcut: max-cutoff to ensure all the element-combinations are included, used in calculating angluar distribution upto first neighbor
rcut1: decide first cut-off based on total RDF and a buffer (previously used in dihedrals, but not used now in the code)
rcut2: second neighbor cut-off
rcut_dihed: specialized cut-off for dihedrals to avaoid large bonds such as N-N, uses average bond-distance and standard deviations
- ang_dist(nbor_info={}, plot=False)[source]¶
Get angular distribution function upto first neighbor.
- Args:
struct_info: struct information
max_n: maximum number of neigbors
c_size: max. cell size
plot: whether to plot distributions
Retruns:
ang_hist1: Angular distribution upto first cut-off
ang_bins1: angle bins