Quantum Chemistry Toolbox - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim

Home : Support : Online Help : System : Information : Updates : Maple 2021 : Quantum Chemistry Toolbox

Maple Quantum Chemistry Toolbox

The Maple Quantum Chemistry Toolbox from RDMChem, a separate add-on product to Maple, is a powerful environment for the computation and visualization of the electronic structure of molecules.  In Maple 2021, this toolbox has significant new features and enhancements: (1) a new command that provides a treasure trove of information about molecules−a molecular dictionary, (2) a new method for molecules that further enhances the package's suite of electronic structure solvers, (3) a new command for purifying density matrices with applications to the mitigation of errors in quantum computing,  (4) a new optional parameter for the plotting of molecular orbitals that allows for customized colors,  (5) new optional parameters for the generation of molecular integrals that support arbitrary molecular orbitals and active spaces, (6) a new addition to the ≈30 builtin lessons for classroom learning in undergraduate-to-graduate chemistry and physics, (7) updates to the interactive Maplet, and (8) additional enhancements to many methods and commands throughout the package.

Note that the Maple Quantum Chemistry Toolbox (QCT) is required in order to execute the examples in this worksheet.


Molecular Dictionary

Computing with Molecules

Error Mitigation in Quantum Computing

3-Dimensional Density Plots

Molecular Integrals

Using the Package in the Classroom

Molecular Dictionary

A molecular dictionary appears in QCT 2021 with access to online data for more than 50,000 molecules.  The command MolecularDictionary accepts the name of a molecule as a Maple string or CID integer.  For example, we retrieve the entries for the following two molecules: nitrogen ("dinitrogen") gas and the Cys-Ser peptide.  Before we begin we load the QuantumChemistry package,   




For nitrogen gas we have


Nitrogen: Dinitrogen is an elemental molecule consisting of two trivalently-bonded nitrogen atoms. It has a role as a member of food packaging gas and a food propellant. It is a diatomic nitrogen, a gas molecular entity and an elemental molecule. It is a conjugate base of a diazynium. -ChEBI

Nitrogen: Nitrogen is an element with atomic symbol N, atomic number 7, and atomic weight 14.01. -NCI Thesaurus (NCIt)

while for the Cys-Ser peptide we have


Cys-Ser: Cys-Ser is a dipeptide composed of L-cysteine and L-serine joined by a peptide linkage. It has a role as a metabolite. It is a dipeptide, a secondary carboxamide, a primary alcohol, a primary amino compound, a thiol and a carboxylic acid. It derives from a L-cysteine and a L-serine. -ChEBI

Similarly, we can explore many, many other molecules.  What about the molecule ozone that is sometimes generated before a thunderstorm?


Ozone: Ozone is an elemental molecule with formula O3. An explosive, pale blue gas (b.p. -112###) that has a characteristic, pleasant odour, it is continuously produced in the upper atmosphere by the action of solar ultraviolet radiation on atmospheric oxygen. It is an antimicrobial agent used in the production of bottled water, as well as in the treatment of meat, poultry and other foodstuffs. It has a role as a member of greenhouse gas, a disinfectant, a tracer, an electrophilic reagent, a mutagen, an oxidising agent and an antiseptic drug. It is a member of reactive oxygen species, an elemental molecule, a triatomic oxygen and a gas molecular entity. -ChEBI

Or the molecule ascorbic acid (Vitamin C)?

MolecularDictionaryascorbic acid;

Ascorbic acid: L-ascorbic acid is the L-enantiomer of ascorbic acid and conjugate acid of L-ascorbate. It has a role as a water-soluble vitamin, a vitamin C, a coenzyme, a flour treatment agent, a food antioxidant, a plant metabolite and a cofactor. It is a conjugate acid of a L-ascorbate. It is an enantiomer of a D-ascorbic acid. -ChEBI

Ascorbic acid: Ascorbic Acid is a natural water-soluble vitamin (Vitamin C). Ascorbic acid is a potent reducing and antioxidant agent that functions in fighting bacterial infections, in detoxifying reactions, and in the formation of collagen in fibrous tissue, teeth, bones, connective tissue, skin, and capillaries. Found in citrus and other fruits, and in vegetables, vitamin C cannot be produced or stored by humans and must be obtained in the diet. (NCI04) -NCI Thesaurus (NCIt)

Or that important molecule in coffee?


Caffeine: Caffeine is a trimethylxanthine in which the three methyl groups are located at positions 1, 3, and 7. A purine alkaloid that occurs naturally in tea and coffee. It has a role as a central nervous system stimulant, an EC 3.1.4.* (phosphoric diester hydrolase) inhibitor, an adenosine receptor antagonist, an EC (non-specific serine/threonine protein kinase) inhibitor, a ryanodine receptor agonist, a fungal metabolite, an adenosine A2A receptor antagonist, a psychotropic drug, a diuretic, a food additive, an adjuvant, a plant metabolite, an environmental contaminant, a xenobiotic, a human blood serum metabolite, a mouse metabolite and a mutagen. It is a purine alkaloid and a trimethylxanthine. -ChEBI

Caffeine: Caffeine is a methylxanthine alkaloid found in the seeds, nuts, or leaves of a number of plants native to South America and East Asia that is structurally related to adenosine and acts primarily as an adenosine receptor antagonist with psychotropic and anti-inflammatory activities. Upon ingestion, caffeine binds to adenosine receptors in the central nervous system (CNS), which inhibits adenosine binding. This inhibits the adenosine-mediated downregulation of CNS activity; thus, stimulating the activity of the medullary, vagal, vasomotor, and respiratory centers in the brain. This agent also promotes neurotransmitter release that further stimulates the CNS. The anti-inflammatory effects of caffeine are due the nonselective competitive inhibition of phosphodiesterases (PDEs). Inhibition of PDEs raises the intracellular concentration of cyclic AMP (cAMP), activates protein kinase A, and inhibits leukotriene synthesis, which leads to reduced inflammation and innate immunity. -NCI Thesaurus (NCIt)

The database also contains many more technical molecules such as the antiviral drug remdesivir that was recently repurposed to treat Covid-19.


Remdesivir: Remdesivir is a carboxylic ester resulting from the formal condensation of the carboxy group of N-[(S)-{[(2R,3S,4R,5R)-5-(4-aminopyrrolo[2,1-f][1,2,4]triazin-7-yl)-5-cyano-3,4-dihydroxytetrahydrofuran-2-yl]methoxy}(phenoxy)phosphoryl]-L-alanine with the hydroxy group of 2-ethylbutan-1-ol. A broad-spectrum antiviral prodrug with potent in vitro antiviral activity against a diverse panel of RNA viruses such as Ebola virus, MERS-CoV and SARS-CoV. It is currently in Phase III clinical trials for the treatment of Covid-19 in adults. It has a role as an antiviral drug, a prodrug and an anticoronaviral agent. It is a carboxylic ester, a pyrrolotriazine, a nitrile, a phosphoramidate ester, a C-nucleoside and an aromatic amine. It derives from a GS-441524. -ChEBI

Remdesivir: Remdesivir is a prodrug of an adenosine triphosphate (ATP) analog, with potential antiviral activity against a variety of RNA viruses. Upon administration, remdesivir, being a prodrug, is metabolized into its active form GS-441524. As an ATP analog, GS-441524 competes with ATP for incorporation into RNA and inhibits the action of viral RNA-dependent RNA polymerase. This results in the termination of RNA transcription and decreases viral RNA production. -NCI Thesaurus (NCIt)

The new MolecularDictionary command complements the existing commands MolecularGeometry and SkeletalStructure for retrieving molecular geometries and skeletal structures.  For example, here is the skeletal structure for remdesivir


and its molecular geometry

remdesivir  MolecularGeometryremdesivir;



which we can plot with the PlotMolecule command


With the dictionary entry, the skeletal structure, and the ball-and-stick plot we have all of the necessary background information to begin molecular calculations like the ones in the next section.

Computing with Molecules

In the QCT 2021 we implement a new method for the ground and excited states of molecules.  The Schrödinger equation, developed by Erwin Schrödinger in 1925, is the key equation for solving quantum systems in non-relativistic physics.  However, its exact solution scales exponentially with the number of electrons in the quantum system.  To deal with this inefficiency, we solve a projection (or contraction) of the Schrödinger equation onto the space of only two electrons, known as a contracted Schrödinger equation.  This contraction is especially useful for improving computational efficiency for strongly correlated molecules−molecules that deviate significantly from the mean-field (Hartree-Fock) picture of one electron in the field of the remaining electrons−for which many standard methods are often inaccurate.   Let us consider the peptide of the two amino acids L-cysteine and L-serine whose geometry we can import with the MolecularGeometry command

mol  MolecularGeometryCys-Ser; 



and plot with the PlotMolecule command


In this example we showcase the use of two active spaces, an active space of 6 electrons in 6 orbitals to account for any potential static (strong) electron correlation and a larger active space to account for additional (dynamic) electron correlation. (This second active space is chosen to be [16,16] to make the calculation quick but much larger second active spaces are possible.)

data_peptide ContractedSchrodingermol, active=6,6,active_cse=16,16;

In the table of computed properties we observe that the peptide has a nonzero dipole moment




The direction of the dipole moment can be readily visualized with the DipolePlot command

DipolePlotmol, method=ContractedSchrodinger, active=6,6, active_cse=16,16;

We can also compute the atomic charges which are closely associated with the dipole moment

seqmoli1,data_peptidechargesi, i=1..nopsmol;



Only one of the carbons is negatively charged and only two of the carbons are fairly positively charged which we can also see from a ChargesPlot

ChargesPlotmol, method=ContractedSchrodinger, active=6,6, active_cse=16,16;

where the positively charged atoms are shown in red and the negatively charged atoms are shown in blue.

Error Mitigation in Quantum Computing

All of the one- and two-electron properties of molecules are computable from the two-electron reduced density matrix (2-RDM).  The 2-RDM of a molecule obeys a set of stringent constraints that are necessary for it to represent an N-electron wave function−constraints known as N-representability conditions.  A 2-RDM that is computed by an approximate method or measured in the presence of noise as on a quantum computer can violate some of these conditions.  In QCT 2021 we introduce a new algorithm through the command Purify2RDM that purifies the 2-RDM to obey an important set of N-representability conditions.  Purify2RDM uses an advanced type of optimization, known as semidefinite programming, to project the 2-RDM onto the set of approximately N-representable 2-RDMs.  The command is especially useful in molecular simulations on quantum computers where noise generates errors in the measured 2-RDMs.  The correction of errors in quantities measured on a quantum computer is known as error mitigation.  Here we demonstrate the command by using it to purify an approximate 2-RDM of hydrogen fluoride generated from second-order many-body perturbation (MP2) theory.  First, we generate the data from applying the MP2 command to the geometry of hydrogen fluoride where we include the keyword parameter return_rdm="rdm1_and_rdm2" to return the 2-RDM.   

hf  MolecularGeometryhydrogen fluoride;



data_hf  MP2hf, return_rdm=rdm1_and_rdm2:

Second, we reshape the data stored in a 4-index tensor into a 2-index matrix

D2  Matrix36,36, shape=symmetric:D2..  ArrayTools:-Permutedata_hfrdm2, 1,3,2,4;

and compute the eigenvalues of the 2-RDM with the Eigenvalues command in the LinearAlgebra package

eigenvals  LinearAlgebra:-EigenvaluesD2;

Notice that the lowest eigenvalue of the approximate 2-RDM is negative (-0.0143), but because each eigenvalue represents the probability of being in a two-electron quantum state, all of the eigenvalues of the 2-RDM should be non-negative!  Finally, we use the Purify2RDM command to correct this violation as well as more subtle violations of the physical requirements for the 2-RDM  

data_hf_purified  Purify2RDMdata_hfrdm2;

To check the correction of the 2-RDM, as before we rearrange the outputted 4-index tensor into a 2-index matrix

D2p  Matrix36,36, shape=symmetric:D2p..  ArrayTools:-Permutedata_hf_purifiedrdm2, 1,3,2,4;

which we diagonalize with the LinearAlgebra:-Eigenvalues command

eigenvals  LinearAlgebra:-EigenvaluesD2p;

All of the eigenvalues, we find, are now non-negative.

3-Dimensional Density Plots

The command DensityPlot3D receives new optional keywords bonds and colors that control the appearance of chemical bonds and the color of the orbital densities.  Consider the diatomic molecule hydrogen fluoride

hf  MolecularGeometryhydrogen fluoride;



After performing an electronic structure calculation such as its solution by the new ContractedSchrodinger command

data_hf  ContractedSchrodingerhf, active=3,6;

we can visualize the orbitals with DensityPlot3D.  In QCT 2020 the density plot always uses green and purple colors for the orbitals

DensityPlot3Dhf, data_hf, orbitalindex=5, densitycutoff=0.0005, orientation=97,4,75; 

Now we can use the keyword color to change the default colors to any color supported in Maple's ColorTools package.  For example,

DensityPlot3Dhf, data_hf, orbitalindex=5, densitycutoff=0.0005, colors=Nautical Red,Nautical Light Blue;

Molecular Integrals

The QCT makes advanced features like obtaining the molecular integrals as simple as a single command MOIntegrals.  In QCT 2021 we add two new optional keywords initial_mo and active to the MOIntegrals command that makes generating molecular integrals in any MO basis set with or without an active space as easy as possible.  Let's consider the molecule citric acid whose skeletal structure, geometry, and dictionary entry are

SkeletalStructurecitric acid;

citricacid  MolecularGeometrycitric acid;




MolecularDictionarycitric acid;

Citric acid: Citric acid is a tricarboxylic acid that is propane-1,2,3-tricarboxylic acid bearing a hydroxy substituent at position 2. It is an important metabolite in the pathway of all aerobic organisms. It has a role as a food acidity regulator, a chelator, an antimicrobial agent and a fundamental metabolite. It is a conjugate acid of a citrate(1-) and a citrate anion. -ChEBI

Citric acid: Anhydrous Citric Acid is a tricarboxylic acid found in citrus fruits. Citric acid is used as an excipient in pharmaceutical preparations due to its antioxidant properties. It maintains stability of active ingredients and is used as a preservative. It is also used as an acidulant to control pH and acts as an anticoagulant by chelating calcium in blood. -NCI Thesaurus (NCIt)

We can generate the molecular orbitals (MOs) in a 26 electrons in 26 orbitals ([26,26]) active space−the 13 highest occupied orbitals (26 electrons) and the 13 lowest unoccupied orbitals−with the active keyword

data  MOIntegralscitricacid, active=26,26;

These molecular integrals are in the basis set of the Hartree-Fock MOs.  We can easily use any set of MOs with the keyword initial_mo.  For example, we can run a density functional theory (DFT) calculation and use the DFT MOs

data_dft  DensityFunctionalcitricacid;

The initial_mo keyword is assigned to a list of the MO coefficients and MO symmetries

data  MOIntegralscitricacid, active=26,26, initial_mo=data_dftmo_coeff,data_dftmo_symmetry;

Voila!  We have the MO integrals with respect to the DFT MOs in a [26,26] active space.

Using the Package in the Classroom

The Maple Quantum Chemistry Toolbox includes approximately 30 lessons that can be used in chemistry and physics courses from advanced high school courses through the graduate level. These lessons and associated curricula provide instructors and students with real-time quantum chemistry computations and visualizations that quickly deepen understanding of molecular concepts.  Detailed lesson plans and curricula are provided for Introductory (General) Chemistry, Physical Chemistry (Quantum Mechanics and Thermodynamics), Thermodynamics (Physics), Quantum Mechanics (Physics), Computational Chemistry, and Quantum Chemistry as well as Advanced Placement (AP) and International Baccalaureate (IB) chemistry courses.  Topics include atomic structure, chemical bonding, the Maxwell-Boltzmann distribution, heat capacity, enthalpy, entropy, free energy, particle-in-a-box, vibrational normal modes, infrared spectroscopy, as well as advanced electronic structure methods.  Use of the QCT in the classroom is described in a recent paper in J. Chem. Ed.  QCT 2021 includes a new lesson for Physical Chemistry and Undergraduate Quantum Mechanics on Vibrational Motion and the Harmonic Oscillator.   In the following two subsections we show snippets of the lesson

Reduced mass

Here we set the variables A and B to the strings of the atoms in the diatomic molecule (By changing these values, you can use the worksheet to treat other diatomic molecules!)

A  H;B  F;




We use the AtomicData command in the Quantum Chemistry package to obtain the masses as well as other data

dataA  AtomicDataA;



dataB  AtomicDataB;



Set the masses

mA  dataAatomicweight;



mB  dataBatomicweight;



Compute the reduced mass in amu

mu0  mAmBmA+mB;



Convert the reduced mass from amu to kg

mu  convertmu0,units,'kg';



Bond length

To compute the equilibrium bond length, we select a set of bond distances from the roots of the sixth-order Chebyshev polynomial that are suitable for interpolation

bonds  mapx  x/5+1.05, fsolveexpandChebyshevT6,x;



We define a list of molecular geometries with each geometry corresponding to one of the bond distances

molecules mapR A,0,0,0,B,0,0,R, bonds;



The energies for each geometry may be then readily computed with the Energy  command in the Quantum Chemistry package.

energies  mapEnergy,molecules,basis=cc-pVDZ;



We use polynomial interpolation to generate a polynomial in the bond distance R

pes  interpbonds,energies,R;



The potential energy surface (curve) can be plotted

plotpesR, R=bonds1..bonds1, axes=boxed, labels='R','E', color=blue, thickness=3;

Finally, we differentiate the potential energy curve with respect to R and set the derivative to zero.

eq  diffpes, R = 0;



Solving the resulting equation yields the equilibrium bond length

R_eq  fsolveeq, R=bonds1..bonds1;