ectoolkits.structures.tools module#
- ectoolkits.structures.tools.count_heavy_atoms(smiles: str) int [source]#
Count the number of heavy atoms (non-hydrogen) in a SMILES string.
- Parameters:
smiles (str) – SMILES string.
- Returns:
Number of heavy atoms.
- Return type:
int
- Raises:
ValueError – If the SMILES string is invalid.
Example
count_heavy_atoms(“CCO”) # returns 3
- ectoolkits.structures.tools.get_exclude_water_count(ads_smiles: list, ads_counts: list, bulk_smiles: list, bulk_counts: list, water_heavy_atom_equiv: int = 1) int [source]#
Estimate the number of equivalent water molecules to be excluded based on heavy atom count.
- Parameters:
ads_smiles (list) – List of adsorbate SMILES strings.
ads_counts (list) – List of adsorbate molecule counts.
bulk_smiles (list) – List of bulk molecule SMILES strings.
bulk_counts (list) – List of bulk molecule counts.
water_heavy_atom_equiv (int) – Number of heavy atoms equivalent to one water molecule.
- Returns:
Estimated number of water molecules to exclude.
- Return type:
int
Example
get_exclude_water_count([“CCO”], [2], [“O=C=O”], [1], 3)
- ectoolkits.structures.tools.get_packmol_inp(filename: str, count: int, n_vec_a: list, n_vec_b: list, d1_a: float, d2_a: float, d1_b: float, d2_b: float, low_z: float, up_z: float, radius: float) str [source]#
Generate PACKMOL input structure block for a molecule.
- Parameters:
filename (str) – Path to the XYZ file.
count (int) – Number of molecules to place.
n_vec_a (list) – Normal vector A [x, y, z].
n_vec_b (list) – Normal vector B [x, y, z].
d1_a (float) – Distance range for vector A.
d2_a (float) – Distance range for vector A.
d1_b (float) – Distance range for vector B.
d2_b (float) – Distance range for vector B.
low_z (float) – Z direction limits.
up_z (float) – Z direction limits.
radius (float) – Minimum distance between molecules.
- Returns:
A string block to be written in a PACKMOL input file.
- Return type:
str
- ectoolkits.structures.tools.smiles2xyz(smiles: str, filename: str)[source]#
Convert a SMILES string to a 3D XYZ structure using RDKit and ASE.
- Parameters:
smiles (str) – SMILES representation of the molecule.
filename (str) – Output filename in XYZ format.
- Returns:
None
Example
smiles2xyz(“CCO”, “ethanol.xyz”)