-
Notifications
You must be signed in to change notification settings - Fork 18
Code Overview
The bulk of LIO is mainly split in two distinct folders: lioamber, which contains the FORTRAN code, and g2g, which contains the C++/CUDA code. lioamber handles most of the "physics", as well as CPU electron integrals except exchange-correlation. Meanwhile, g2g handles the entirety of exchange-correlation (both CPU and GPU) in addition to the other GPU electron integrals. G2G also handles CDFT and any kind of calculation that requires the usage of a real-space grid.
The current FORTRAN code is a mixup of at least two different coding philosophies, and as such data structures are yet to be standardized. While there is an "operator" datatype, intended for usage with Fock and Rho, most of the integrals are done over vectorized Fock and Rho matrices (this means that a 2x2 matrix (a1 a2 | a3 a4) is turned into a size 3 array (a1 a2 a4)). In either case, these matrices are usually stored in the atomic basis. Among the most commonly used data structures, we find:
- r: a real array containing atom positions, size = (ntatom, 3).
- rqm: same as r but only for the QM region, size = (natom,3).
- Iz: an integer array containing atomic numbers of the QM region, size = (natom).
- pc: a real array containing MM partial charges, size = (ntatom).
- Pmat_v, rhoalpha, rhobeta: arrays containing the total density matrix, and alpha/beta density matrices. Only Pmat_v is used in closed-shell calculations. Size = (M * (M + 1) / 2).
- Fmat_vec, Fmat_b_vec2: arrays containing the alpha and beta Fock matrices. In closed-shell calculations, only Fmat_vec is used and contains the full Fock matrix. Size = (M * (M + 1) / 2).
- Smat: overlap matrix, size = (M * (M + 1) / 2).
- MO_coef_at, MO_coef_at_b: MO coefficient matrices obtained after Fock diagonalization for alpha and beta; in closed-shell only MO_coef_at is used. Size = (M * (M + 1) / 2).
- fock_aop, fock_bop, rho_aop, rho_bop: Fock and Rho matrices in the "operator"-type structure. These are defined in liomain. In closed-shell calculations, only fock_aop and rho_aop are used.
LIO runtime excecution can be easily divided in two major steps: initializations and calculations. In the following figures, purple represents excecutables, blue is for lioamber (FORTRAN) routines, red is for g2g (C++/CUDA) routines, and green is for general comments. Forces for external programs (AMBER, GROMACS, HYBRID) are calculated separately, and are included here as a third step.
In this section all relevant arrays are allocated, input options are read and some pre-calculations, such as factorials, are done.
In this step only a few arrays are reallocated.