Usage
Contents
Usage#
The simulation inputs that the wrapper needs to be provided with are the
molecular structure, solvent, temperature and pressure. Such simulation inputs
must be instantiated as CUDS objects in the wrapper session using the
namespace from the wrapper ontology. The cobramm
namespace and the wrapper
session can be imported as follows:
from osp.core.namespaces import cobramm
from osp.wrappers.cobrammwrapper import CobrammSession
The pattern of CUDS objects that the COBRAMM wrapper expects as input is depicted in the figure at the end of this section.
The input information is employed to run the following workflow:
Solvent-solute MM optimization, thermalization and equilibration dynamics (Amber force field for the solvent and GAFF for the solute) with the charges estimated by the AM1-BCC method from antechamber.
Set-up of the high-medium-low layers for QM/MM COBRAMM driven computations from the last MD snapshot produced in 1) (which is supposed to return the better solvent organization): the solvent MM shell is selected as a spherical droplet around the chromophore,
QM(DFT: b3lyp, STO-3G)/MM optimization for locating the representative ground state equilibrium structure of the solvated chromophore,
QM(DFT: b3lyp, STO-3G)/MM frequency calculation on the QM/MM minimum optimized in 3),
Wigner ensemble generation,
Single point QM(TDDFT: cam-b3lyp, STO-3G, nroot=5)/MM calculations on top of each equilibrated Wigner snapshots found in 7),
Sum over gaussian-functions centered at the excitation energy values found in 6) (with the gaussian maximum set at the oscillator strength value and a fixed 0.2 ev standard deviation) divided by the number of Wigner samples.
The Low/Medium/High accuracy level do set parameters for MD simulations (boxsize, cutoff, initial optimization steps, time step of the MD run, heating time, time of the final equilibration steps) and QM/MM simulations (solvent droplet radius, mobile layer radius, number of samples produced in the Wigner sampling) of increasing complexity, accuracy and computational cost.
After the simulation is run, the simulated spectrum is available as a
collection CUDS objects attached to the SYSTEM
object. Their structure is
depicted in the figure below.
Example#
An example of how to use the wrapper is available in
examples/simulation_example.py
. In the example, the COBRAMM wrapper is used
to compute the linear absorption spectrum of Formaldehyde in water at 1 atm and
300 K.
1from osp.core import cobramm
2from osp.wrappers.cobrammwrapper import CobrammSession
3from osp.core.utils import pretty_print
45
6
# the following is the geometry of a formaldehyde molecule
7atoms_to_add = [["C", [0.60720, 0.00000, -0.00040]],
8["O", [-0.60040, 0.00000, 0.00010]],
9["H", [1.14720, 0.93530, 0.00160]],
10["H", [1.14720, -0.93530, 0.00160]]]
1112
13
# now open a new CobrammSession to execute the simulation
14with CobrammSession() as session:
15wrapper = cobramm.wrapper(session=session)
1617
# Create input ontological object
18system = cobramm.system()
19material = cobramm.material()
2021
# define the material by specifying atom symbols and cartesian coordinates, atom-by-atom
22for atom_symbol, atom_coords in atoms_to_add:
23atom = material.add(cobramm.atom())
24atom.add(cobramm.position(vector_value=atom_coords, unit="Ang"))
25atom.add(cobramm.element_id(atom_symbol=atom_symbol))
2627
material.add(cobramm.charge(integer_value=0))
28system.add(material)
2930
molecule = cobramm.molecule(commercial_name="water")
31solvent = cobramm.solvent()
32solvent.add(molecule)
33system.add(solvent)
3435
temperature = cobramm.temperature(scalar_value=300, unit="K")
36system.add(temperature)
3738
pressure = cobramm.pressure(scalar_value=1, unit="bar")
39system.add(pressure)
4041
# Set accuracy
42accuracy = cobramm.accuracy(accuracy_value=1)
4344
# Set case
45case = cobramm.case(case_name="absorption")
4647
system_wrapper = wrapper.add(system, rel=cobramm.has_part)
48accuracy_wrapper = wrapper.add(accuracy, rel=cobramm.has_part)
49case_wrapper = wrapper.add(case, rel=cobramm.has_part)
5051
# pretty-print the material so far
52print("\n")
53pretty_print(system)
54print("\n")
5556
# run the simulation
57wrapper.session.run()
5859
# extract the spectrum
60spectrum = (wrapper.get(oclass=cobramm.system)[0]).get(oclass=cobramm.spectrum)[0]
6162
# pretty-print the final spectrum
63print("\n")
64pretty_print(spectrum)
65print("\n")
Lines 22-25: we include in the material the four atoms of the formaldehyde specifying their cartesian coordinates in Angstroms.
Lines 30-39: we specify the physical conditions, i.e., temperature, pressure, and solvent.
Lines 47-49: we add the material specified above to the COBRAMM wrapper.
Line 57: we run the simulation.
Line 60: we extract the simulated spectrum.