xdatbus
Submodules
Attributes
Functions
|
Delete the folder and create a new one. |
|
Delete the file. |
|
|
|
Aggregate XDATCAR files from an AIMD simulation. |
|
|
|
Unwrap the distance between two coordinates. |
|
Unwrap the coordinates in the XDATCAR file (to .xyz). |
|
|
|
Unwrap the distance between two coordinates. |
|
Unwrap the coordinates in the xyz file. The unwrapped coordinates will be written to a new xyz file. |
|
|
|
Generate a thermal report from the OSZICAR files. |
|
|
|
|
|
Convert the vasprun.xml files to extended xyz files. |
|
|
|
|
|
|
|
Calculate the center of mass (COM) drift velocity for a xyz file. |
|
Correct the CONTCAR file by adding the COM drift to the coordinates of the CONTCAR file. |
|
Calculate the Gaussian potential energy. |
|
Calculate the Gaussian potential energy. |
|
Calculate the Gaussian potential energy. |
|
Calculate the 1D free energy profile from a HILLSPOT file. |
|
Calculate the 2D free energy profile from a HILLSPOT file. |
|
Calculate the 2D free energy profile from a HILLSPOT file. |
|
Convert HILLSPOT file to HILLS file |
|
Initialize a trajectory writer instance for filename. |
|
Convert a VASP XDATCAR file to an XTC trajectory file. |
|
Reweight a metadynamics simulation to the unbiased ensemble using histogram reweighting. |
|
project 3d free energy surface to 1d |
|
|
|
|
|
Read the lattice vectors from the first image of the XDATCAR file. |
|
Unwrap the distance between two coordinates. |
|
Delete the folder and create a new one. |
|
Delete the file. |
|
|
|
|
|
Calculate the Gaussian potential energy. |
|
Calculate the Gaussian potential energy. |
|
Calculate the Gaussian potential energy. |
|
Realize instances of the given object. This function requires bpy. |
|
Remove nodes with given names from the object's node tree. |
|
Get a node from a template blend file. |
|
Add a custom node and connect it to the specified input of the target node. |
|
Set the color of the given object. This function requires bpy and molecularnodes. |
|
Clear the scene of all objects. This function requires bpy. |
|
Render an image. This function requires bpy. |
Apply modifiers to the given object. This function requires bpy. |
|
|
This function generates a YAML file for the elements in the PDB file, with a common bond_radius. |
|
This function loads a YAML file and returns element data and bond radius. |
|
Package Contents
- xdatbus.update_folder(folder)
Delete the folder and create a new one.
- folderstr
The path of the folder
- xdatbus.remove_file(file_path)
Delete the file.
- file_pathstr
The path of the file
- xdatbus.filter_files(files, pattern)
- xdatbus.xdc_aggregate(xdc_dir='./', output_dir='./', del_temp=True, show_progress=False)
Aggregate XDATCAR files from an AIMD simulation.
- xdc_dirstr (optional)
Input path of the AIMD simulation, which contains the XDATCAR files
- output_dirstr (optional)
Output path of the XDATBUS file
- del_tempbool (optional)
If
False, the intermediate folders will be deleted- show_progressbool (optional)
Whether to show the progress bar
- xdatbus.main()
- xdatbus.unwrap_pbc_dis(coord_1, coord_2, box_length)
Unwrap the distance between two coordinates.
- coord_1ndarray
The first coordinate
- coord_2ndarray
The second coordinate
- box_length :
The length of the box
- float
The unwrapped distance between the two coordinates
- xdatbus.xdc_unwrap(xdc_path='./XDATBUS', output_path='./XDATBUS_unwrap.xyz', show_progress=False)
Unwrap the coordinates in the XDATCAR file (to .xyz).
- xdc_pathstr
Input path of the XDATCAR file
- output_pathstr
Output path of the xyz file
- show_progressbool (optional)
Show the progress bar or not
- xdatbus.main()
- xdatbus.unwrap_pbc_dis(coord_1, coord_2, box_length)
Unwrap the distance between two coordinates.
- coord_1ndarray
The first coordinate
- coord_2ndarray
The second coordinate
- box_length :
The length of the box
- float
The unwrapped distance between the two coordinates
- xdatbus.xyz_unwrap(xyz_path, lattice)
Unwrap the coordinates in the xyz file. The unwrapped coordinates will be written to a new xyz file.
- xyz_pathstr
Input path of the xyz file
- latticelist
Lattice vectors of the system
- xdatbus.filter_files(files, pattern)
- xdatbus.thermal_report(osz_dir='./', output_path='./', show_progress=False)
Generate a thermal report from the OSZICAR files.
- osz_dirstr
Input path of the OSZICAR files
- output_pathstr
Output path of the thermal report
- show_progressbool
Whether to show the progress bar
- xdatbus.main()
- xdatbus.filter_files(files, pattern)
- xdatbus.xml2xyz(xml_dir='./', output_path='./', train_ratio=1.0, free_energy=True, show_progress=False)
Convert the vasprun.xml files to extended xyz files.
- xml_dirstr
Input path of the vasprun.xml files
- output_pathstr
Output path of the extended xyz files
- train_ratiofloat (optional)
The ratio of training set
- free_energybool (optional)
Whether to keep the free energy from the xml files
- show_progressbool (optional)
Show the progress bar or not
- xdatbus.main()
- xdatbus.sum_hills(plumed_hills, plumed_outfile, plumed_min, plumed_max, plumed_bin, plumed_eachstep)
- xdatbus.main()
- xdatbus.com_drift(xyz_path, frame_start=0, frame_end=None, save_csv=True, timestep=1)
Calculate the center of mass (COM) drift velocity for a xyz file.
Parameters
- xyz_pathstr
Path to the XYZ file.
- frame_startint
The first frame to consider.
- frame_endint
The last frame to consider. If None, considers all frames.
- save_csvbool
Whether to save the COM to a csv file.
- timestepint
The time difference between each frame, in appropriate time units. Default is 1.
Returns
- np.ndarray
The COM drift velocity, represented as a 3-element numpy array.
- xdatbus.com_contcar(poscar_path, contcar_path, del_inter=False)
Correct the CONTCAR file by adding the COM drift to the coordinates of the CONTCAR file. The COM drift is calculated by fcom01_drift().
Parameters
- poscar_pathstr
Path to the POSCAR path.
- contcar_pathstr
Path to the CONTCAR file.
- del_interbool
Delete the intermediate files created by this function.
- xdatbus.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.
- xdatbus.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).
- xdatbus.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).
- xdatbus.fes_1d(hillspot_path, hills_count, cv_range, resolution=100)
Calculate the 1D free energy profile from a HILLSPOT file.
- hillspot_pathstr
The path of the HILLSPOT file
- hills_countint
The number of hills to be read
- cv_rangelist
The range of the collective variable
- resolutionint (optional)
The resolution of the free energy profile
- xdatbus.fes_2d(hillspot_path, hills_count, cv_1_range, cv_2_range, resolution=100)
Calculate the 2D free energy profile from a HILLSPOT file.
- hillspot_pathstr
The path of the HILLSPOT file
- hills_countint
The number of hills to be read
- cv_1_rangelist
The range of the first collective variable
- cv_2_rangelist
The range of the second collective variable
- resolutionint (optional)
The resolution of the free energy profile
- xdatbus.fes_3d(hillspot_path, hills_count, cv_1_range, cv_2_range, cv_3_range, resolution=100)
Calculate the 2D free energy profile from a HILLSPOT file.
- hillspot_pathstr
The path of the HILLSPOT file
- hills_countint
The number of hills to be read
- cv_1_rangelist
The range of the first collective variable
- cv_2_rangelist
The range of the second collective variable
- cv_3_rangelist
The range of the third collective variable
- resolutionint (optional)
The resolution of the free energy profile
- xdatbus.hillspot2hills(hillspot_dir, hills_dir, cv, height_conversion=1, sigma_conversion=1, del_inter=False)
- Convert HILLSPOT file to HILLS file
- hillspot_dirstr
Path to HILLSPOT file
- hills_dirstr
Path to the directory where the HILLS file will be created
- cvstr or list
Name of the collective variable(s)
- height_conversionfloat(optional)
Conversion factor to convert the unit of the height from eV to kJ/mol
- sigma_conversionfloat(optional)
Conversion factor to convert the unit of the sigma based on the lattice in Angstrom
- del_interbool(optional)
Delete the intermediate files created by this function.
- xdatbus.report_loader(aimd_path, load_pre_report=True, load_last_report=False, delete_intermediate_folders=True)
Initialize a trajectory writer instance for filename.
- aimd_pathstr
Output filename of the trajectory; the extension determines the format.
- load_pre_reportbool (optional)
If
True, the trajectory will contain the previous frames (before the current run)- load_last_reportbool (optional)
If
True, the trajectory will contain the last frame- delete_intermediate_foldersbool (optional)
If
True, the intermediate folders will be deleted
- xdatbus.xdc2xtc(xdc_path)
Convert a VASP XDATCAR file to an XTC trajectory file.
Parameters
- xdc_pathstr
Path to the XDATCAR file
- xdatbus.reweight(fes, cv, nv, kb, t, grid_min, grid_max, grid_num)
Reweight a metadynamics simulation to the unbiased ensemble using histogram reweighting.
In many cases you might decide which variable should be analyzed after having performed a metadynamics simulation. For example, you might want to calculate the free energy as a function of CVs other than those biased during the metadynamics simulation. At variance with standard MD simulations, you cannot simply calculate histograms of other variables directly from your metadynamics trajectory, because the presence of the metadynamics bias potential has altered the statistical weight of each frame. To remove the effect of this bias and thus be able to calculate properties of the system in the unbiased ensemble, you must reweight (unbias) your simulation.
- fesnp.ndarray
The free energy surface calculated from the metadynamics simulation.
- cvnp.ndarray
The collective variable used in the metadynamics simulation.
- nvnp.ndarray
The new collective variable for which the potential of mean force will be calculated.
- kbfloat
The Boltzmann constant.
- tfloat
The temperature of the simulation.
- grid_minfloat
The minimum value of the collective variable.
- grid_maxfloat
The maximum value of the collective variable.
- grid_numint
The number of bins in the histogram.
Returns
- np.ndarray
The unbiased free energy surface.
- xdatbus.pmf_321(fes3d, axis1, axis2)
project 3d free energy surface to 1d
Parameters
- fes3dnp.ndarray
The 3d free energy surface.
- axis1int
The axis to be projected.
- axis2int
The axis to be projected.
Returns
- np.ndarray
The 2d free energy surface.
- xdatbus.neb_2d(fes, minima_1, minima_2, n_images, n_steps, spring_constant)
- xdatbus.local_minima(data, size=3)
- xdatbus.read_lat_vec(xdatcar_dir)
Read the lattice vectors from the first image of the XDATCAR file.
- xdatbus.unwrap_pbc_dis(coord_1, coord_2, box_length)
Unwrap the distance between two coordinates.
- coord_1ndarray
The first coordinate
- coord_2ndarray
The second coordinate
- box_length :
The length of the box
- float
The unwrapped distance between the two coordinates
- xdatbus.update_folder(folder)
Delete the folder and create a new one.
- folderstr
The path of the folder
- xdatbus.remove_file(file_path)
Delete the file.
- file_pathstr
The path of the file
- xdatbus.skip_comments(file)
- xdatbus.filter_files(files, pattern)
- xdatbus.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.
- xdatbus.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).
- xdatbus.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).
- xdatbus.BPY_AVAILABLE = True
- xdatbus.PDB_AVAILABLE = True
- xdatbus.MN_AVAILABLE = True
- xdatbus.YAML_AVAILABLE = True
- xdatbus.realize_instances(obj, bond_radius)
Realize instances of the given object. This function requires bpy.
- objbpy.types.Object
The object to realize instances of
- bond_radiusfloat
The radius of the bonds
- xdatbus.remove_nodes(obj, node_names)
Remove nodes with given names from the object’s node tree.
- objbpy.types.Object
The object from which to remove nodes.
- node_nameslist of str
The names of the nodes to remove.
- xdatbus.get_template_node(node_name, nodes)
Get a node from a template blend file.
- node_namestr
The name of the node to get.
- nodesbpy.types.NodeTree.nodes
The nodes from the node tree to add the node to.
- nodebpy.types.Node
The node from the template blend file.
- xdatbus.set_color4element(obj, atomic_number, color, atomic_scale, bonded, bonded_count=0)
Add a custom node and connect it to the specified input of the target node.
- objbpy.types.Object
The object with the Geometry Nodes modifier whose node tree we’re editing.
- atomic_numberint
The atomic number of the element to set the color of.
- colortuple
The color to set the node to.
- atomic_scalefloat
The size of the atoms.
- bondedbool
Whether the atoms are bonded.
- bonded_countint
The number of elements forming a bond.
- xdatbus.apply_yaml(obj, yaml_path)
Set the color of the given object. This function requires bpy and molecularnodes.
Parameters
- objbpy.types.Object
The object to set the color of
- yaml_pathstr
The path to the YAML file to use
- xdatbus.clear_scene(mesh=True, lights=True, geometry_nodes=True)
Clear the scene of all objects. This function requires bpy.
- meshbool
Clear mesh objects
- lightsbool
Clear light objects
- geometry_nodesbool
Clear geometry node groups
- xdatbus.render_image(engine='eevee', x=1000, y=500, output_path='render.png')
Render an image. This function requires bpy.
- enginestr
The render engine to use. Either ‘eevee’ or ‘cycles’
- xint
The x resolution of the image
- yint
The y resolution of the image
- output_pathstr
The path to save the image to
- xdatbus.apply_modifiers_to_mesh(obj)
Apply modifiers to the given object. This function requires bpy.
- objbpy.types.Object
The object to apply modifiers to
- xdatbus.yaml_gen(pdb_file_path)
This function generates a YAML file for the elements in the PDB file, with a common bond_radius.
Parameters
- pdb_file_pathstr
Input path of the PDB file
- xdatbus.yaml_loader(yaml_path)
This function loads a YAML file and returns element data and bond radius.
Parameters
- yaml_pathstr
Input path of the YAML file
Returns
- tuple
A tuple containing a dictionary of elements with their properties and the common bond radius.
- xdatbus.main()