1. Introduction
The mechanical properties of 2D materials, such as graphene [
1], hexagonal boron nitride [
2], transition metal dichalcogenide [
3] and phosphorene [
4] are crucial for determining their potential applications and performance. These materials have unique mechanical properties, such as proper strength and stiffness [
5,
6], which make them suitable for a wide range of applications, including electronics [
7], energy storage [
8], catalyst [
9], sensors [
10] and magnetic devices [
11]. The mechanical behavior of 2D materials can be influenced by various factors, including their structure [
12], defects [
13], and interfaces with other materials [
14]. Accurately characterizing the mechanical properties of 2D materials is therefore essential for understanding and optimizing their performance in different applications. In particular, the second-order elastic constants (SOECs) tensor [
15], which describes the material’s response to an applied strain, is a key factor in determining the mechanical properties of 2D materials.
The calculation of SOECs and relevant mechanical properties of 2D materials via first principles simulation is a tedious and time-consuming task, which requires considering different symmetries of materials and configuring efficient computational resources [
16]. Previous research has proposed algorithms and tools, such as ELASTool [
17], MECHELASTIC [
18], ElATools [
19] and vaspkit [
20], to reduce computational complexity and analyze mechanical properties. However, research gaps still exist in the field of calculating and analyzing the mechanical properties of two-dimensional materials. A clear mathematical principle for SOEC calculation of 2D materials is missing, and the presented tools lack the basic functions for task submission, monitoring, and data collection, which are crucial for high-throughput calculations [
21,
22]. Therefore, it is important to present mathematical principles of 2D SOECs calculation and develop an automated tool that can quickly and efficiently calculate and analyze SOECs tensor and other relevant mechanical properties of 2D materials.
In this work, we design mech2d, a highly automated toolkit for calculation, analysis and visualization the mechanical properties of 2D materials. To be specific, Mech2d allows for the calculation of SOECs using both the strain-energy approach and the stress-strain approach, utilizing first-principles engines such as Vienna ab initio simulation package (VASP)[
23,
24]. The strain-energy approach (SE) concerns calculating the total energy of the system as a quadratic function of strain, while the stress-strain approach (SS) involves calculating the stress as a linear function of strain. Both approaches can be used to evalute the mechanical properties of 2D materials. Particularly, mech2d support to automatically submit and collect tasks from local or remote machines, making it suitable for high-throughput calculations [
21,
22]. This is particularly useful for evaluating the mechanical properties of a large number of 2D materials as it allows for efficient and robust calculations without the need for manual intervention [
13]. The effectiveness of mech2d has been demonstrated based on the validation on several common 2D materials, including graphene [
1], black phosphorene [
4], and GeSe
2[
25] et al.
2. Methods
According to the Lagrangian theory of elasticity, solid can be viewed as a homogeneous and an-isotropic elastic medium [
15]. The fundamental relationship between physical stress tensor
(in this work all of the bold font letter present the matrix or vector) and physical strain tensor
of the solid crystalline body within the linear regime is connected by generalized Hook’s law [
15]:
According to the generalized Hook’s law, it can be found that physical stress tensor
is a linear function of physical strain tensor
, where the proportionality coefficient is forth-rank elastic tensor
. Generally, it is more convenient to use Lagrangian stress tensor
and Lagrangian strain tensor
, the corresponding generalized Hook’s law also has the similar formula:
The relationship between Lagrangian stress tensor
and physical stress
tensor is defined as
where,
is the determinant of matrix,
is the
identity matrix and the physical stress tensor
can be calculated by second order differentiation of the total energy
E:
where
V is the volume of the crystal. The Lagrangian strain tensor
expression is
As a center physical quantity, the elastic tensor
can be approached in many different ways. From experiment aspect, the elastic tensor can be obtained based on sound velocity with very high precision. From theoretical aspect, elastic constant can be calculated by either the energy-strain or stress-strain approach [
26] since most of popular DFT engines can calculate energy and stress precisely. According to the Taylor’s series, the total energy
E of a crystal can be expressed as the summation of a power series of the Lagrangian strain
:
where
and
are the energy and volume of the equilibrium structure. By using the Voigt notation (
,
,
,
,
and
) , the Equation (
6) can be simplified as:
In similar way, the Equation (
3) can be read as:
Therefore, under strain-energy approach, the elastic constant
can be expressed as
and for stress-strain approach, the expression is
As for 2D materials, we assume that the crystal lies in the
plane; therefore, all of the elements with subscript including
z will be zero. To simplify the formula, we may rewrite total energy
E and generalize Hook’s law in matrix format:
and
As can be seen, the maximum number of independent elastic constants of 2D materials has been reduced to 6 compared with their bulk counterpart (
21). Considering that symmetry plays an important role in elastic properties, the number of independent elastic constants of different 2D crystal structure can be further reduced according to their lattice type. Specifically, the independent elastic constants and Born stability conditions for five 2D plan Bravais (see
Figure 1) lattice are listed as follow [
27]:
3) Rectangular and centered rectangular lattice
After the theoretical introduction, we pay our attention to how to calculate elastic constant C via state-of-art DFT calculation. Here, we take square lattice as an example to show how to calculate the independent elastic constant based on energy-strain approach. It should be noted that the nature of this problem is to solve the linear equation. For squared lattice, there are 3 independent elastic constant (, and ), which means that we need at least 3 equations to solve this problem.
1)
Energy-strain approach: By substituting Equation (
14) to Equation (
11), the elastic energy can be written as below:
To simplify the above equation, a set of deformation needs to be applied. The full sets of deformation types that are used in the mech2d are listed in
Table 1.
As for square lattice, the required deformation set is
,
and
. When the bi-axial strain
is applied, the above Equation can be simplified as:
Similarly,
is obtained by using uni-axial strain
:
Also,
is calculated by using the shear strain
:
To calculate elastic constant according to the above equation, a series of deformed structures with different Lagrangian strain (e.g.,
) will be generated and evaluated by DFT engines to calculate the corresponding strain energy
. Then the quadratic coefficients are determined by polynomial fitting of strain energy and Lagrangian Strain. Generally speaking, a 4-6 order polynomial fitting with
and 9-11 deformed structures is a reasonable setting [
15]. Finally, the second order elastic constants
can be obtained by solving the system of linear equations consisted by Equations (
18)–(
20).
One thing deserved to be noted is that Lagrangian strain
for 2D materials is defined as
and the corresponding the physical strain
is
Once the Lagrangian strain
is defined, the physical strain
can be solved iteratively. Furthermore, the lattice vector of deformed structure
can be calculated according to the physical strain
and equilibrium lattice vector
by following equation:
So far, we have presented the energy-strain approach that is used for calculating the square lattice 2D materials. For other lattice type, the corresponding deformation type can be found in the
Table 2.
2)
Stress-strain approach: In this part, we take rectangular lattice as an example to demonstrate how to calculate the independent elastic constant based on stress-strain approach. For rectangular lattice, there are 4 independent elastic constant (
,
,
, and
), which means that we need at least 4 equations to solve this problem. Similar to energy-stress approach, by substituting Equation (
14) to Equation (
12), the generalized Hook’s law can be written as below:
It is obviously that for given
and
, 3 linear equation can be obtained according to the above matrix equation, which is not enough to calculate the 4 elastic constants. To solve this problem, at least 2 sets of deformation are needed. For rectangular lattice, the required deformation set is
and
. Therefore, the corresponding equation can be written as:
Furthermore, we may rewrite the above equation as:
where
The above over-determined equation can be solved by least square method, namely:
Likewise, a series of deformed structures (by using Equation (
23)) with different Lagrangian strain (e.g.,
) will be generated and evaluated by DFT engines to give the corresponding physical stress
and calculate the Lagrangian stress
by using Equation (
3). Then the linear coefficients are determined by polynomial fitting of Lagrangian stress and Lagrangian Strain. Finally, the second order elastic constants
can be obtained according to Equation (
28). Similarly, the second order elastic constants
of other lattice type can be calculated by using the corresponding deformation type, which is listed in
Table 3.
3. Results
3.1. mech2d Design
The workflow of mech2d code is shown in
Figure 2. Implemented with Python, mech2d is designed in a loosely coupled mode, which is considered easy to extend and maintain. Specifically, the workflow of mechanical properties calculation is divided into three stage, including:
init,
run and
post. For the
init stage, the initialization works are carried out. Firstly, the equilibrium crystal structure is read from configuration file, such as POSCAR, cif, XSF format and so on. Then the symmetry of 2D Bravais lattice will be determined. Finally, the deformed structures will be generated according to the required parameters, including number of deformation, maximum strain amplitude, lattice type and calculation approach. In the
run stage, all of DFT tasks will be submitted to local or remote machine without manually writing the submitting script. As is known, fault-tolerant is a key problem for high-throughput calculation. In the mech2d package, the basic errors of VASP during the mechanical properties calculation will be automatically fixed and resubmitted to the server. Once all of the DFT tasks are finished, the calculation results will be collected to working direction from local or remote machine. In addition, the time consuming
run stage supports the task to restart. Specifically, tasks that are interrupted for external reasons will be submitted automatically, while those tasks already finished or still running will not be submitted. For
post stage, an internal DFT validator will be used to check the validity of results. Once passed the results checking, the elastic constant or stress strain curve will be calculated and the corresponding results will be output to texts and figures. Based on object oriented design rule, the mech2d mainly includes 4 classes as detailed below.
Elastic class: As the core class of mech2d, Elastic class is written in mechanics.py file. The Elastic class is used to initialize the mechanical properties calculation, including symmetry detection, Lagrangian strain set selection, Lagrangian strain and physical strain conversion, deformed structure generation, and so on. In addition, the post processing of mechanical properties calculation is also employed by Elastic class, such as stress-strain fitting and energy-strain fitting.
Calculation class: This class focuses on the DFT task initialization, running and result parsing. Three files are included in the calculation sub-folder, including
calculator.py,
vasp.py and
runtask.py. The
Calculator class in the
calculator.py file is the base class that defines the basic method that should be implemented in the subclass. The
VASP class in the
vasp.py file is a subclass of
Calculator, which is used to prepare the VASP calculation tasks and to parse the energy and stress from
vasprun.xml file. As for
runtask.py file, it contains the
RunTasks class. The
RunTasks class is a wrapper of open source code
dpdispatcher, which is part of our previous work [
28] that is used to operate large scale tasks managements in machine learning potential development. As a key component, the job management framework is employed by
custodian, a open source code that performs error checking, job management and error recovery.
Analysis class: This class is used to calculate the main mechanical properties of 2D materials, such as , , , , , orientation dependent Young’s modulus and Poisson’s ratio. In addition, the Born stability condition will be calculated according to the lattice type.
Plot class: This class is responsible for data visualization, including energy-stress fitting curve, stress-strain fitting curve, stress-strain curve under tensile strength and polar plot of orientation dependent Young’s modulus and Poisson’s ratio.
This main features of mech2d are listed as follows:
- (1)
Easy to install (see below).
- (2)
Loosely coupled mode, which is considered easy to extend and maintain.
- (3)
Support for any symmetry of 2D materials.
- (4)
Support for the popular DFT engine VASP. It can be easily extended to other DFT calculators by implementing the corresponding input writer and output parser.
- (5)
Automatically task submission, error correction and collection on both local or remote machine.
3.2. Installation
Developed by python, the simplest way to install the mech2d is using pip. The mech2d code can be installed by downloading and decompressing the code, and then run the following command “pip install .” in the source code directory. One thing deserves to be noted is that 3 necessary libraries should be installed firstly, including:
pymatgen
dpdispatcher
custodian
3.3. Running of Code
mech2d provides a user-friendly interface, which can be started via a single line of command. For example, the help information can be obtained by following command (more details see in the Supporting Information):
m2d~-h
usage: m2d [-h] [-v] {init,run,post} ...
Desctiption:
------------
mech2d is a convenient script that use to calculate the mechanical
properties of 2D materials, including Stress-Strain Curve, elastic
constants and relevant properties. The~script works based on several
sub-commands with their own options. To~see the options for the
sub-commands, type ``m2d sub-command~-h’’.
positional arguments:
{init,run,post}
init Generating initial data for elastic systems.
run Run the DFT calculation for deformed structures.
post Post processing for elastic~calculation.
optional arguments:
-h, --help show this help message and exit
-v, --version Display version
The initialization of the calculation of elastic constant calculation by using stress-strain approach can be specified by following command:
After running the above command, the corresponding deformed structures will be generated in elc_stress folder.
To run the DFT calculations, the follow command can be used:
Here, the input.yaml parameter specifies the input file name. In this file, the machine that uses to conduct the calculation, the queue system of machine, the resources of hardware information and DFT code input information are supplied. An example of input.yaml is supplied in the Supporting Information.
To post process the mechanical properties calculation, the follow command can be used:
Then elastic constant will be calculated and orientation-dependent Young’s modulus and Poisson’s ratio will be plotted. As a example, we show the direction-dependent Young’s modulus and Poisson’s ratio of GeSe
2 in
Figure 3, which is consistent with previous work [
25].
3.4. Examples
In this section, we present some results of mechanical properties of some typical 2D materials calculated by our mech2d code. There are 6 test cases in this work, including graphene,
, penta-graphene,
, black phosphorene and
. The energies and stresses are calculated by the VASP software package [
23,
24]. The generalized gradient approximation (GGA) of Perdew, Burke, and Ernzerhof (PBE) exchange correlation functional [
29] and plane wave basis set are used to describe the valence electrons with the cutoff set to 520 eV [
30]. The energy convergence criteria for static calculation is set to be
eV. The geometry optimization is converged when the force on each atom is smaller than 1
eV
.
Table 4 shows the calculation details for these cases in the present work.
The
Table 5 presents the in-plane elastic constants of various 2D materials, including graphene,
, penta-graphene,
, alpha-phosphorene, and
. The calculation results suggest that the values for the elastic constants reported in this work are consistent with previous studies. For example, in graphene, the values for
and
reported in this work are in good agreement with those reported in Refs. [
20,
25,
31,
32,
33,
34,
35]. One thing deserves to be noted is that there are slight differences in value between our work and references, which may be due to differences in simulation accuracy and methods. Overall, the values for the elastic constants reported in this work are in agreement with previous studies, validating the work.
Author Contributions
Conceptualization, Haidi Wang, Zhongjun Li and Jinlong Yang; methodology, Haidi Wang; software, Haidi Wang; validation, Haidi Wang, Tao Li, Xiaofeng Liu, Weiduo Zhu and Zhao Chen; investigation, Haidi Wang, Tao Li, Xiaofeng Liu, Weiduo Zhu and Zhao Chen; writing—original draft preparation, Haidi Wang, Tao Li, Xiaofeng Liu, Weiduo Zhu and Zhao Chen; writing—review and editing, Haidi Wang, Tao Li, Xiaofeng Liu, Weiduo Zhu and Zhao Chen; supervision, Jinlong Yang; project administration, Haidi Wang; funding acquisition, Haidi wang, Zhongjun Li and Jinlong Yang. All authors have read and agreed to the published version of the manuscript.