| 1 | 1/1 | 返回列表 |
| 查看: 183 | 回復(fù): 0 | ||
chrislan625新蟲 (小有名氣)
|
[求助]
請教一個用門特卡羅計算合金二維面上原子排列隨機度的問題
|
|
有大概的框架 可是6個地方的代碼不太會寫 function [ config ] = alloy( nBox, fAlloy, nSweeps, T, Eam ) %ALLOY Performs Metropolis Monte Carlo of a lattice gas model of an alloy % A random alloy is represented as a 2 dimensional lattice gas in which % alloying atoms can exchange position with matrix atoms using the % Metropolis alogorithm. The purpose is to show how alloys become more % random as the temperature increases. % % Input arguments % nBox The size of the 2-D grid % fAlloy The fraction of sites occupied by alloying atoms % nSweeps The number of Monte Carlo moves % T The temperature (K) % Eam Alloy-matrix interaction energy (eV) % % Output arguments % config The final configuration % % Set interactions between like atoms to zero % Eaa Alloy-alloy interaction energy (eV) % Emm Matrix-matrix interaction energy (eV) % Emm = 0.0; Eaa = 0.0; % % Compute kT in eV % kB = 8.617332e-5; kT = kB*T; % % Initialize the configuartion % 1 Matrix atoms % 2 Alloy atoms % %%% PUT CODE HERE % % Set up energy matrix % Ematrix(1,1) = Emm; Ematrix(1,2) = Eam; Ematrix(2,1) = Eam; Ematrix(2,2) = Eaa; % % Carry out the random swaps % %%% PUT CODE HERE % % Plot the configuration. Put extra zeros around border so pcolor works % properly. % config_plot = zeros(nBox+1); config_plot(1:nBox, 1:nBox) = config; pcolor(config_plot); end function [ixb iyb dE] = swapInfo(ixa, iya, dab, nBox, config, Ematrix) %SWAPINFO Returns the position of the neighbour and the energy change % following a swap % % Input arguments % ixa X coordinate of first atom % iya Y coordinate of first atom % dab Direction of second atom relative to first. There are four % possible directions, so this takes values between 1 and % 4. Together with ixa and ixb, this allows the position % of the second atom to be computed. This calculation is % done by getNeighbour % config The configuration of alloy atoms % nBox System size % Ematrix The 2x2 matrix of bond energies % Output arguments % ixb X coordinate of second atom % iyb Y coordinate of second atom % dE Energy change following swap % % Find neighbour atom % %%% PUT CODE HERE % % Find energy change % %%% PUT CODE HERE % function [ix2 iy2] = getNeighbour (ix1, iy1, d12) %GETNEIGHBOUR returns the position of a neighbouring atom % % Input arguments % ix1 X coordinate of first atom % iy1 Y coordinate of first atom % d12 Direction of second atom relative to first % Output arguments % ix2 X coordinate of second atom % iy2 Y coordinate of second atom % % Find new x coordinate % %%% PUT CODE HERE % % Find new y coordinate % %%% PUT CODE HERE end end |
| 1 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 材料調(diào)劑 +4 | 一樣YWY 2026-03-31 | 4/200 |
|
|---|---|---|---|---|
|
[考研] 材料調(diào)劑 +9 | Eujd1 2026-03-31 | 10/500 |
|
|
[考研] 生物學(xué)296求調(diào)劑 +8 | 湯圓包 2026-03-29 | 12/600 |
|
|
[考研] 材料專碩調(diào)劑 +13 | 椰椰。 2026-03-29 | 13/650 |
|
|
[考研] 本科211生物醫(yī)學(xué)工程085409求調(diào)劑339分 +7 | 里子木yy 2026-03-29 | 7/350 |
|
|
[考研] 求調(diào)劑 +8 | 11ggg 2026-03-30 | 8/400 |
|
|
[考研] 334求調(diào)劑 +7 | Trying] 2026-03-31 | 7/350 |
|
|
[考研] 370求調(diào)劑 +3 | 080700調(diào)劑 2026-03-30 | 3/150 |
|
|
[考研] 281求調(diào)劑 +5 | 亞克西good 2026-03-26 | 7/350 |
|
|
[考研] 310求調(diào)劑 +10 | 爭取九點睡 2026-03-30 | 10/500 |
|
|
[考研] 318一志愿吉林大學(xué)生物與醫(yī)藥 求調(diào)劑 +5 | 篤行致遠. 2026-03-28 | 5/250 |
|
|
[考研] 085701環(huán)境工程,267求調(diào)劑 +16 | minht 2026-03-26 | 16/800 |
|
|
[考研] 292求調(diào)劑 +14 | 鵝鵝鵝額額額額?/a> 2026-03-25 | 15/750 |
|
|
[考研] 275求調(diào)劑 +10 | jjjjjjjjjjl 2026-03-27 | 10/500 |
|
|
[考研] 考研調(diào)劑 +9 | 小蠟新筆 2026-03-26 | 9/450 |
|
|
[考研] 一志愿吉大071010,316分求調(diào)劑 +3 | xgbiknn 2026-03-27 | 3/150 |
|
|
[碩博家園] 北京林業(yè)大學(xué)碩導(dǎo)招生廣告 +6 | kongweilin 2026-03-26 | 8/400 |
|
|
[考研]
|
平樂樂樂 2026-03-26 | 4/200 |
|
|
[考研] 打過很多競賽,085406控制工程300分,求調(diào)劑 +3 | askeladz 2026-03-26 | 3/150 |
|
|
[考研] 材料專碩 335 分求調(diào)劑 +4 | 拒絕冷暴力 2026-03-25 | 4/200 |
|