@param[in] dmax: Maximal degree of spherical harmonics to be evaluated.
dmax >= 0
@param[in] pm: Maximal degree of the multipole expansion. pm >= 0.
@param[in] pl: Maximal degree of the local expansion. pl >= 0.
@param[out] vcnk: Array of squre roots of combinatorial factors C_n^k.
Dimension is (2*dmax+1)*(dmax+1).
@param[out] m2l_ztranslate_coef: Constants for M2L translation over OZ axis.
Dimension is (pm+1, pl+1, pl+1).
@param[out] m2l_ztranslate_coef: Constants for adjoint M2L translation over
OZ axis. Dimension is (pl+1, pl+1, pm+1).
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
subroutine make_vcnk(dmax)! Inputsinteger,intent(in)::dmax! Local variablesinteger(ip)::i,j,indiif(dmax<=vcnk_dmax)then! Job is already donereturn end if if(allocated(vcnk))then! vscales is allocated but it should be expanded.! Just remove everything and restart from scratchdeallocate(vcnk)end ifvcnk_dmax=dmaxallocate(vcnk((2*dmax+1)*(dmax+1)))vcnk(1)=1.0_rpdo i=2,2*dmax+1! Offset to the C_{i-2}^{i-2}, next item to be stored is C_{i-1}^0indi=(i-1)*i/2! C_{i-1}^0 = 1vcnk(indi+1)=1.0_rp! C_{i-1}^{i-1} = 1vcnk(indi+i)=1.0_rp! C_{i-1}^{j-1} = C_{i-2}^{j-1} + C_{i-2}^{j-2}! Offset to C_{i-3}^{i-3} is indi-i+1do j=2,i-1vcnk(indi+j)=vcnk(indi-i+j+1)+vcnk(indi-i+j)end do end do! Get square roots of C_n^k. sqrt(1.0_rp) is 1.0_rp, so no need to update C_n^0! and C_n^ndo i=3,2*dmax+1indi=(i-1)*i/2do j=2,i-1vcnk(indi+j)=sqrt(vcnk(indi+j))end do end doend subroutine make_vcnk