molecool_test¶
short description of molecool_test.
A Python package for analyzing and visualizing xyz files. For MolSSI Workshop Python Package development workshop.
Subpackages¶
Submodules¶
Package Contents¶
Functions¶
|
Calculate the distance between two points. |
|
|
|
Build a list of bonds in a set of coordinates based on a distance criteria. |
|
Calculate the mass of a molecule. |
|
Calculate the center of mass of a molecule. |
|
|
|
|
|
Open and read coordinates and atom symbols from a pdb file. |
|
|
|
Attributes¶
- molecool_test.calculate_distance(rA, rB)[source]¶
Calculate the distance between two points.
- Parameters
rA, rB (np.ndarray) – The coordinates of each point.
- Returns
distance – The distance between the two points.
- Return type
float
Examples
>>> r1 = np.array([0, 0, 0]) >>> r2 = np.array([0, 0.1, 0]) >>> calculate_distance(r1, r2) 0.1
- molecool_test.build_bond_list(coordinates, max_bond=1.5, min_bond=0)[source]¶
Build a list of bonds in a set of coordinates based on a distance criteria.
- Parameters
coordinates (np.ndarray) – The coordinates of the atoms to analyze in an (natoms, ndim) array.
max_bond (float, optional) – The maximum distance for two atoms to be considered bonded.
min_bond (float, optional) – The minimum distance for two atoms to be considered bonded.
- Returns
bonds – A dictionary containing bonded atoms with atom pairs as keys and the distance between the atoms as the value.
- Return type
dict
- molecool_test.calculate_molecular_mass(symbols)[source]¶
Calculate the mass of a molecule.
- Parameters
symbols (list) – A list of elements.
- Returns
mass – The mass of the molecule
- Return type
float
- molecool_test.calculate_center_of_mass(symbols, coordinates)[source]¶
Calculate the center of mass of a molecule.
The center of mass is weighted by each atom’s weight.
- Parameters
symbols (list) – A list of elements for the molecule
coordinates (np.ndarray) – The coordinates of the molecule.
- Returns
center_of_mass – The center of mass of the molecule.
- Return type
np.ndarray
Notes
The center of mass is calculated with the formula
\[\vec{R}=\frac{1}{M} \sum_{i=1}^{n} m_{i}\vec{r_{}i}\]
- molecool_test.draw_molecule(coordinates, symbols, draw_bonds=None, save_location=None, dpi=300)[source]¶
- molecool_test.bond_histogram(bond_list, save_location=None, dpi=300, graph_min=0, graph_max=2)[source]¶
- molecool_test.open_pdb(file_location)[source]¶
Open and read coordinates and atom symbols from a pdb file.
The pdb file must specify the atom elements in the last column, and follow the conventions outlined in the PDB format specification.
- Parameters
file_location (str) – The location of the pdb file to read in.
- Returns
coords (np.ndarray) – The coordinates of the pdb file.
symbols (list) – The atomic symbols of the pdb file.
- molecool_test.versions¶