24小时热门版块排行榜    

Znn3bq.jpeg
北京石油化工学院2026年研究生招生接收调剂公告
查看: 214  |  回复: 0

leigp

木虫 (正式写手)


[交流] 【讨论】麻烦各位高手给看一下我这程序有问题吗?多谢

麻烦高手帮忙给看一下我这段程序有问题吗?为什么开始几十步的时候,能量基本保持不变,但是后来,动能急剧增加呢,势能也在增加,有劳各位了,多谢了


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      ! calculate the distance6 and distance12
        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 ]
回复此楼

» 猜你喜欢

» 抢金币啦!回帖就可以得到:

查看全部散金贴

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 leigp 的主题更新
普通表情 高级回复 (可上传附件)
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 283分求调剂 +13 试试看呗 2026-04-04 13/650 2026-04-07 17:11 by 一只xx浩
[考研] 085404 293求调剂 +8 勇远库爱314 2026-04-06 9/450 2026-04-07 13:05 by flydream1314
[考研] 080500求调剂 +12 黄宇博 2026-04-06 12/600 2026-04-07 12:41 by upczlm1989
[考研] 264求调剂 +7 麦小叮当 2026-04-07 7/350 2026-04-07 12:05 by Sammy2
[考研] 材料调剂 +17 小刘同学吖吖 2026-04-06 18/900 2026-04-07 11:41 by 诗与自由
[考研] 一志愿西南090202求调剂 +3 在线求有学上 2026-04-07 3/150 2026-04-07 10:24 by kk112233
[考研] 一志愿北交大材料工程总分358求调剂 +10 cs0106 2026-04-05 12/600 2026-04-06 19:41 by 无际的草原
[考研] 071000生物学调剂 +7 拉提桃 2026-04-06 7/350 2026-04-06 18:55 by 52305043001
[考研] 电子信息调剂交叉学科有推荐吗 +6 jhtfeybgj 2026-04-01 9/450 2026-04-05 11:13 by 猪会飞
[考博] 申博 +7 IQwQl 2026-04-04 7/350 2026-04-04 23:32 by mumin1990
[考研] 调剂 +11 JLLLLLLLLLL 2026-04-03 11/550 2026-04-04 22:21 by hemengdong
[考研] 302求调剂一志愿华中师范大学 +8 小江小江江江 2026-04-02 8/400 2026-04-04 19:50 by 蓝云思雨
[考研] 一志愿重庆大学085404,总分314分,求调剂 +4 zf83hn 2026-04-03 4/200 2026-04-03 21:25 by 啵啵啵0119
[考研] 366求调剂 +7 sbdnd 2026-04-03 7/350 2026-04-03 12:40 by cymywx
[考研] 326求调剂 +3 9ahye 2026-04-02 4/200 2026-04-03 08:43 by Jaylen.
[考研] 085600,320分求调剂 +6 大馋小子 2026-04-02 6/300 2026-04-02 21:54 by dongzh2009
[考研] 279求调剂 +5 傅文秋 2026-04-02 5/250 2026-04-02 18:10 by 笔落锦州
[考研] 材料求调剂 +10 呢呢妮妮 2026-04-01 13/650 2026-04-02 09:17 by olim
[考研] 348环境工程调剂 +3 吴彦祖24k 2026-04-01 3/150 2026-04-02 09:14 by nanaliuyun
[考研] 265求调剂 +11 yelck 2026-04-01 12/600 2026-04-01 19:12 by 549790059
信息提示
请填处理意见