| 查看: 309 | 回复: 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年翻译、教育研究与语言文学国际会议(TERL 2027)
+1/996
2027年流域规划与水资源配置国际会议(BPWR 2027)
+1/995
2027年桥梁建设、结构与工程材料国际会议(BCSEM 2027)
+1/993
2027年信息化经济发展与社会科学国际会议(IEDSS 2027)
+1/985
2027年人文学科与现代管理国际会议(ICHMM 2027)
+1/984
2027年电力工程与电气技术国际会议(PEET 2027)
+1/981
2027城市工程与工业技术国际会议(ICUEIT 2027)
+1/981
2027年大数据、先进算法与计算机工程国际会议(BDAACE 2027)
+1/969
2026年超导材料、低温工程与磁悬浮技术国际会议(SMCET 2026)
+1/962
2027年经济学与区域发展国际会议(ERD 2027)
+1/955
2027年测绘科学、航空航天科学与安全科学国际会议(SASS 2027)
+1/952
2027年智能计算与数据建模国际会议(ICDM 2027)
+1/947
2027年电子信息工程、建模与自动化国际会议(EIMA 2027)
+1/938
2027年经济发展、互联网与商业文化国际会议(DIBC 2027)
+1/937
2027年人文发展、文化传播与数据分析国际会议(HDCCDA 2027)
+1/896
2027年量子通信、传感云与信息系统国际会议(CSIS 2027)
+1/880
观后感 人工智能时代,精神能力更加宝贵 周国平 求是26年22期
+1/30
深圳大学应用技术学院联合香港中文大学招聘博士后
+1/4
SCI期刊热科学方向继续征稿
+1/2
Nature Communications|阿尔茨海默病中,哪些细胞变化与遗传风险有关?
+1/2









回复此楼