Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
1) (5 marks) Generate a 2d square lattice which has nx x nx vertices (where nx is easily
inputted by the user).
2) (5 marks) Build a system where there is a density r of discs placed randomly onto the
lattice. There will be two types of discs in the simulations (A & B), and you will need to
randomly assign type A to a fraction fA of the discs and the rest of the discs to type B.
Therefore the following relationship between the fraction of the discs that are type A and the
fraction that are type B, fB, will hold: fA + fB = 1. (r and fA both need to be easily inputted by
the user).
3) (30 marks) Calculate the energy of each configuration of the system. In this simulation, we
will simplify things by saying that the energy of any disc at a given vertex on the lattice (say
vertex with coordinates (vx,vy)) is only affected by what species are found in the nearest
neighbour sites to that vertex (e.g. (vx+1,vy), (vx-1,vy), (vx,vy+1), (vx,vy-1)). The contributions to
the energy of each interacting vertex will be dependent on the species which occupy each
vertex. If either interacting vertex is vacant then it will contribute nothing to the energy,
whereas the other possibilities have the following contributions:
• type A on both interacting vertices: energy contribution is eAA
• type A on one vertex, type B on the other vertex: eAB
• type B on both vertices: eBB
(eAA, eAB & eBB need to be easily inputted by the user). Also note that you will need to ensure
that the vertices on the outer edges of the lattice interact via periodic boundary conditions,
as otherwise you will have significant finite size effects.
4) (5 marks) Develop a swap move in order to allow the system to evolve over the course of
the simulation. In this swap move, you should randomly chose a vertex which is occupied by
a disc and then swap its identity (type A or B) with the identity of another randomly chosen
vertex (type A, B or vacant).
5) (10 marks) Employ the Metropolis criteria as to whether or not to accept a swap move. For
this you will need to allow the user to easily input the temperature T that the simulation is to
take place at. The simulation should be able to carry out as many attempted moves (nmoves)
as desired by the user (this value should be easily inputted by the user). Your code should
output the energy after each attempted move, the acceptance ratio after each move (number
of accepted moves divided by the number of moves attempted), and whether the last move
was accepted or rejected.
6) (5 marks) Produce pictures of the initial and final configurations of the studied systems in
which the vertices are coloured differently depending on whether they contain a disc of type
A or type B or are vacant.
Questions: (50 marks)
1) (20 marks) Provide the requested output for two different simulations with the inputs as
described in the table below:
Input Sim 1 Sim 2
nx 50 50
r 0.95 0.95
fA 0.3 0.5
eAA -4.0 kcal/mol 2.0 kcal/mol
eAB 2.0 kcal/mol -2.0 kcal/mol
eBB -2.0 kcal/mol 2.0 kcal/mol
T 300 K 300 K
nmoves 1,000,000 1,000,000
Describe the final configurations (e.g. are A and B mixed or separated?) What kind of
materials would A and B be representative of in the two simulations?
2) (5 marks) Explain why the mixing or lack thereof in the two systems makes sense when
considering the values of eij used in the two simulations.
3) (10 marks) Choose one system and investigate how varying (a) the temperature (T) and (b)
the density (r) affects the evolution of the system, the evolution of the energy of the system
and the acceptance ratio.
4) (5 marks) Briefly describe how you would modify your code to simulate the evolution of
the same two types of discs in two-dimensional space where the system is not defined by a
lattice. (Please consider not only the representation of the discs but also movement and
determination of the energies).
5) (5 marks) Compare the final energies of the two simulations. Briefly provide a physical
description of why the energies are the same/different.
6) (5 marks) Have the systems reached their global energy minimum? Discuss, making
reference to both the energy of the system and the figure of the final frame.
Extra credit: (10 marks)
If you would like a further challenge, and the ability to earn up to 10 extra marks, then below
are a couple of potential extensions that you could incorporate into your model. (NOTE: the
maximum overall percentage of all marks will be 100%, so in this case if the maximum number
of marks that will be assigned when counting the marks from the code, questions and extra
credit is 110.)
1) [10 marks] Incorporate into your code, a displacement move in which a disc is chosen at
random and then a direction [(1,0),(-1,0),(0,1) or (0,-1)] and the disc is moved into that vertex,
if it is vacant. The energies are evaluated before and after the move and then the move would
be accepted/rejected with the Metropolis criteria. [NOTE: you would only make either a
translation or a swap move during each iteration of the code, so you would probably also
want to have some probability assigned to how often each type of move is used in the
simulation, and then you would want to first determine randomly which type of move to try.]
Then use this move with the swap move for one of the previously studied systems and
compare the acceptance ratio and energies after a similar number of total moves, and see if
the incorporation of the translation move improves the efficiency of the search of the energy
landscape or not.