| 8 | 1/1 | 返回列表 |
| 查看: 1191 | 回復(fù): 7 | |||
[求助]
想請(qǐng)教一個(gè)有關(guān)二面角的問題! 已有1人參與
|
|
我現(xiàn)在使用tinker程序中的xyzint程序,將笛卡爾坐標(biāo)(xyz coor.)轉(zhuǎn)化為內(nèi)坐標(biāo)(internal coor.)的形式; 然后再使用其中的intxyz程序?qū)?nèi)坐標(biāo)轉(zhuǎn)化回笛卡爾坐標(biāo)形式,但是卻得不到原來(lái)的構(gòu)型! 關(guān)鍵的問題出現(xiàn)在轉(zhuǎn)化二面角上,比如:二面角ABCD 程序中是先求出angle(ABC)所在平面的法向量;然后再求出angle(BCD)所在平面的法向量,最后求出兩個(gè)平面的法向量,最終求出這兩個(gè)平面的夾角! 我的問題是: 1. 當(dāng)這兩個(gè)平面重合的情況下,是應(yīng)該沒有二面角,還是0度或者180度? 因?yàn)檫@種情況下,程序中是處理成,二面角直接等于angle(ABD),這個(gè)平面角了,這樣的處理不太理解! 2. 如果ABC三點(diǎn)或者BCD三點(diǎn)在同一條直線上,這樣的二面角又該怎么處理? 3. 同樣,如果兩個(gè)平面重合的話,它們各自對(duì)應(yīng)的法向量應(yīng)該是什么關(guān)系呢? 我是學(xué)化學(xué)的,二面角以及向量這塊兒,很是欠缺,求大俠幫助! |

榮譽(yù)版主 (文壇精英)
![]() |
專家經(jīng)驗(yàn): +518 |
木蟲 (正式寫手)




木蟲 (正式寫手)
|
極坐標(biāo)轉(zhuǎn)換 !this sub to transfer Cartesian coordinates (x,y,z) with Polar coordinates (rou,theta,phi) (radius) !control number 1 for (x,y,z)=>(rou,theta,phi) and -1 is reverse !x=rou*sin(phi)*cos(theta) !x=rou*sin(phi)*sin(theta) !z=rou*cos(phi) subroutine trans(a,b,c,iflag) parameter(pi=3.1415926,h=0.01745329252) !pi/180 real rou,theta,phi real a,b,c integer iflag !1 from Cartesan to Polar, -1 is reverse (degree) !print*,"a b cini",a,b,c,iflag if(iflag==1)then !Cartesan to Polar rou=sqrt(a*a+b*b+c*c) if(rou.eq.0)then a=0 b=0 c=0 goto 80 endif phi=acos(c/rou) if(abs(rou-c).le.1e-3.or.abs(b).le.1e-3)then theta=0 !point on Z aixs or Y axis, thets==0 fixed! else if(abs(a).le.1e-3)then theta=pi/2.0 else sinphi=sqrt(1-c*c/rou/rou) theta=acos(a/rou/sinphi) endif endif if(b.lt.0)theta=-theta+pi !all is in degree a=rou b=theta/h c=phi/h !in radius else !polar to Cartesan rou=a if(rou.eq.0)then a=0 b=0 c=0 goto 80 endif theta=b*h phi=c*h c=rou*cos(phi) !z b=rou*sin(phi)*sin(theta) !y a=rou*sin(phi)*cos(theta) !x endif 80 continue !print*,"a b c",a,b,c,iflag END subroutine trans |

