Molecule

Molecule#

There are several different ways to create molecule objects such as using SMILES strings, xyz-strings, molecule strings, or xyz-files.

By default, coordinates are given in units of Ångström but atomic units is also available.

Python script

aspirin = vlx.Molecule.read_smiles("CC(=O)OC1=CC=CC=C1C(=O)O")

xyz_str = """
3
water
O    0.0000000    0.0000000   -0.1653507
H    0.7493682    0.0000000    0.4424329
H   -0.7493682    0.0000000    0.4424329
"""

h2o = vlx.Molecule.read_xyz_string(xyz_str)

mol_str = """
C    0.0  0.0  0.0
O    0.0  0.0  1.128
"""

co = vlx.Molecule.read_molecule_string(mol_str)

tq = vlx.Molecule.read_xyz_file("../input_files/tq-polymer.xyz")

3D illustrations of molecular structures are available with the show method.

aspirin.show(atom_indices=True, atom_labels=True)

tq.show()

3Dmol.js failed to load for some reason. Please check your browser console for error messages.

3Dmol.js failed to load for some reason. Please check your browser console for error messages.

Conformation of the molecule can be altered using the set_dihedral_in_degrees function as explained in the next cell.

h2o2 = vlx.Molecule.read_smiles("OO")
h2o2.set_dihedral_in_degrees([3, 1, 2, 4], 180.0)

h2o2.show(atom_indices=True)

3Dmol.js failed to load for some reason. Please check your browser console for error messages.

The molecular charge and spin multiplicity can be adjusted using the set_charge and set_multiplicity functions. In the example below, we create a molecule object for the phenyl radical cation.

phenyl = vlx.Molecule.read_smiles("c1ccccc1")
phenyl.set_charge(1)
phenyl.set_multiplicity(2)

Text file

Using a input text file, a molecule specification is exemplified below.

A detailed list of keywords is available.

@molecule
charge: 0
multiplicity: 1
xyz:
O    0.0000000    0.0000000   -0.1653507
H    0.7493682    0.0000000    0.4424329
H   -0.7493682    0.0000000    0.4424329                     
@end
@molecule
charge: 0
multiplicity: 1
xyz_file: "../input_files/tq-polymer.xyz"