Embedded atom method (EAM) potential with user defined functions¶
This example demonstrates the use of the embedded atom method (EAM) potential routine together with user defined functions. The potential form and parameters have been taken from [MisMehPap01]. The example also illustrates the use of XML Inclusions. Note that the potential is merely evaluated for a couple of simple lattice structures and none of the parameters are fitted.
Location¶
examples/potential_EAM
Input files¶
main.xml: main input file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
<?xml version='1.0' encoding='iso-8859-1'?> <job> <name>Fitting an EAM potential for copper</name> <verbosity>medium</verbosity> <fitting> <BFGS conv-threshold='1e-5' max-iter='20' /> </fitting> <atom-types> <species>Cu</species> </atom-types> <potentials> <xi:include href='potential.xml' xmlns:xi='http://www.w3.org/2003/XInclude' /> </potentials> <structures> <xi:include href='structures.xml' xmlns:xi='http://www.w3.org/2003/XInclude' /> </structures> </job>
potential.xml: initial parameter set (included in main input file via XML Inclusions)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
<eam id="elemental EAM potential" species-a="*" species-b="*"> <mapping> <pair-interaction species-a="*" species-b="*" function="V" /> <electron-density species-a="*" species-b="*" function="rho" /> <embedding-energy species="*" function="F" /> </mapping> <functions> <sum id="V"> <user-function id="V_term1"> <input-var>r</input-var> <expression> ( E1 * (exp(-2 * alpha1 * (r - r01)) - 2 * exp(-alpha1 * (r - r01))) + E2 * (exp(-2 * alpha2 * (r - r02)) - 2 * exp(-alpha2 * (r - r02))) + delta) </expression> <derivative> E1 * (2 * alpha1 * exp(-alpha1 * (r - r01)) - 2 * alpha1 * exp(-2 * alpha1 * (r - r01))) + E2 * (2 * alpha2 * exp(-alpha2 * (r - r02)) - 2 * alpha2 * exp(-2 * alpha2 * (r - r02))) </derivative> <param name="E1">2.01458e2</param> <param name="alpha1">2.97758</param> <param name="r01">0.83591</param> <param name="E2">6.59288e-3</param> <param name="alpha2">1.54927</param> <param name="r02">4.46867</param> <param name="delta">0.86225e-2</param> <screening> <user-function id="rho_screening"> <cutoff>5.50679</cutoff> <input-var>r</input-var> <expression> 1 - 1/(1 + ((r - cutoff) / h)^4) </expression> <derivative> 4 * h^4 * (r-cutoff)^3 / ((h^4 + (r-cutoff)^4)^2) </derivative> <param name="h">0.50037</param> </user-function> </screening> </user-function> <user-function id="V_term2"> <cutoff>5.50679</cutoff> <input-var>r</input-var> <expression> - (r < rs1 ? S1*(rs1-r)^4 : 0) - (r < rs2 ? S2*(rs2-r)^4 : 0) - (r < rs3 ? S3*(rs3-r)^4 : 0) </expression> <derivative> - (r < rs1 ? -4*S1*(rs1-r)^3 : 0) - (r < rs2 ? -4*S2*(rs2-r)^3 : 0) - (r < rs3 ? -4*S3*(rs3-r)^3 : 0) </derivative> <param name="rs1">2.24</param> <param name="rs2">1.80</param> <param name="rs3">1.20</param> <param name="S1">4.0</param> <param name="S2">40.0</param> <param name="S3">1.15e3</param> </user-function> </sum> <user-function id="rho"> <input-var>r</input-var> <expression> a * exp(-beta1*(r - r03)^2) + exp(-beta2*(r - r04)) </expression> <derivative> beta2 * (-exp(-beta1 * (r - r04))) - 2 * a * beta1 * (r - r03) * exp(-beta1 * (r - r03)^2) </derivative> <param name="a">3.80362</param> <param name="r03">-2.19885</param> <param name="r04">-2.61984e2</param> <param name="beta1">0.17394</param> <param name="beta2">5.35661e2</param> <screening> <user-function id="rho_screening"> <cutoff>5.50679</cutoff> <input-var>r</input-var> <expression> 1 - 1/(1 + ((r - cutoff) / h)^4) </expression> <derivative> 4 * h^4 * (r - cutoff)^3 / ((h^4 + (r - cutoff)^4)^2) </derivative> <param name="h">0.5</param> </user-function> </screening> </user-function> <user-function id="F"> <input-var>rho</input-var> <expression> (rho < 1) ? (F0 + 0.5 * F2 * (rho - 1)^2 + q1 * (rho - 1)^3 + q2 * (rho - 1)^4 + q3 * (rho - 1)^5 + q4 * (rho - 1)^6) : (F0 + 0.5 * F2 * (rho - 1)^2 + q1 * (rho - 1)^3 + Q1 * (rho - 1)^4) / (1 + Q2 * (rho - 1)^3) </expression> <derivative> (rho < 1) ? (rho - 1) * ( F2 + 3 * q1 * (rho - 1) + 4 * q2 * (rho - 1)^2 + 5 * q3 * (rho - 1)^3 + 6 * q4 * (rho - 1)^4 ) : (F2 * (rho - 1) + 3 * q1 * (rho - 1)^2 + 4 * Q1 * (rho - 1)^3)/(Q2 * (rho - 1)^3 + 1) - (3 * Q2 * (rho - 1)^2 * (F0 + 0.5 * F2 * (rho - 1)^2 + q1 * (rho - 1)^3 + Q1 * (rho - 1)^4)) / ((Q2 * (rho - 1)^3 + 1)^2) </derivative> <param name="F0">-2.3</param> <param name="F2">1.4</param> <param name="q1">-1.3</param> <param name="q2">-0.9</param> <param name="q3">1.8</param> <param name="q4">3.0</param> <param name="Q1">0.4</param> <param name="Q2">0.3</param> </user-function> </functions> </eam>
structures.xml: input structures (included in main input file via XML Inclusions)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
<group> <fcc-lattice id='FCC'> <atom-type>Cu</atom-type> <lattice-parameter>3.615</lattice-parameter> <properties> <atomic-energy target='-3.540'/> <lattice-parameter target='3.615'/> <bulk-modulus/> <C11 target='170.0'/> <C12 target='122.5'/> <C44 target= '75.8'/> </properties> </fcc-lattice> <bcc-lattice id='BCC'> <atom-type>Cu</atom-type> <lattice-parameter>2.8</lattice-parameter> <properties> <atomic-energy target='-3.496'/> <lattice-parameter/> </properties> </bcc-lattice> <diamond-lattice id='DIA'> <atom-type>Cu</atom-type> <lattice-parameter>4.0</lattice-parameter> <properties> <atomic-energy target='-2.293'/> <lattice-parameter min='3.0'/> </properties> </diamond-lattice> <sc-lattice id='SC'> <atom-type>Cu</atom-type> <lattice-parameter>2.3</lattice-parameter> <properties> <atomic-energy target='-2.996'/> <lattice-parameter/> </properties> </sc-lattice> </group>
Output (files)¶
The final properties (as well as parameters) are written to standard output.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
This is program version 0.1.6 Reading job file main.xml ------------------------------------------------------- Parsing input file(s) ------------------------------------------------------- ------------------------------------------------------- Potential parameters being optimized (#dof=0): NONE ------------------------------------------------------- ------------------------------------------------------- Number of properties being fitted: 0 ------------------------------------------------------- ------------------------------------------------------- Computing structure properties Structure 'FCC': total-energy: -3.55787 eV atomic-energy: -3.55787 eV/atom total-volume: 11.8104 A^3 atomic-volume: 11.8104 A^3/atom bulk-modulus: 139.856 GPa C11: 171.427 GPa C12: 124.138 GPa C44: 76.1944 GPa lattice-parameter: 3.615 A [0:] Structure 'BCC': total-energy: -3.4849 eV atomic-energy: -3.4849 eV/atom total-volume: 10.976 A^3 atomic-volume: 10.976 A^3/atom lattice-parameter: 2.8 A [0:] Structure 'DIA': total-energy: 7.19803 eV atomic-energy: 3.59901 eV/atom total-volume: 16 A^3 atomic-volume: 8 A^3/atom lattice-parameter: 4 A [3:] Structure 'SC': total-energy: -3.04011 eV atomic-energy: -3.04011 eV/atom total-volume: 12.167 A^3 atomic-volume: 12.167 A^3/atom lattice-parameter: 2.3 A [0:] ------------------------------------------------------- -------------------------------------------------------