M3 Materials modelling: a tension experiment in atomistic detail
Part IB laboratory exercise
Michaelmas Term, 2020, Engineering Laboratory, University of Cambridge, Prof. Gábor Csányi (gc121)
In this exercise you will learn how to model materials on the atomic scale, and use the model to investigate how metals respond under tensile stress. Simulating the response in such detail will allow you an insight into what happens on the smallest scales when a material is under load, how the Poisson ratio arises. At the end of the exrcise, you will see an example of how dislocations are generated and interact, which is the basis for the plastic response of the material. Large scale plasticity is of course more complicated, and depends on the interactions of an immense number of dislocations as well as grain boundaries and more rigid inclusions.
In the course of the exercise, you will:
- Create and manipulate atomic scale structural models of crystalline matter
- Learn how to compute simple elastic properties of single crystal copper (Cu)
- Observe a strain controlled tensile test simulation of a notched bar, and the nucleation of dislocations
This activity introduces you to scientific computing, the use of programming and numerical techniques to model, investigate and learn about a technical subject, in this case materials engineering. There is no extended programming required, and no significant software engineering skills introduced, beyond close reading of documentation.
Working on your own
This is a purely computational laboratory exercise, with no assigned laboratory time. You will be working on your own, but there is a forum on Moodle where you can get guidance and help if you have any technical questions or if you get stuck. It is monitored daily by demonstrators, especially between 2-3pm.
The assigned times in the rota are for marking, and serve as deadlines. You are encouraged to not leave things to the last minute, and you can get marked up for this lab at the DPO helpdesk any time before the deadline assigned to your lab group.
You will be using a python package called Atomic Simulation Environment (ASE), which you will need to download if you want to run this notebook on your own computer. It has excellent tutorials at its documentation page, but the first few exercises below will teach you many of the elements of ASE you will need for this project. Also try to install the
matscipy package (which needs a working C++ compiler), if that is successful your simulations will be much faster.
It is recommended that you obtain a Python environment on your own computer such as Anaconda. However, much of this exercise can be completed using a cloud-based notebook server, such as Deepnote, in which case you can try installing the needed packages by using
!pip install ase, etc. directly in your notebook. Not all cloud-based servers will let you install packages, and the second part of the exercise is much easier done on your own computer. But Deepnote for example lets you open text terminal (console) to the virtual machine it is running on, so you can execute all the ! commands directly on the console.
!pip install ase and
!pip install matscipy commands also work in an
anaconda Python console or a Jupyter notebook that is running on your own computer, or without the "!" in a normal command terminal.
Note: There are several files associated with this notebook, both images and python code (e.g. Morse.py), make sure they are in the same folder as this notebook.
There is also a Morse module inside ASE (under
ase.calculators), but that is not implemented correctly (at the time of writing), so make sure below that you import the one that is supplied here and saved in the current directory.
Notes for various operating systems
On Mac OS, it is recommended that you do not work with the Python supplied by Apple, but get your own, e.g. Anaconda, or use Homebrew.
On Windows, you will need MS Visual C++ in order to use the matscipy package (MSVC++ version 14 for use with Python versions > 3.5). Windows is difficult from the point of view of scientific computing, and you may not be able to install matscipy in the end. The lab can be done without it.
If you are working on the Linux workstations in the Department, see this page on how to install new Python packages for yourself.
Much of this lab is about the application of programming in order to model engineering problem, rather than learning new programming skills. Use the techniques that you learned in the Part IA Lent Computing Exercise, and review them before you start if necessary. In particular:
- The first half of the exercise is to be done in this notebook right here.
- Please use Python 3 rather than earlier versions.
- Keep to the good code documentation practices you learned in Part IA.
It will be assumed from now on that you know how to use these tools.
Materials and structural engineering
Since the topic of this exercise is the response of matter to loading, it will be beneficial if you review the related concepts in the IA Materials and Structures courses, particularly on stress, strain, bulk modulus, shear modulus, Poisson ratio, and dislocations.
Learning objectives and assessment
- Making connections between abstract concepts of elastic deformation and numerical representations in a compute model
- Ability to calculate elastic properties of materials numerically using an atomistic model
- Identifying atomic scale processes underlying plastic deformation via dislocation nucleation and glide
- Effective use of python programming, as developed in Part IA
- Appropriate use of NumPy arrays, functions, Python classes, class members and member functions.
The following criteria will be used in assessing your implementation. Markers will want to view your Notebook for the elasticity calculations, see your analysis for the tension test simulation.
Your Notebook should display an understanding of the basic aspects of materials engineering involved. Your results should have the correct units, plots have axes correctly labeled.
- Your notebook and programs should execute without error.
- Programs should be correct and achieve the specified deliverables.
- Numerical results should be printed with notes on what they represent, and appropriate units.
- Clarity and structure of the code implementations.
- Re-use of functions and python objects where appropriate.
- Documentation of your functions, and comments in the Notebook and standalone code to enhance readability
Deliverables and Deadlines
The rest of this notebook contains background information that you need to understand the exercise, bits of example code that teaches you how to use the ASE package, and specific deliverables (marked in bold) that you need to present to the markers.
We start with basic usage of ASE, computation of the elastic properties of a single crystal of copper. Do the tasks right here in this notebook. Bring the completed notebook to the a marking session. Do the exercise in your own time, but make sure you get marked by the demonstrators in the DPO by your allocated deadline, which is given for your lab group in the rota. There is a list of marking dates and times here, but these are just the final deadlines, you can go to get marked any time in the DPO when the helpdesk is open, 2-4pm every day.