木蟲 (正式寫手)
|
另一個(gè)是計(jì)算二面角的,不需要極坐標(biāo)轉(zhuǎn)換(慢) 你說(shuō)二個(gè)平面重合時(shí),二面角等于0;也可以設(shè)為pi !!this sub to calculate torsion angle !!calculate torsion angle REF:wiki dihedral angle !! ¦Ó (a, b, c) = arg (¡Ýa N7 c + (a N7 b)(b N7 c), a N7 (b NW c)) . !!¦È = arg(x, y) !!cos ¦È = x/ (x2 + y 2 ) and sin ¦È = y/ (x2 + y 2 ). function torsion_angle(tia1,tia2,tia3,tia4) !4個(gè)atom series implicit none real torsion_angle real ax,ay,az,bx,by,bz,cx,cy,cz,r1,r2,r3 real tab,tac,tbc,t1,ctbcx,ctbcy,ctbcz,ctbax,ctbay,ctbaz,t2 integer tia1,tia2,tia3,tia4 ax=xx(tia2)-xx(tia1) ay=yy(tia2)-yy(tia1) az=zz(tia2)-zz(tia1) bx=xx(tia3)-xx(tia2) by=yy(tia3)-yy(tia2) bz=zz(tia3)-zz(tia2) cx=xx(tia4)-xx(tia3) cy=yy(tia4)-yy(tia3) cz=zz(tia4)-zz(tia3) r1=sqrt(ax*ax+ay*ay+az*az) r2=sqrt(bx*bx+by*by+bz*bz) r3=sqrt(cx*cx+cy*cy+cz*cz) if(r1*r2*r3<0.001)then torsion_angle=0.0 goto 33 endif ax=ax/r1 ay=ay/r1 az=az/r1 bx=bx/r2 by=by/r2 bz=bz/r2 cx=cx/r3 cy=cy/r3 cz=cz/r3 tab=ax*bx+ay*by+az*bz !dot product tac=ax*cx+ay*cy+az*cz tbc=bx*cx+by*cy+bz*cz t1=tab*tbc-tac ctbcx=by*cz-bz*cy !cross product bxc ctbcy=bz*cx-bx*cz ctbcz=bx*cy-by*cx ctbax=by*az-bz*ay !cross product bxa ctbay=bz*ax-bx*az ctbaz=bx*ay-by*ax t2=ax*ctbcx+ay*ctbcy+az*ctbcz !last term torsion_angle=acos(t1/sqrt(t1*t1+t2*t2)) !!0~pi !!judge the r2xr3 angle with r1, if acute (-180,0),else(-180,0) if(t2<0)torsion_angle=-1.0*torsion_angle !-pi~0 33 return end function torsion_angle |

| 8 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 293求調(diào)劑 +3 | 濤濤Wjt 2026-03-22 | 5/250 |
|
|---|---|---|---|---|
|
[考研] 307求調(diào)劑 +11 | 冷笙123 2026-03-17 | 11/550 |
|
|
[考研] 一志愿上海交大生物與醫(yī)藥專碩324分,求調(diào)劑 +3 | jiajunX 2026-03-22 | 3/150 |
|
|
[考研] 一志愿華中農(nóng)業(yè)071010,總分320求調(diào)劑 +5 | 困困困困坤坤 2026-03-20 | 6/300 |
|
|
[考研] 287求調(diào)劑 +8 | 晨昏線與星海 2026-03-19 | 9/450 |
|
|
[考研] 求調(diào)劑 +6 | 十三加油 2026-03-21 | 6/300 |
|
|
[考研] 306求調(diào)劑 +5 | 來(lái)好運(yùn)來(lái)來(lái)來(lái) 2026-03-22 | 5/250 |
|
|
[考研] 考研調(diào)劑 +4 | 來(lái)好運(yùn)來(lái)來(lái)來(lái) 2026-03-21 | 4/200 |
|
|
[考研] 0703化學(xué)調(diào)劑 +4 | 妮妮ninicgb 2026-03-21 | 4/200 |
|
|
[考研] 工科0856求調(diào)劑 +3 | 沐析汀汀 2026-03-21 | 3/150 |
|
|
[考研] 296求調(diào)劑 +4 | www_q 2026-03-20 | 4/200 |
|
|
[考研] 299求調(diào)劑 +6 | △小透明* 2026-03-17 | 6/300 |
|
|
[考研] 一志愿武理材料305分求調(diào)劑 +6 | 想上岸的鯉魚 2026-03-18 | 7/350 |
|
|
[考研] 一志愿蘇州大學(xué)材料求調(diào)劑,總分315(英一) +5 | sbdksD 2026-03-19 | 5/250 |
|
|
[考研] 求調(diào)劑一志愿南京航空航天大學(xué)289分 +3 | @taotao 2026-03-19 | 3/150 |
|
|
[考研] 工科材料085601 279求調(diào)劑 +7 | 困于星晨 2026-03-17 | 9/450 |
|
|
[考研] 085601材料工程專碩求調(diào)劑 +10 | 慕寒mio 2026-03-16 | 10/500 |
|
|
[考博] 26博士申請(qǐng) +3 | 1042136743 2026-03-17 | 3/150 |
|
|
[碩博家園] 湖北工業(yè)大學(xué) 生命科學(xué)與健康學(xué)院-課題組招收2026級(jí)食品/生物方向碩士 +3 | 1喜春8 2026-03-17 | 5/250 |
|
|
[考研] 一志愿南京大學(xué),080500材料科學(xué)與工程,調(diào)劑 +4 | Jy? 2026-03-16 | 4/200 |
|