The triangle raft algorithm was originally developed to make hand-built models of 2D glasses [1]. As part of my PhD I have modified this algorithm into a flexible computational version, to generate networks with tuneable properties [2].
The C++ code to generate these structures is included here, along with some python visualisation tools.
For some example outputs please check out the gallery!
Compilation is easiest using CMake. To compile the code execute the following in terminal:
cd src/
cmake .
make
As the code is relatively computationally intensive, it is recommended that in the
CMakeCache.txt
you set CMAKE_BUILD_TYPE:STRING=Release
before making.
The generated executable is called mx2.x
(this is for chemistry reasons, the network
in a chemical sense has this formula).
The parameters for the calculation can be found in mx2.inpt
which are read at runtime.
I would like to say that it is self-explanatory, but as a wise person once said you learn
more about a code if I don't tell you what all the numbers mean...
However, the key parts are as follows:
1: /path/to/starting/seed
the algorithm needs a seed to start the calculation, this can be a previous output or
can be generated with the python scriptpython python_scripts/make_poly_seed.py 6
.
7: 4 10 ring size limits
This pair of numbers determines the size of rings that can be built. The lower should be set to 4, the upper can be anything you like >6, but this will slow the code down!
8: 2DC/2DS geometry code
If set to 2DC output will be circular, 2DS will be square.
12: <temperature>
This controls the width of the ring size distribution, the suitable range for which will depend on the potential model. If this remains unchanged T~10-5 to 10-2 should be about right.
Running mx2.x
will read the input file and start the code. A log file, mx2.log
,
will also be produced which is quite verbose. Some things to note:
- The code is not wickedly fast and increasing the ring size limits in particular will slow it down.
- As is the nature of Monte Carlo codes, rarely it will run into irreconcilable cases where the algorithm cannot continue. In this case the final structure is written. If the temperature is set too high this will happen more often.
After the code has finished there should be six .out
files, prefixed with your output prefix.
Of these two are probably of the most interest: prefix_atoms.out
gives the atomic number (O or Si), coordination
and coordinates of the final configuration; prefix_analysis.out
contains analysis information
on the ring statistics and bond lengths and angles.
The remaining files specify connectivities. These are needed for visualisation, which can be achieved with:
python python_scripts/visualise_network.py prefix <flags>
where the choice of flags is as follows:
- -r show rings
- -t show triangles
- -tmx show triangles and atoms
- -s or -S save as .pdf or .png
This is a very brief overview of the code, designed to get some output. Please let me know if you want to use it for research purposes and I will help you get to grips with it.