Harmonic spectra of Coronene monomer and dimer
Harmonic spectra of Coronene monomer and dimer
A. Optimization
This loads the global configuration (executable and basis paths) from global.json.
import deMonPy
deMonPy.configure_from_file("global.json")
This reads the coronene structure from the XYZ file; coro keeps the last image, the starting geometry of the optimization.
from deMonPy.molden import read_XYZ
images, comm = read_XYZ("./data/coronene.xyz")
coro = images[-1]
This optimizes the coronene geometry: SCC-DFTB with the optimization module, up to 9999 steps, the structure written at each step, and the optimization trajectory written.
from deMonPy.deMonNano import deMonNano
WORKDIR = ".run/tutorial-3/A/"
parameters = {
"DEMON_EXECUTABLE": deMonPy.DEMON_EXECUTABLE,
"BASIS": {"PTYPE": "BIO", "SKFILE": deMonPy.DEMON_BASIS},
"DEMON_PARAMETERS": {
"ACTIVE": {
"DFTB": {"SCC": True},
},
},
"DEMON_MODULE": {"ACTIVE": {"OPT": {"MAX": 9999, "OUT": 1, "TRAJECTORY": True}}},
}
dem = deMonNano(title="CALCULATION DEMONANO", workdir=WORKDIR, **parameters)
dem.calculate(symbols=coro.symbols, positions=coro.positions)
Uncommented, this opens the optimization trajectory in a molecular viewer.
from ase.visualize import view
# view(dem.results["trajectory"])
B. Frequencies analysis
This retrieves the optimized monomer geometry from the results dictionary.
optimized_geometry = dem.results["output_geometry"]
print("Optimized geometry : ", optimized_geometry)
This runs an SCC-DFTB calculation with the frequency analysis enabled, which performs a normal-mode vibrational analysis of the geometry.
from deMonPy.deMonNano import deMonNano
WORKDIR = ".run/tutorial-3/B/"
parameters = {
"DEMON_EXECUTABLE": deMonPy.DEMON_EXECUTABLE,
"BASIS": {"PTYPE": "BIO", "SKFILE": deMonPy.DEMON_BASIS},
"DEMON_PARAMETERS": {
"ACTIVE": {"DFTB": {"SCC": True}, "FREQ": True},
},
}
dem = deMonNano(title="CALCULATION DEMONANO", workdir=WORKDIR, **parameters)
dem.calculate(symbols=coro.symbols, positions=coro.positions)
This collects the vibrational frequencies from the results and displays them for the coronene monomer.
import numpy as np
results = dem.results
freq = np.array([res["frequency"] for res in results["frequency"]])
print("Available frequencies in coronene : \n", freq)
C. Dimer of coronene
This builds the dimer: a copy of the optimized coronene is shifted 3.35 Å along the y-axis, then combined with the original monomer.
shift_coronene = optimized_geometry.copy()
shift_coronene.positions[:, 1] += 3.35
dimer = optimized_geometry + shift_coronene
This optimizes the dimer geometry at the SCC-DFTB level, now with the London dispersion correction DISP=2.
from deMonPy.deMonNano import deMonNano
WORKDIR = ".run/tutorial-3/C/"
parameters = {
"DEMON_EXECUTABLE": deMonPy.DEMON_EXECUTABLE,
"BASIS": {"PTYPE": "BIO", "SKFILE": deMonPy.DEMON_BASIS},
"DEMON_PARAMETERS": {
"ACTIVE": {
"DFTB": {"SCC": True, "DISP": 2},
},
},
"DEMON_MODULE": {"ACTIVE": {"OPT": {"MAX": 9999, "OUT": 1, "TRAJECTORY": True}}},
}
dem = deMonNano(title="CALCULATION DEMONANO", workdir=WORKDIR, **parameters)
dem.calculate(symbols=dimer.symbols, positions=dimer.positions)
This opens the optimization trajectory in a viewer and retrieves the optimized dimer geometry from the results.
view(dem.results["trajectory"])
optimized_geometry = dem.results["output_geometry"]
print("Optimized geometry : ", optimized_geometry)
D. Frequency on dimer of coronene
This retrieves the optimized dimer structure from the results, to be used for the frequency calculation.
optimized_dimer = dem.results["output_geometry"]
This runs the frequency analysis on the optimized dimer, keeping the DISP=2 dispersion correction.
from deMonPy.deMonNano import deMonNano
WORKDIR = ".run/tutorial-3/D/"
parameters = {
"DEMON_EXECUTABLE": deMonPy.DEMON_EXECUTABLE,
"BASIS": {"PTYPE": "BIO", "SKFILE": deMonPy.DEMON_BASIS},
"DEMON_PARAMETERS": {
"ACTIVE": {"DFTB": {"SCC": True, "DISP": 2}, "FREQ": True},
},
}
dem = deMonNano(title="CALCULATION DEMONANO", workdir=WORKDIR, **parameters)
dem.calculate(symbols=optimized_dimer.symbols, positions=optimized_dimer.positions)
As for the monomer, this displays the vibrational frequencies of the dimer.
results = dem.results
freq = np.array([res["frequency"] for res in results["frequency"]])
print("Available frequencies in coronene : \n", freq)
E. Twisted dimer of coronene
This centers the optimized dimer on its center of mass, splits it into its two coronene halves, rotates the second one by 30° around the y-axis, and reassembles the twisted dimer.
optimized_dimer.positions -= optimized_dimer.get_center_of_mass()
coro_1 = optimized_dimer[:36].copy()
coro_2 = optimized_dimer[36:].copy()
coro_2.rotate(30.0, "y")
twisted_dimer = coro_1 + coro_2
This (re)defines the base parameters for the twisted dimer: SCC-DFTB with the DISP=2 dispersion correction.
parameters = {
"DEMON_EXECUTABLE": deMonPy.DEMON_EXECUTABLE,
"BASIS": {"PTYPE": "BIO", "SKFILE": deMonPy.DEMON_BASIS},
"DEMON_PARAMETERS": {
"ACTIVE": {"DFTB": {"SCC": True, "DISP": 2}},
},
}
This optimizes the twisted dimer geometry with the optimization module.
from deMonPy.deMonNano import deMonNano
WORKDIR = ".run/tutorial-3/E/"
parameters.update(
{"DEMON_MODULE": {"ACTIVE": {"OPT": {"MAX": 9999, "OUT": 1, "TRAJECTORY": True}}}}
)
dem = deMonNano(title="CALCULATION DEMONANO", workdir=WORKDIR, **parameters)
dem.calculate(symbols=twisted_dimer.symbols, positions=twisted_dimer.positions)
This retrieves the optimized twisted-dimer geometry from the results.
optimized_dimer = dem.results["output_geometry"]
This runs the frequency analysis on the optimized twisted dimer, again with DISP=2.
from deMonPy.deMonNano import deMonNano
WORKDIR = ".run/tutorial-3/E/"
parameters = {
"DEMON_EXECUTABLE": deMonPy.DEMON_EXECUTABLE,
"BASIS": {"PTYPE": "BIO", "SKFILE": deMonPy.DEMON_BASIS},
"DEMON_PARAMETERS": {
"ACTIVE": {"DFTB": {"SCC": True, "DISP": 2}, "FREQ": True},
},
}
dem = deMonNano(title="CALCULATION DEMONANO", workdir=WORKDIR, **parameters)
dem.calculate(symbols=optimized_dimer.symbols, positions=optimized_dimer.positions)
This displays the vibrational frequencies of the twisted dimer.
results = dem.results
freq = np.array([res["frequency"] for res in results["frequency"]])
print("Available frequencies in coronene : \n", freq)
Next steps
Tutorial 4 — Temperature evolution of the electronic spectra moves on to the TD-DFTB electronic spectra of cationic methylene-pyrene isomers. The FREQUENCY keyword page summarizes what the frequency analysis returns (frequencies, infrared intensities, zero-point energy), and the DeMonNanoPy Examples section applies a similar vibrational analysis to graphene (phonon bands).