xdatbus.utils ============= .. py:module:: xdatbus.utils Functions --------- .. autoapisummary:: xdatbus.utils.read_lat_vec xdatbus.utils.unwrap_pbc_dis xdatbus.utils.update_folder xdatbus.utils.remove_file xdatbus.utils.skip_comments xdatbus.utils.filter_files xdatbus.utils.gauss_pot_1d xdatbus.utils.gauss_pot_2d xdatbus.utils.gauss_pot_3d Module Contents --------------- .. py:function:: read_lat_vec(xdatcar_dir) Read the lattice vectors from the first image of the XDATCAR file. .. py:function:: unwrap_pbc_dis(coord_1, coord_2, box_length) Unwrap the distance between two coordinates. Parameters ---------- coord_1 : ndarray The first coordinate coord_2 : ndarray The second coordinate box_length : The length of the box Returns ------- float The unwrapped distance between the two coordinates .. py:function:: update_folder(folder) Delete the folder and create a new one. Parameters ---------- folder : str The path of the folder .. py:function:: remove_file(file_path) Delete the file. Parameters ---------- file_path : str The path of the file .. py:function:: skip_comments(file) .. py:function:: filter_files(files, pattern) .. py:function:: gauss_pot_1d(x: numpy.ndarray, x0: float, height: float, width: float) -> numpy.ndarray Calculate the Gaussian potential energy. Parameters: - x (np.ndarray): Array of positions at which to evaluate the potential. - x0 (float): The position of the potential minimum. - height (float): The height of the Gaussian potential. - width (float): The standard deviation (controls the width of the Gaussian). Returns: - np.ndarray: The potential energy at each position x. .. py:function:: gauss_pot_2d(x: numpy.ndarray, y: numpy.ndarray, x0: float, y0: float, height: float, width: float) -> numpy.ndarray Calculate the Gaussian potential energy. Parameters: - x (np.ndarray): Array of x positions at which to evaluate the potential. - y (np.ndarray): Array of y positions at which to evaluate the potential. - x0 (float): The x position of the potential minimum. - y0 (float): The y position of the potential minimum. - height (float): The height of the Gaussian potential. - width (float): The standard deviation (controls the width of the Gaussian). Returns: - np.ndarray: The potential energy at each position (x, y). .. py:function:: gauss_pot_3d(x: numpy.ndarray, y: numpy.ndarray, z: numpy.ndarray, x0: float, y0: float, z0: float, height: float, width: float) -> numpy.ndarray Calculate the Gaussian potential energy. Parameters: - x (np.ndarray): Array of x positions at which to evaluate the potential. - y (np.ndarray): Array of y positions at which to evaluate the potential. - z (np.ndarray): Array of z positions at which to evaluate the potential. - x0 (float): The x position of the potential minimum. - y0 (float): The y position of the potential minimum. - z0 (float): The z position of the potential minimum. - height (float): The height of the Gaussian potential. - width (float): The standard deviation (controls the width of the Gaussian). Returns: - np.ndarray: The potential energy at each position (x, y, z).