Conformer search#
import veloxchem as vlx
We define a structure in terms of a SMILES string.
molecule = vlx.Molecule.read_smiles("OC=CC=O")
molecule.show(atom_indices=True)
3Dmol.js failed to load for some reason. Please check your browser console for error messages.
We also define the electronic structure theory method to be used as well as an VeloxChem optimization driver.
scf_drv = vlx.XtbDriver()
scf_drv.ostream.mute()
opt_drv = vlx.OptimizationDriver(scf_drv)
opt_drv.ostream.mute()
Conformer optimization#
Optimize the structures of all conformers.
conformer_energies = []
conformer_structures = []
cis, trans = 0.0, 180.0
hocc, occc, ccco = (6, 1, 2, 3), (1, 2, 3, 4), (2, 3, 4, 5)
for i in (cis, trans):
for j in (cis, trans):
for k in (cis, trans):
molecule = vlx.Molecule.read_smiles("OC=CC=O")
molecule.set_dihedral_in_degrees(hocc, i)
molecule.set_dihedral_in_degrees(occc, j)
molecule.set_dihedral_in_degrees(ccco, k)
opt_results = opt_drv.compute(molecule)
conformer_energies.append(opt_results["opt_energies"][-1])
conformer_structures.append(opt_results["final_geometry"])
Find the conformer with the lowest energy.
import numpy as np
conformer_energies = np.array(conformer_energies)
idx_lowest_conformer = np.argmin(conformer_energies)
lowest_conformer = vlx.Molecule.read_xyz_string(
conformer_structures[idx_lowest_conformer]
)
lowest_conformer.show()
3Dmol.js failed to load for some reason. Please check your browser console for error messages.
We find the most stable conformer to be the cis–cis–cis conformer.
print("Conformer Energy (kcal/mol)\n" + 27 * "-")
for i, conformer_energy in enumerate(
(conformer_energies - np.min(conformer_energies)) * vlx.hartree_in_kcalpermol()
):
print(f"{i+1:>2d} {conformer_energy:14.2f}")
Conformer Energy (kcal/mol)
---------------------------
1 0.00
2 7.43
3 5.81
4 5.78
5 12.97
6 10.24
7 8.44
8 9.34