jarvis.analysis.structure.neighbors =================================== .. py:module:: jarvis.analysis.structure.neighbors .. autoapi-nested-parse:: This module provides classes to specify atomic structure. Classes ------- .. autoapisummary:: jarvis.analysis.structure.neighbors.NeighborsAnalysis Functions --------- .. autoapisummary:: jarvis.analysis.structure.neighbors.check_array jarvis.analysis.structure.neighbors.special_arange jarvis.analysis.structure.neighbors.calc_structure_data Module Contents --------------- .. py:function:: check_array(arr, type_=None, shape=None) 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 .. py:function:: special_arange(dims) 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) .. py:function:: calc_structure_data(coords, box, all_symbs, c_size) 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 .. py:class:: NeighborsAnalysis(atoms=None, max_n=500, rcut1=None, max_cut=10.0, rcut2=None, verbose=False) Bases: :py:obj:`object` Get neighbor informations (RDF,ADF,DDF) for Atoms object. .. py:attribute:: _atoms :value: None .. py:attribute:: max_n :value: 500 .. py:attribute:: max_cut :value: 10.0 .. py:attribute:: nb_warn :value: '' .. py:attribute:: rcut1 :value: None .. py:attribute:: rcut2 :value: None .. py:attribute:: verbose :value: False .. py:method:: get_structure_data(c_size=10.0) Provide non-repetitive structure information. .. py:method:: nbor_list(rcut=10.0, c_size=12.0) Generate neighbor info. .. py:method:: get_rdf(plot=False) Calculate radial distribution function. .. py:method:: get_dist_cutoffs() 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 .. py:method:: ang_dist(nbor_info={}, plot=False) 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 .. py:method:: ang_dist_first(plot=False) Get angular distribution upto first neighbor. .. py:method:: ang_dist_second(plot=False) Get angular distribution upto second neighbor. .. py:method:: get_ddf(plot=False) Get dihedral distribution upto first neighbor. .. py:property:: get_all_distributions Get all distributions. .. py:method:: atomwise_radial_dist(rcut=10.0, c_size=0) Get pair/radial distribution for each atom. .. py:method:: atomwise_angle_dist(rcut=None, nbins=180, c_size=0) Get angle distribution for each atom.