e6interact.f90

来自「蒙特卡罗的一个程序分析 与大家分享 共同研究」· F90 代码 · 共 84 行

F90
84
字号

subroutine e6interact( Nb, Xb, Yb, Zb, TYPEb, DAMP2b, DAMP3b, &
					   Nmol, LENGTH, Nham, Nljgrs, &
					   EPS, SIG, CP, ALP, RMAX, BoxSize, ENERGY )

implicit none

! This routine calculates the total energy of a group of molecules.

! Nb is the total number of LJ beads in a system.
! TYPEb contains the group identity of each bead.
! Xb, Yb, Zb are the coordinates of each bead.

integer, intent(in)									:: Nb
integer, dimension(Nb), intent(in)					:: TYPEb
real, dimension(Nb), intent(in)						:: Xb, Yb, Zb
real, dimension(Nb), intent(in)						:: DAMP2b, DAMP3b

! Nmol is the number of molecules in the system.
! LENGTH contains the number of LJ beads in each molecule.

integer, intent(in)									:: Nmol
integer, dimension(Nmol), intent(in)				:: LENGTH

! Nham is the number of hamiltonians.
! Nljgrs is the number of LJ groups in the system.
! EPS is a rank 3 array containing the eps_ij parameters for each hamiltonian.
! SIG is a rank 3 array containing the sigma_ij parameters for each hamiltonian.
! CP is a rank 3 array containing the C_ij parameters for each hamiltonian.
! ALP is a rank 3 array containing the alpha_ij parameters for each hamiltonian.
! RMAX is a rank 3 array containing the Rmax_ij parameters for each hamiltonian.

integer, intent(in)									:: Nham
integer, intent(in)									:: Nljgrs
real, dimension(Nljgrs, Nljgrs, Nham), intent(in)	:: EPS, SIG, CP, ALP, RMAX

! BoxSize is the length of the simulation box.

real, intent(in)									:: BoxSize

! ENERGY contains the total energy of the system for each hamiltonian.

real, dimension(Nham), intent(out)					:: ENERGY

! Local variables

integer												:: i, Nc
integer												:: Start, Finish
real, dimension(Nham)								:: ENERGY_part



ENERGY = 0.0

Finish = 0

do i = 1, Nmol - 1

	Start = Finish + 1
	Finish = Start + LENGTH(i) - 1

	Nc = LENGTH(i)

	call e6molecule( Nc, Xb(Start:Finish), Yb(Start:Finish), &
					 Zb(Start:Finish), TYPEb(Start:Finish), &
					 DAMP2b(Start:Finish), DAMP3b(Start:Finish), &
					 Nb - Finish, Xb(Finish+1:Nb), Yb(Finish+1:Nb), &
					 Zb(Finish+1:Nb), TYPEb(Finish+1:Nb), &
					 DAMP2b(Finish+1:Nb), DAMP3b(Finish+1:Nb), &
					 Nham, Nljgrs, EPS, SIG, CP, ALP, RMAX, &
					 BoxSize, ENERGY_part)

	ENERGY = ENERGY + ENERGY_part

end do

return

end subroutine e6interact




⌨️ 快捷键说明

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