If you can't read please download the document
Upload
dinhmien
View
229
Download
2
Embed Size (px)
Citation preview
Intception: Automatic generation of codefor the evaluation of molecular integrals
James C. Womack
University of Bristol
22nd April 2015
Manchester, 22nd April 2015 1/18
Molecular integrals
E =|H||
E (2) =1
4
ijab
|ij |ab ij |ba|2
i + j a b
F = |h|+
P
[(|) 1
2(|)
]
ij |ab (ia|jb) =
dr1dr2 i (1)
j (2)r
112 a(1)b(2)
|i i (r) =
Ci(r)
| (r; A, a) =Km
dmg(r; m,A, a)
Manchester, 22nd April 2015 2/18
Molecular integrals: GTOs
|a) g(r; a,A, a) = (x Ax)ax (y Ay )ay (z Az)az exp(a|r A|2)
=
i=x ,y ,z
(ri Ai )ai exp(a(ri Ai )2)
0.00
0.10
0.20
0.30
0.40
0.50
0.60
0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0
(x
)
x
STO = 1.0STO-1GSTO-2GSTO-3G
A = (Ax ,Ay ,Az)
a = (ax , ay , az)
la = ax + ay + az
s: l = 0p: l = 1d: l = 2
(0, 0, 0)(1, 0, 0), (0, 1, 0), (0, 0, 1)(2, 0, 0), (1, 1, 0), . . .
Plot adapted from Szabo, A. & Ostlund, N. S. Modern Quantum Chemistry (Dover, 1996), pp.153159.
Manchester, 22nd April 2015 3/18
Evaluating molecular integrals
(a|b) =
dr g(r; a,A, a)g(r; b,B,b)
(a|b) (a|b) (i|a)(0|0)
Primitive Contracted(AO)
MOPrimitive(l=0)
Recurrence relations: Obara-Saika scheme
(0A|0B) = (/)3/2 exp(|A B|2)
Ai|a) = 2a|a + 1i ) ai |a 1i )
(a + 1i |b) = PAi (a|b) +ai2
(a 1i |b) +bi2
(a|b 1i )
Obara, S. & Saika, A. J. Chem. Phys. 84, 39633974 (1986).
Manchester, 22nd April 2015 4/18
Evaluating molecular integrals
(a|0) (a|0)(0|0)
Primitive(lb=0)
Contracted(lb=0)
Primitive(la=lb=0)
(a|b)VRR HRRContract
Contracted
Contracted functions (AOs)
(r; A, a) =Km
dmg(r; m,A, a)
Horizontal recurrence relations (HRRs)
(a(b + 1i )|c) = ((a + 1i )b|c) + ABi (ab|c)
... can be applied to contracted integrals.
Head-Gordon, M. & Pople, J. A. J. Chem. Phys. 89, 57775786 (1988).
Manchester, 22nd April 2015 5/18
Womack, J. C. & Manby, F. R. J. Chem. Phys. 140, 044118 (2014).
Manchester, 22nd April 2015 6/18
Intception
Purpose
Automatic generation of source code for the evaluation ofmolecular integrals in quantum chemistry
Motivation
Integral evaluation code is time consuming to write.
The software and hardware landscape is constantly shifting.
Cray 2 supercomputer x86 workstation Nvidia Tesla GPGPU
x86 workstation image by Vernon Chan [CC-BY-2.0], via Wikimedia Commons
Manchester, 22nd April 2015 7/18
Implementation of Intception
Input script Intception Source code
Integral classes definedin DSL: Integral indexes Base expression Recurrence relations
Process DSL input Construct optimized
algorithm Output integral
evaluation code
Can be compiled into a library
Can be interfacedwith existing packages
Python C
Intception is written entirely in Python 3.
The input is written in a domain specific language (DSL).
The DSL is constructed using Python objects.
C is a lingua franca, allowing wide compatibility with othersoftware packages (we use the C99 standard).
Manchester, 22nd April 2015 8/18
Automatic code generation in quantum chemistry
Not a new idea!
There are many projects using some form of code generation for:
Derivation and simplification of equations.
Implementation of electronic structure methods.
Optimised method implementation.
Similar projects
Libint[1] : DSL, C++ output, Obara-Saika type RRs,emphasises pre-generated optimised libraries.
Libcint[2] : C output, Dupuis-Rys-King (Gaussianquadrature) method.
1. Valeev group, http://www.valeevgroup.chem.vt.edu/software.html
2. Sun, Q. arXiv:1412.0649 [physics] (2014); https://github.com/sunqm/libcint
Manchester, 22nd April 2015 9/18
Implementation of Intception: DSL
dsl_cartesian_gaussian ga dsl_cartesian_gaussian gb*
dsl_cartesian_gaussian ga
dsl_cartesian_gaussian gb
dsl_binop dsl_opop_mul
Manchester, 22nd April 2015 10/18
Implementation of Intception: Input
Definition of RRs
Creation of dsl_integral object
Expression for (0|0)
Creation of generator object
Source code output
Manchester, 22nd April 2015 11/18
Implementation of Intception: Output
VRR sequence
Contraction sequence
HRR sequence
Copy to output array
Base functionContractedPrimitive (00|0)(m)
(a0|c)
(a0|c)
(ab|c)
(ab|c)
(00|0)(m)
(ab|c)
(ab|c)
(00|0)(m)
(a0|c)
(ab|c)
(ab|c)
(00|0)(m)
(ab|c)
(ab|c)
(ab|c)
Manchester, 22nd April 2015 12/18
input.py
Structured input in the DSL
output.c
Source code for integral evaluation
Intception
Process DSL input Construct optimized
algorithm Output integral
evaluation code
Manchester, 22nd April 2015 13/18
Results 1: It works!
Class Molpro /s Intception / s Max. diff. RMSD Mean value
(a|b) 103 0.001 1015 1016 102(a|r1C |b) 10
3 0.001 1015 1017 102
(a|T |b) 103 0.002 1015 1016 102(a|r112 |b) 103 0.001 1013 1014 100(ab|r112 |c) 101 0.128 1014 1016 102(ab|r112 |cd) 30.971 1014 1017 104(a|r112 |b|g23|c) 1.237 0.195 1014 1015 101(a|g12|b|g23|c) 1.151 0.216 1013 1015 101
Glycine monomer (NH2CH2COOH), cc-pVDZ basis set (95 functions), serial execution
DFT calculation on naphthalene (C10H8)
No XC, cc-pVDZ AO basis and CFIT-Ahlrichs DF basis, comparing an in-house codeagainst Molpro.
Eelec = -329.497952607 (Intception), -329.497952586 (Molpro) Hartree ( 10s)
A single nuclear centre C was used for all nuclear integrals. , were set to a constant values for all3-electron integrals. Serial execution on 1 core of an Intel Pentium (Haswell) CPU G3420 @ 3.20GHz.Molpro: H.-J. Werner, P. J. Knowles, G. Knizia, F. R. Manby, M. Schutz, and others (http://www.molpro.net).
Manchester, 22nd April 2015 14/18
Results 2: Its flexible!
Base VRR(s) Contraction HRR(s) Output
Class Algorithm Molecule Max. diff. RMSD Mean value
(a) VRR Naphthalene 1014 1015 100
(a|b) VRR Naphthalene 1015 1017 102(a|b) VRR/HRR Naphthalene 1015 1016 102(a|b|c) VRR Naphthalene 1015 1018 104(a|b|c) VRR/HRR Naphthalene 1015 1018 104(a|b|c|d) VRR Benzene 1015 1019 106(a|b|c|d) VRR/HRR Benzene 1015 1019 106
Naphthalene (C10H8), cc-pVDZ basis set (180 functions), serial execution.
Benzene (C6H6), cc-pVDZ basis set (114 functions), serial execution.
Serial execution on 1 core of an Intel Pentium (Haswell) CPU G3420 @ 3.20GHzMolpro: H.-J. Werner, P. J. Knowles, G. Knizia, F. R. Manby, M. Schutz, and others (http://www.molpro.net).
Manchester, 22nd April 2015 15/18
Results 3: Its...not slow!
0.0
0.5
1.0
1.5
2.0
2.5
3.0
3.5
A B C D Molpro
Tim
eta
ken
/s3.05 2.93
2.271.99
1.03
Generated code algorithm
A 3 VRRsB 3 VRRs (1 simplified [1])C 2 VRRs + 1 HRRD 2 VRRs (1 simplified [1]) + 1 HRR
Naphthalene (C10H8), (ab|r112 |C)
AO: cc-pVDZ (180 functions)DF: cc-pVDZ/MP2FIT (672 functions)
Serial execution, Intel Pentium CPU G3420 @ 3.20GHz
[1] Ahlrichs, R. Phys. Chem. Chem. Phys. 6, 51195121 (2004).Molpro: H.-J. Werner, P. J. Knowles, G. Knizia, F. R. Manby, M. Schutz, and others (http://www.molpro.net).
Manchester, 22nd April 2015 16/18
Summary
Conclusions
It works...Numerical accuracy for a large range of integral classes.
Its flexible...Different algorithms can be rapidly generated and tested.
Its not (so) slow...Serial execution speed is close to Molpro.
Why Intception?
Simple DSL as user input.
Focus on generality, new integral classes.
Designed for modularity and extensibility.
... software ecosystem diversity is also important!
Manchester, 22nd April 2015 17/18
Acknowledgements
Prof Fred Manby
Tom Rumsey
Centre for Computational Chemistry
EPSRC
University of Bristol
Manchester, 22nd April 2015 18/18