| 查看: 310 | 回复: 0 | |||
[交流]
【讨论】麻烦各位高手给看一下我这程序有问题吗?多谢
|
|
麻烦高手帮忙给看一下我这段程序有问题吗?为什么开始几十步的时候,能量基本保持不变,但是后来,动能急剧增加呢,势能也在增加,有劳各位了,多谢了 SUBROUTINE L_J (n,a,ahalf,rcut,position_x,position_y,position_z,u,f_x,f_y,f_z,Ep) IMPLICIT NONE ! the number of particles INTEGER,INTENT(IN)::n ! the potential cutoff REAL,INTENT(IN)::rcut ! the length and half length of box REAL,INTENT(IN)::a,ahalf !potential energy REAL,INTENT(OUT)::Ep ! the position of particles REAL(8),DIMENSION(n),INTENT(INOUT)::position_x,position_y,position_z ! the potential and force of particles REAL,DIMENSION(n),INTENT(OUT)::u,f_x,f_y,f_z ! the contral variable of loop INTEGER::i,j,k ! the label of particles INTEGER::ijk ! the distance of every two particles along the three axis REAL::distance_x,distance_y,distance_z ! the distance's square of every two particles REAL::distance_sq REAL::distance6,distance12,rcut_sq,rcut6,rcut12 REAL::Ec,ff ! initialize the potential and force u=0. Ep=0 f_x=0. f_y=0. f_z=0. ijk=0 !calculate the rcut_sq rcut_sq=rcut*rcut rcut6=rcut_sq**3 rcut12=rcut6*rcut6 Ec=(1./rcut12-1./rcut6) position_i: DO i=1,n-1 distance_ij: DO j=i+1,n distance_x=position_x(i)-position_x(j) distance_y=position_y(i)-position_y(j) distance_z=position_z(i)-position_z(j) !x_distance: distance_x=distance_x-a*REAL(ANINT(distance_x/a)) !y_distance: distance_y=distance_y-a*REAL(ANINT(distance_y/a)) !z_distance: distance_z=distance_z-a*REAL(ANINT(distance_z/a)) ! calculate the distance_sq distance_sq=distance_x**2+distance_y**2+distance_z**2 ! calculate potential and force force:IF (distance_sq distance6=distance_sq**3 distance12=distance6*distance6 ff=(distance_x/distance_sq)*((12./distance12)-(6./distance6)) ! u(ijk)=u(ijk)+(1./distance12-1./distance6)-Ec f_x(i)=f_x(i)+4.*ff f_y(i)=f_y(i)+4.*ff f_z(i)=f_z(i)+4.*ff f_x(j)=f_x(j)-4.*ff f_y(j)=f_y(j)-4.*ff f_z(j)=f_z(j)-4.*ff Ep=Ep+(1./distance12-1./distance6)-Ec END IF force END DO distance_ij ! u(ijk)=4.*u(ijk) END DO position_i Ep=4.*Ep Ep=Ep/real(n) END SUBROUTINE L_J [ Last edited by ghcacj on 2010-12-16 at 13:08 ] |
» 猜你喜欢
2027申博 寻博导--物理
已经有5人回复
27功能高分子申博
已经有3人回复
双非硕士,高分子材料方向,诚寻博士导师
已经有5人回复
浙江教授:国内知名学者要尽量少发论文,尽量只研究卡脖子问题-别人做不了的研究
已经有8人回复
中药单体能投哪些期刊
已经有4人回复
» 抢金币啦!回帖就可以得到:
2027年城乡规划与交通运输国际会议(UPTT 2027)
+1/995
2027年水资源管理与环境生态保护国际会议(MEEP 2027)
+1/995
2027年应用物理与电子电气国际会议(IACSEM 2027)
+1/989
2027年流体力学、湍流模拟与航空工程国际会议(FMTSA 2027)
+1/984
2027年医学,心理健康与人文发展国际会议(HHDC 2027)
+1/980
2027年能源材料与化学工程国际会议(ICEMCE 2027)
+1/977
2027 年国际金融、贸易与经济管理会议(FTEM 2027)
+1/974
2027年人工智能、自动化与网络安全国际会议(AIAC 2027)
+1/973
2027年地球科学与环境工程国际会议(ESEE 2027)
+1/964
2027年艺术设计与文化传承国际会议(ADCH 2027)
+1/953
2027年测绘科学、航空航天科学与安全科学国际会议(SASS 2027)
+1/952
2027年环境工程与低碳发展国际会议(ICEELCD 2027)
+1/937
2027年土木、水利与结构工程国际会议(ICCHSE 2027)
+1/934
2027年桥隧工程与土木、城市建设国际会议(BTECUC 2027)
+1/933
2027年教育管理、经济发展和财务管理国际会议(EMEF 2027)
+1/915
2027年物理学与机械工程国际会议(ICPME 2027)
+1/904
2027年应用经济学,法律与社会科学国际会议(AELSS 2027)
+1/896
2027年人文发展、文化传播与数据分析国际会议(HDCCDA 2027)
+1/896
2027年化学反应与分子工程国际会议(CRMM 2027)
+1/895
2027年量子通信、传感云与信息系统国际会议(CSIS 2027)
+1/880









回复此楼