| 查看: 265 | 回复: 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 ] |
» 猜你喜欢
面上再次挂了,太难了,躺也躺不了,倦也卷不过,小学校之殇!
已经有27人回复
8月时间戳变的,举个手。玩一下,释放压力
已经有4人回复
UV压敏胶开发
已经有6人回复
有没有H口的?有收到消息的吗?
已经有3人回复
十年后又回来了,论文投稿求助
已经有3人回复
纯娱乐,不喜欢勿喷
已经有10人回复
面上提前没消息,有中的吗
已经有18人回复
娱乐
已经有4人回复
系统今天又提示维护了,估计离放榜不远了
已经有16人回复
一个有机合成实验室都需要哪些设备?
已经有10人回复
» 抢金币啦!回帖就可以得到:
山东征女友,坐标济南
+1/175
坐标北京,92男,诚征结婚对象
+1/164
1,2-双(三甲基硅氧基)苯(CAS:5075-52-5)
+1/98
2-氯-1,3,2-二氧磷杂环戊烷(CAS:822-39-9)
+1/98
3-羟基丙腈(CAS:109-78-4)
+1/98
1,3,2-Dioxaphospholane, 2-(2,2,2-trifluoroethoxy)-
+1/97
三(三甲基硅烷)磷酸酯(CAS:10497-05-9)
+1/97
三(三甲基硅基)硼酸酯(CAS:4325-85-3)
+1/97
丁烯二醇(CAS: 497-06-3)
+1/97
三氟甲基亚磺酸锂
+1/97
南京大学医工交叉方向薛璐璐团队招聘脂质纳米材料与RNA递送方向博士后1-2名
+1/74
化工学院邱惠斌教授联合同仁医院招聘博士后
+1/72
2026年University of South Carolina继续招收博士生
+1/61
采用本质安全型氢气流量控制的化学合成 - Alicat ISMC本安防爆质量流量控制器
+2/50
北京理工大学-集成电路与电子学院杰青团队-招博士后
+1/17
北理工集成电路杰青团队 | 诚招科助理
+1/17
《上海高薪》VS《中科院》
+1/13
福建师范大学海峡柔性电子学院-2027年9月入学博士-考核制-电催、能源
+1/11
【香港城市大学】范战西教授课题组现招收博士生(全奖, 2027年秋季入学)
+1/3
组委会诚挚滴邀请各界学者踊跃投稿参会
+1/2










回复此楼