Calculate Elastic Constants#
The Project class is imported from the pyiron_atomistics module.
from pyiron_atomistics import Project
/Users/jan/mambaforge/lib/python3.12/site-packages/nglview/__init__.py:12: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
import pkg_resources
We then create a Project named elastic for the calculation of the elastic matrix and again we remove all existing calculation in this project to have a fresh start.
pr = Project("materials")
pr.remove_jobs(silently=True)
Following the same steps as in the previous tutorial on calculating energy volume curves, we again create a reference LAMMPS job to specify the atomistic structure and the interatomic potential.
job_lmp = pr.create.job.Lammps(job_name="lmp")
job_lmp.structure = pr.create.structure.ase.bulk(name="Al", cubic=True)
job_lmp.potential = "1999--Mishin-Y--Al--LAMMPS--ipr1"
The reference job is assinged to the ElasticMatrixJob afterwards. This ElasticMatrixJob is again an GenericMaster job which does not interface to a specific simulation code but rather coordinates the execution of multiple individual calculation to calculate a combined property, in this case the elastic constants.
job_elastic = pr.create.job.ElasticMatrixJob(job_name="elastic")
job_elastic.ref_job = job_lmp
job_elastic.input
| Parameter | Value | Comment | |
|---|---|---|---|
| 0 | num_of_points | 5 | number of sample point per deformation directions |
| 1 | fit_order | 2 | order of the fit polynom |
| 2 | eps_range | 0.005 | strain variation |
| 3 | sqrt_eta | True | calculate self-consistently sqrt of stress matrix eta |
The ElasticMatrixJob can then be executed by calling the run() method. Once again by leveraging the same abstract job class for individual calculation like the LAMMPS job object as well as GenericMaster jobs like the ElasticMatrixJob both jobs can be distributed to queuing systems and so on. Here the job is just executed in-line with the python process of the jupyter notebook, which is called modal execution in pyiron.
job_elastic.run()
The job elastic was saved and received the ID: 143
/Users/jan/projects/atomistics/atomistics/workflows/elastic/symmetry.py:32: DeprecationWarning: dict interface is deprecated. Use attribute interface instead
SGN = dataset["number"]
The job s_e_0 was saved and received the ID: 144
The job s_01_e_m0_00500 was saved and received the ID: 145
The job s_01_e_m0_00250 was saved and received the ID: 146
The job s_01_e_0_00250 was saved and received the ID: 147
The job s_01_e_0_00500 was saved and received the ID: 148
The job s_08_e_m0_00500 was saved and received the ID: 149
The job s_08_e_m0_00250 was saved and received the ID: 150
The job s_08_e_0_00250 was saved and received the ID: 151
The job s_08_e_0_00500 was saved and received the ID: 152
The job s_23_e_m0_00500 was saved and received the ID: 153
The job s_23_e_m0_00250 was saved and received the ID: 154
The job s_23_e_0_00250 was saved and received the ID: 155
The job s_23_e_0_00500 was saved and received the ID: 156
After the successful execution the elastic matrix can be loaded from the output:
job_elastic.content["output/elasticmatrix"]
{'A2': array([2.20131074, 1.0898606 , 1.18621364]),
'AVR': 0.33540604815386094,
'LC': 'CI',
'Lag_strain_list': ['01', '08', '23'],
'SGN': 225,
'bulkmodul_hill': 78.37530286259853,
'bulkmodul_reuss': 78.37530286259855,
'bulkmodul_voigt': 78.37530286259852,
'e0': -13.4399999525399,
'elastic_matrix': array([[114.10393025, 60.51098917, 60.51098917, 0. ,
0. , 0. ],
[ 60.51098917, 114.10393025, 60.51098917, 0. ,
0. , 0. ],
[ 60.51098917, 60.51098917, 114.10393025, 0. ,
0. , 0. ],
[ 0. , 0. , 0. , 31.67539615,
0. , 0. ],
[ 0. , 0. , 0. , 0. ,
31.67539615, 0. ],
[ 0. , 0. , 0. , 0. ,
0. , 31.67539615]]),
'elastic_matrix_eigval': (array([ 53.59294108, 235.12590859, 53.59294108, 31.67539615,
31.67539615, 31.67539615]),
array([[-0.81649658, 0.57735027, -0.28151199, 0. , 0. ,
0. ],
[ 0.40824829, 0.57735027, -0.52299339, 0. , 0. ,
0. ],
[ 0.40824829, 0.57735027, 0.80450538, 0. , 0. ,
0. ],
[ 0. , 0. , 0. , 1. , 0. ,
0. ],
[ 0. , 0. , 0. , 0. , 1. ,
0. ],
[ 0. , 0. , 0. , 0. , 0. ,
1. ]])),
'elastic_matrix_inverse': array([[ 0.01385713, -0.00480204, -0.00480204, 0. , 0. ,
0. ],
[-0.00480204, 0.01385713, -0.00480204, 0. , 0. ,
0. ],
[-0.00480204, -0.00480204, 0.01385713, 0. , 0. ,
0. ],
[ 0. , -0. , -0. , 0.03157024, -0. ,
-0. ],
[ 0. , 0. , 0. , 0. , 0.03157024,
0. ],
[ 0. , 0. , 0. , 0. , 0. ,
0.03157024]]),
'epss': array([-0.005 , -0.0025, 0. , 0.0025, 0.005 ]),
'id': [144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156],
'poissonsratio_hill': 0.33215624923377535,
'poissonsratio_reuss': 0.332656402370394,
'poissonsratio_voigt': 0.3316564713766526,
'shearmodul_hill': 29.624463663621356,
'shearmodul_reuss': 29.525101420760425,
'shearmodul_voigt': 29.723825906482283,
'strain_energy': [[(-0.005, -13.4363185714577),
(-0.0025, -13.4390788376811),
(0.0, -13.4399999525399),
(0.0024999999999999996, -13.4390858183698),
(0.005, -13.4363660001546)],
[(-0.005, -13.4381735900115),
(-0.0025, -13.4395440746185),
(0.0, -13.4399999525399),
(0.0024999999999999996, -13.4395487907129),
(0.005, -13.438205313737)],
[(-0.005, -13.4379714273631),
(-0.0025, -13.4395010321449),
(0.0, -13.4399999525399),
(0.0024999999999999996, -13.4395157791674),
(0.005, -13.4380894168307)]],
'v0': 66.43012500000002,
'youngsmodul_hill': 78.92882879938419,
'youngsmodul_reuss': 78.6936308780232,
'youngsmodul_voigt': 79.16385024488028}