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

📄 com.f90

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

subroutine CenterOfMass( Length, X, Y, Z, TYPEg, Ngrs, MASS, xcom, ycom, zcom )

implicit none

! This routine calculates the center of mass of a chain of molecules.

! Length is the number of beads in the molecule.
! X, Y, and Z are the coordinates of the molecules.
! TYPEg contains the group identity of each molecule.

integer, intent(in)								:: Length
real, dimension(Length), intent(in)				:: X, Y, Z
integer, dimension(Length), intent(in)			:: TYPEg

! Ngrs is the number of groups within the molecule.
! MASS is the mass of each group.

integer, intent(in)								:: Ngrs
real, dimension(Ngrs), intent(in)				:: MASS

! xcom, ycom, and zcom are the coordinates of the center of mass of the molecule.

real, intent(out)								:: xcom, ycom, zcom

! Local Variables

integer											:: i
real											:: MassSum
real											:: XMSum, YMSum, ZMSum

MassSum = 0.0
XMSum = 0.0
YMSum = 0.0
ZMSum = 0.0

do i = 1, Length
	
	MassSum = MassSum + MASS( TYPEg(i) )

	XMSum = XMSum + X(i) * MASS( TYPEg(i) )
	YMSum = YMSum + Y(i) * MASS( TYPEg(i) )
	ZMSum = ZMSum + Z(i) * MASS( TYPEg(i) )

end do

xcom = XMSum / MassSum
ycom = YMSum / MassSum
zcom = ZMSum / MassSum

return

end	subroutine CenterOfMass






⌨️ 快捷键说明

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