⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fourier_setup.f90

📁 巨正则系综蒙特卡罗算法的源程序;可以用来进行吸附等分子模拟;最大的好处在于可以插入或删除原子
💻 F90
字号:

subroutine Fourier_Setup( Kmax, Alpha, CONST, KX, KY, KZ, Nkvec )

implicit none

! This routine calculates the constant part of the Fourier energy of the ES.

! Kmax is the number of terms to be used in the complex space summations.

integer, intent(in)							:: Kmax
									
! Alpha is an Ewald sum parameter, Alpha = kappa * L, for kappa in A + T.

real, intent(in)							:: Alpha

! Nkvec is the number of k vectors generated.

integer, intent(inout)						:: Nkvec

! CONST contains the constant part of the 
! Fourier summation for a given vector n, CONST(n).

real, dimension(Nkvec), intent(out)			:: CONST

! KX, KY, KZ contain the vector identity of the Nkvec vectors.

integer, dimension(Nkvec), intent(out)		:: KX, KY, KZ

! Local Stuff

integer										:: i, j, k
real										:: b, Ksq
real, parameter								:: Pi = 3.14159265359

b = Pi * Pi / ( Alpha * Alpha )

Nkvec = 0

do i = 0, Kmax
	do j = -Kmax, Kmax
		do k = -Kmax, Kmax
			
			Ksq = i*i + j*j + k*k
			
			if( ( Ksq /= 0 ) .AND. ( Ksq < Kmax * Kmax ) ) then
			
				Nkvec = Nkvec + 1

				CONST(Nkvec) = 1.0 / ( Pi * real( i*i + j*j + k*k ) ) * &
							   exp( -b * ( i*i + j*j + k*k ) )

				if( i == 0 ) CONST(Nkvec) = 0.5 * CONST(Nkvec)

				KX(Nkvec) = i
				KY(Nkvec) = j
				KZ(Nkvec) = k

			end if
		end do
	end do
end do

end subroutine Fourier_Setup





⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -