Module to handle the calculation of the induced dipoles; this means find the solution of the polarization problem. The polarization problem is defined by the linear system where is the 'external' (here external means the sum of the electric field generated by QM density and the one generated by the MM sites) electric field at induced dipole sites, are the induced dipoles - the solution of the linear system -, and is the interaction tensor between the induced point dipoles.
Linear system \eqref{eq:pol_ls} can be solved with different methods (see mod_solvers for further details). Some of them requires to explicitly build in memory (eg. [[mod_solvers::inversion_solver]]), while other only requires to perform matrix-vector multiplication without building explicitly the interaction tensor. Interaction tensor is conveniently tought as a square matrix of dimension number of induced dipoles, of rank 3 tensors expressing the interaction between the two elements. We can distinguish the case of diagonal elements: and the off-diagonal elements:
Main driver for the calculation of induced dipoles. Takes electric field at induced dipole sites as input and -- if solver converges -- provides induced dipoles as output. Since AMOEBA requires the calculations of two sets of induced dipoles generated from two different electric fields (normally called direct (D) and polarization (P)) both electric field and induced dipoles are shaped with an extra dimension and this routine calls the solver twice to solve the two linear systems in the case of AMOEBA FF. Direct electric field and induced dipoles are stored in e(:,:,1)/ipds(:,:,1) while polarization field/dipole are stored in e(:,:,2)/ipds(:,:,2).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(ommp_system), | intent(inout), | target | :: | sys_obj |
Fundamental data structure for OMMP system |
|
real(kind=rp), | intent(in), | dimension(3, sys_obj%eel%pol_atoms, sys_obj%eel%n_ipd) | :: | e |
Total electric field that induces the dipoles |
|
integer(kind=ip), | intent(in), | optional | :: | arg_solver |
Flag for the solver to be used; optional, should be one OMMP_SOLVER_ if not provided ommp_solver_default is used. |
|
integer(kind=ip), | intent(in), | optional | :: | arg_mvmethod |
Flag for the matrix-vector method to be used; optional, should be one of OMMP_MATV_ if not provided ommp_matv_default is used. |
|
logical, | intent(in), | optional | :: | arg_ipd_mask(sys_obj%eel%n_ipd) |
Logical mask to skip calculation of one of the two set of dipoles in AMOEBA calculations (eg. when MM part's field is not taken into account, both P and D field are just external field, so there is no reason to compute it twice). If n_ipd == 1 this is always considered true. |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(ommp_electrostatics_type), | intent(inout) | :: | eel |
This subroutine compute the interaction tensor (rank 3) between two polarizable sites i and j. This tensor is built according to the following rules: ... TODO
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(ommp_electrostatics_type), | intent(inout) | :: | eel |
The electostatic data structure for which the interaction tensor should be computed |
||
integer(kind=ip), | intent(in) | :: | i |
Index (in the list of polarizable sites) of the source site |
||
integer(kind=ip), | intent(in) | :: | j |
Index (in the list of polarizable sites) of the target site |
||
real(kind=rp), | intent(out), | dimension(3, 3) | :: | tens |
Interaction tensor between sites i and j |
Explicitly construct polarization tensor in memory. This routine is only used to accumulate results from dipole_T and shape it in the correct way.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(ommp_electrostatics_type), | intent(inout) | :: | eel |
The electostatic data structure for which the interaction tensor should be computed |
Perform matrix vector multiplication y = TMat*x, where TMat is polarization matrix (precomputed and stored in memory) and x and y are column vectors
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(ommp_electrostatics_type), | intent(in) | :: | eel |
The electostatic data structure |
||
real(kind=rp), | intent(in), | dimension(3*eel%pol_atoms) | :: | x |
Input vector |
|
real(kind=rp), | intent(out), | dimension(3*eel%pol_atoms) | :: | y |
Output vector |
|
logical, | intent(in) | :: | dodiag |
Logical flag (.true. = diagonal is computed, .false. = diagonal is skipped) |
Perform matrix vector multiplication y = TMat*x, where TMat is polarization matrix (precomputed and stored in memory) and x and y are column vectors
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(ommp_electrostatics_type), | intent(in) | :: | eel |
The electostatic data structure |
||
real(kind=rp), | intent(in), | dimension(3*eel%pol_atoms) | :: | x |
Input vector |
|
real(kind=rp), | intent(out), | dimension(3*eel%pol_atoms) | :: | y |
Output vector |
|
logical, | intent(in) | :: | dodiag |
Logical flag (.true. = diagonal is computed, .false. = diagonal is skipped) |
This routine compute the product between the diagonal of T matrix with x, and add it to y. The product is simply computed by each element of x for its inverse polarizability.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(ommp_electrostatics_type), | intent(in) | :: | eel |
The electostatic data structure |
||
real(kind=rp), | intent(in), | dimension(3*eel%pol_atoms) | :: | x |
Input vector |
|
real(kind=rp), | intent(out), | dimension(3*eel%pol_atoms) | :: | y |
Output vector |
Perform matrix vector multiplication y = [TMat-diag(TMat)]*x, where TMat is polarization matrix (precomputed and stored in memory) and x and y are column vectors
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(ommp_electrostatics_type), | intent(in) | :: | eel |
The electostatic data structure |
||
real(kind=rp), | intent(in), | dimension(3*eel%pol_atoms) | :: | x |
Input vector |
|
real(kind=rp), | intent(out), | dimension(3*eel%pol_atoms) | :: | y |
Output vector |
Perform matrix vector multiplication y = pol*x, where pol is polarizability vector, x and y are column vectors
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(ommp_electrostatics_type), | intent(in) | :: | eel |
The electostatic data structure |
||
real(kind=rp), | intent(in), | dimension(3*eel%pol_atoms) | :: | x |
Input vector |
|
real(kind=rp), | intent(out), | dimension(3*eel%pol_atoms) | :: | y |
Output vector |