exercises:2018_ethz_mmm:mc2018
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| exercises:2018_ethz_mmm:mc2018 [2018/03/06 14:22] – dpasserone | exercises:2018_ethz_mmm:mc2018 [2020/08/21 10:15] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Monte Carlo simulations for the estimation of molecule | + | ====== Monte Carlo simulations for the estimation of pair interactions |
| ===== | ===== | ||
| In this exercise you will perform a MC simulation for different coverages of " | In this exercise you will perform a MC simulation for different coverages of " | ||
| Line 9: | Line 9: | ||
| - | < | ||
| - | wget | ||
| - | </code> | + | Please download the program **monte_carlo.py** from [[https:// |
| + | |||
| </ | </ | ||
| Line 46: | Line 46: | ||
| <note important> | <note important> | ||
| **TASK 1** | **TASK 1** | ||
| - | Execute the program with parameters: | + | Execute the program |
| + | < | ||
| + | python monte_carlo.py | ||
| + | </ | ||
| + | with parameters: | ||
| < | < | ||
| Line 61: | Line 65: | ||
| n0 is the concentration of dimers in the case of zero interaction | n0 is the concentration of dimers in the case of zero interaction | ||
| nexp is the concentration of dimers found in the experiment | nexp is the concentration of dimers found in the experiment | ||
| + | <note warning> | ||
| To compute the concentration consider that at coverage 0.02, in the simulation, the total number of molecules is 50 | To compute the concentration consider that at coverage 0.02, in the simulation, the total number of molecules is 50 | ||
| + | </ | ||
| </ | </ | ||
| - | < | + | < |
| **TASK2** | **TASK2** | ||
| repeat the simulation using as DE your estimate. | repeat the simulation using as DE your estimate. | ||
| What do you get? | What do you get? | ||
| + | </ | ||
| + | <note important> | ||
| **TASK3** | **TASK3** | ||
| - | Repeat the simulation with coverage 0.1 and DE=-0.02 | + | Repeat the simulation with coverage 0.1 and DE=-0.02 |
| Describe what you obtain. | Describe what you obtain. | ||
| Now try coverage=0.1 T=400 DE=-0.1 | Now try coverage=0.1 T=400 DE=-0.1 | ||
| Comment the result | Comment the result | ||
| + | </ | ||
| + | <note important> | ||
| **TASK4** | **TASK4** | ||
| - | have a look at the pyhton code, identify the main MC steps in the MAIN part of the code | + | have a look at the pyhton code, identify the outer loop, |
| + | mainly responsible | ||
| < | < | ||
| - | clusters_plot=[] | + | #### outer loop of the siulation |
| for i in range(nouter): | for i in range(nouter): | ||
| - | + | </ | |
| - | and also the section | + | and then identify |
| + | < | ||
| + | #### inner loop of 1000 steps | ||
| + | </ | ||
| + | and | ||
| + | < | ||
| #### DECIDE whether to accept or not the move | #### DECIDE whether to accept or not the move | ||
| Line 95: | Line 110: | ||
| </ | </ | ||
| </ | </ | ||
| - | < | + | < |
| - | The most complex (and unefficient) sections of the code are the two functions | + | **TASK 5** The most complex (and unefficient) sections of the code are the two functions |
| < | < | ||
| def allconnected(m, | def allconnected(m, | ||
| Line 105: | Line 120: | ||
| </ | </ | ||
| which finds out all the molecules that are 1st neighbors to a given one. | which finds out all the molecules that are 1st neighbors to a given one. | ||
| + | <note warning> | ||
| + | To understand these sections you have to refer to the graph of the hexagonal lattice | ||
| + | with the convention adopted for the coordinate system. | ||
| The function " | The function " | ||
| - | you imagine roughly a more efficient function to perform the same task? | + | you imagine roughly a more efficient function to perform the same task? |
| + | Just think how you would do the task of identifying, | ||
| + | an isolated dimer and thr ones that form clusters. Google can help you :) (you do not have to find a solution) | ||
| </ | </ | ||
| - | < | + | </note> |
| + | <note important> | ||
| + | **TASK 6** | ||
| The code, at each step, moves a particle chosen randomly to a new site chosen randomly. | The code, at each step, moves a particle chosen randomly to a new site chosen randomly. | ||
| **Would it be correct to move all particles in a step? | **Would it be correct to move all particles in a step? | ||
exercises/2018_ethz_mmm/mc2018.1520346171.txt.gz · Last modified: (external edit)
