=begin
= Parameters in feram
This document describes how to determine parameters for the
effective Hamiltonian in the feram code http://loto.sourceforge.net/feram/ .
We determine the parameters for BaTiO3 from first-principles calculations.
Theories in background are written in
[Takeshi Nishimatsu, Masaya Iwamoto, Yoshiyuki Kawazoe, and Umesh V. Waghmare:
"First-principles accurate total-energy surfaces for polar structural distortions
of BaTiO3, PbTiO3, and SrTiO3: consequences to structural transition temperatures",
Phys. Rev. B, vol.82, p.134106 (2010) http://dx.doi.org/10.1103/PhysRevB.82.134106 ].
Equations referred in this document are those ones in the PRB article.

You may find latest version of this document in http://loto.sourceforge.net/feram/parameters/ .
You can also find this document and input files in the feram source package, feram-X.YY.ZZ.tar.gz.

== List of required free or open source software
 * ABNINT http://www.abinit.org/about/
 * gfortran http://gcc.gnu.org/
 * GNUPLOT http://www.gnuplot.info/
 * Ruby http://www.ruby-lang.org/

== Pseudopotentials and GGA functional
Pseudopotentials
BaTiO3-WuCohenGGA/ba.wcgga.fhi,
BaTiO3-WuCohenGGA/ti.wcgga.fhi, and
BaTiO3-WuCohenGGA/o.wcgga.fhi are
generated by Opium http://opium.sourceforge.net/ .
BaTiO3-WuCohenGGA/ba.param,
BaTiO3-WuCohenGGA/ti.param, and
BaTiO3-WuCohenGGA/o.param are input parameter files for Opium.

Wu and Cohen's GGA [Z. G. Wu and R. E. Cohen, Phys. Rev. B 73,
235116 (2006) http://dx.doi.org/10.1103/PhysRevB.73.235116 ] is employed.

== Equilibrium lattice constant a0
With BaTiO3-WuCohenGGA/perovskite-a0.in and BaTiO3-WuCohenGGA/perovskite-a0.files,
we can determine the equilibrium lattice constant a0. For example, execute abinit with
 % mpirun -np 4 ./abinit < perovskite-a0.files > perovskite-a0.log
or
 % sh perovskite-a0.nqs
where BaTiO3-WuCohenGGA/perovskite-a0.nqs is a system-dependent queueing script.
With this calculation, we determine that
 a0 = 3.98596 [Angstrom] = 7.5323692530 [Bohr].
The number of irreducible k-points for this calculation is 20 (nkpt=20).

== Elastic constants B11, B12 and B44
With
BaTiO3-WuCohenGGA/perovskite-B1112.in,
BaTiO3-WuCohenGGA/perovskite-B1112.files,
BaTiO3-WuCohenGGA/perovskite-B1112.nqs and
BaTiO3-WuCohenGGA/perovskite-B1112.gp files,
we can determine elastic constants B11 and B12.
Note that the previous result a0=7.5323692530 [Bohr] is used in
BaTiO3-WuCohenGGA/perovskite-B1112.in.
 % emacs perovskite-B1112.in   # Write a0 for the acell parameter.
 % sh perovskite-B1112.nqs     # perovskite-B1112.dat1 and perovskite-B1112.dat1 will be made.
 % gnuplot perovskite-B1112.gp
       :
 DATASET 1 -- 9
 a0 = 7.5323909483511 [Bohr] = 3.98596961387263 [Angstrom]
 Emin = -3574.58001772059 [eV]
 B = 177.307024161185 [GPa]
 DATASET 10 -- 19
 a0 = 7.53357884227272 [Bohr] = 3.98659822026182 [Angstrom]
 Emin = -3574.5800592618 [eV]
 B11 = 126.731671475652 [eV]
 C11 = 320.626887681826 [GPa]
 Compute B12
 B12 = 41.7582963902597 [eV]
 C12 = 105.647092400865 [GPa]
 % gv perovskite-B1112.eps

\Fig:B1112 BaTiO3-WuCohenGGA/perovskite-B1112.jpg
  (a) Calculated volume V dependence of Etot-E_0.
  (b) Strain e_xx dependence of Etot-E_0.
/Fig:B1112

We can also check a value of B11-B12 with files of
BaTiO3-WuCohenGGA/perovskite-B11-12.in,
BaTiO3-WuCohenGGA/perovskite-B11-12.files,
BaTiO3-WuCohenGGA/perovskite-B11-12.nqs,
BaTiO3-WuCohenGGA/perovskite-B11-12.delta and
BaTiO3-WuCohenGGA/perovskite-B11-12.gp as follows:
 % emacs perovskite-B11-12.in   # Write a0 for the acell parameter.
 % sh perovskite-B11-12.nqs     # perovskite-B11-12.dat will be made.
 % gnuplot perovskite-B11-12.gp
       :
 B11-B12 = 81.7753050280732 [eV]
 % gv perovskite-B11-12.eps

\Fig:B11-12 BaTiO3-WuCohenGGA/perovskite-B11-12.jpg
  Quadratic fitting of calculated strain dependence of Etot-E_0.
  From the centrosymmetric cubic structure, constraint-tetragonal strain is applied.
/Fig:B11-12

B44 can be calculated with
BaTiO3-WuCohenGGA/perovskite-B44.in,
BaTiO3-WuCohenGGA/perovskite-B44.files,
BaTiO3-WuCohenGGA/perovskite-B44.nqs,
BaTiO3-WuCohenGGA/perovskite-B44.delta and
BaTiO3-WuCohenGGA/perovskite-B44.gp  files as follows:
 % emacs perovskite-B44in   # Write a0 for the acell parameter.
 % sh perovskite-B44.nqs    # perovskite-B44.dat will be made.
 % gnuplot perovskite-B44.gp
       :
 B44 = 49.2408864348646 [eV]
 % gv perovskite-B44.eps
\Fig:B44 BaTiO3-WuCohenGGA/perovskite-B44.jpg
  Quadratic fitting of calculated strain dependence of Etot-E_0.
  From the centrosymmetric cubic structure, rhombohedral strain is applied.
/Fig:B44

The numbers of irreducible k-points for these calculations are
nkpt=40 for B1112 and B11-12 and nkpt=60 for B44.

== Polynomial coefficients P_* and coupling constants B1xx, B1yy and B4yz
We determine the potential surface of ABO3 with the method described in [T. Hashimoto,
T. Nishimatsu, H. Mizuseki, Y. Kawazoe, A. Sasaki and Y. Ikeda: Jpn. J. Appl. Phys. 43,
6785-6792 (2004) http://dx.doi.org/10.1143/JJAP.43.6785 ].

=== Patch for ABINIT
We apply our original patch to ABINIT, rename from abinit to abinit-xyz, then use it.
This brdmin-6.2.3-2011-07-01.patch is applicable to abinit-6.2.3.
 % wget http://ftp.abinit.org/abinit-6.2.3.tar.gz
 % tar xf abinit-6.2.3.tar.gz
 % cd abinit-6.2.3
 % mkdir x86_64-Linux-mpif90-gfortran-4.3.3-O3-perovskite-xyz
 % cd x86_64-Linux-mpif90-gfortran-4.3.3-O3-perovskite-xyz/
 % ../configure FC=mpif90 --enable-mpi --with-mpi-level=2 --disable-netcdf --disable-libxc --disable-etsf-io
 % cd src/95_drive/
 % cp ../../../src/21drive/brdmin.F90 .
 % cp ../../../src/21drive/brdmin_init.F90 .
 % cp ../../../src/21drive/interfaces_95_drive.F90 .
 % patch -p0 < SOMEWERE/brdmin-6.2.3-2011-07-01.patch
 % cd ../..
 % make
 % cd src/main
 % mv abinit abinit-xyz

=== Input file generator
Generate input files with each ruby script in the directory BaTiO3-WuCohenGGA.
 % emacs perovskite-optcell*.rb      # Write a0 for the acell parameter.
 % ruby perovskite-optcell2-001.rb   # => perovskite-optcell2-001.in
 % ruby perovskite-optcell2-110.rb   # => perovskite-optcell2-110.in
 % ruby perovskite-optcell2-111.rb   # => perovskite-optcell2-111.in

=== Computation
 % sh perovskite-optcell2-001.nqs   # results in perovskite-optcell2-001.dat
 % sh perovskite-optcell2-110.nqs   # results in perovskite-optcell2-110.dat
 % sh perovskite-optcell2-111.nqs   # results in perovskite-optcell2-111.dat

=== B1xx, B1yy, B4yz, P_k1, P_k2, P_k3, P_k4, P_alpha and P_gamma
It is quite difficult to express the total-energy surfaces
even with up to 8th order polynomial in wide range of u.
Therefore, we fit Eqs. (14a)--(14c) only
to the calculated data points within narrow range of u.
E0, a0, B11, B12, and B44 must be written in BaTiO3-WuCohenGGA/perovskite-optcell2.gp.

 % emacs perovskite-optcell2-001-narrow.dat   # narrow range of u of perovskite-optcell2-001.dat
 % emacs perovskite-optcell2-110-narrow.dat   # narrow range of u of perovskite-optcell2-110.dat
 % emacs perovskite-optcell2-111-narrow.dat   # narrow range of u of perovskite-optcell2-111.dat
 % ./perovskite-optcell2.gp
      :
 B1xx = -185.347187551195 [eV/Angstrom^2]
 B1yy = -3.28092949275452 [eV/Angstrom^2]
 B4yz = -14.5501738943852 [eV/Angstrom^2]
 P_k1 = -267.980139917128 [eV/Angstrom^6]
 P_k2 = 197.500718362569 [eV/Angstrom^6]
 P_k3 = 830.19997929324 [eV/Angstrom^6]
 P_k4 = 641.968099408291 [eV/Angstrom^8]
 P_alpha = 78.9866142426711 [eV/Angstrom^4]
 P_gamma = -115.484148812671 [eV/Angstrom^4]
 #kappa = -1.51821042113559 [eV/Angstrom^2]   <=== We will also use this value to determine P_kappa2.
 % gv perovskite-optcell2.eps

\Fig:optcell2 BaTiO3-WuCohenGGA/perovskite-optcell2.jpg
  GNUPLOT drawing to determine polynomial coefficients P_* and coupling constants B1xx, B1yy and B4yz.
  Filled points are selected data in narrow ranges of u.
/Fig:optcell2


== Direction to the minimum
The direction to the minimum can be calculated with input files of
BaTiO3-WuCohenGGA/perovskite-tetragonal.in and BaTiO3-WuCohenGGA/perovskite-tetragonal.files.
The program feram-X.YY.ZZ/src/feram_displacement.F help us to calculate the normalized vector.

 % ./abinit < perovskite-tetragonal.files > perovskite-tetragonal.log
 % feram-X.YY.ZZ/src/feram_displacement < perovskite-tetragonal.out
 xred     0.000  0.000  0.000  0.000  0.000     0.000  0.000  0.000  0.000  0.000     0.291  0.718 -0.235 -0.235 -0.538    removed translations:  0.000000000  0.000000000 -0.000000000
 % feram-X.YY.ZZ/src/feram_displacement < perovskite-optcell2-001.out > perovskite-optcell2-001.dsp   # check the xi_z(u)



== Eigenvalues and eigenvectors of IFC matrix at the Gamma point
Eigenvalues and eigenvectors of IFC matrix at the Gamma point
can be calculated with frozen phonon calculations at the Gamma.
The program feram-X.YY.ZZ/src/feram_frozen_phonon_Gamma.F help us to
do it. These eigenvalues and eigenvectors must be similar to those
of calculated from following response-function calculations.

 % sh perovskite-frozen-phonon-Gamma.nqs   # perovskite-frozen-phonon-Gamma.dat will be made.
 % feram-X.YY.ZZ/src/feram_frozen_phonon_Gamma   # this program reads perovskite-frozen-phonon-Gamma.dat
 a0 =   3.9859580 [Angstrom]
 eigenvalues [eV/Angstrom^2] and eigenvectors of force_constant_matrix
 1  -3.982367   0.1648   0.7726  -0.2003  -0.2003  -0.5438 <=== Gamma_15 soft mode
 2   0.058552   0.4511   0.4482   0.4458   0.4458   0.4451
 3   4.682338  -0.0000   0.0000   0.7071  -0.7071   0.0000
 4   8.125787   0.8555  -0.3118  -0.2915  -0.2915   0.0309
 5  13.605841  -0.1936   0.3240  -0.4197  -0.4197   0.7108


== Response-function calculations
We perform some response-function calculations with ABINIT (RF calculations,
See http://www.abinit.org/documentation/helpfiles/for-v6.8/tutorial/lesson_rf1.html and
[Xavier Gonze and Chngyol Lee: Phys. Rev B vol.55, pp.10355-10368 (1997)
http://dx.doi.org/10.1103/PhysRevB.55.10355 ]) to determine optical dielectric
constant epsilon_inf, effective charge Z_star, effective  mass mass_amu,
self interaction P_kappa2, and short range interactions j1, ..., j7.
We do NOT move ions explicitly.

=== Input files and execution
We calculate interatomic force constant (IFC) matrices at the Gamma, X, M and
R points and at the center of the Sigma axis. Input fies are
BaTiO3-WuCohenGGA/force-constant-matrix/perovskite-Gamma.in,
BaTiO3-WuCohenGGA/force-constant-matrix/perovskite-M.in,
BaTiO3-WuCohenGGA/force-constant-matrix/perovskite-R.in,
BaTiO3-WuCohenGGA/force-constant-matrix/perovskite-Sigma.in and
BaTiO3-WuCohenGGA/force-constant-matrix/perovskite-X.in.
Write determined a0 for the acell parameters in each .in file.
Adding "rfasr 1" in the input files may be a good idea.
First, we need results of the Gamma point, perovskite-Gamma_o_DS1_WFK,
then we can calculate other points.
 % ./abinit < perovskite-Gamma.files > perovskite-Gamma.log
 % ./abinit < perovskite-M.files     > perovskite-M.log
 % ./abinit < perovskite-R.files     > perovskite-R.log
 % ./abinit < perovskite-Sigma.files > perovskite-Sigma.log
 % ./abinit < perovskite-X.files     > perovskite-X.log

=== Eigenvalues and eigenvectors of IFC matrices
Using feram-X.YY.ZZ/src/feram_diagonalize15x15.F,
eigenvalues and eigenvectors of IFC matrices
of each k-point are calculated. Dashed lines
in Fig:IFC (B) is a plot of the eigenvalues of
IFC matrices along symmetric axes in the
first Brillouin zone.
How to plot eigenvalues of IFC matrices is described in
http://forum.abinit.org/viewtopic.php?f=12&t=1273 .

 % ./feram_diagonalize15x15 < perovskite-Gamma_o_DS3_DDB
 acell =    3.98596   3.98596   3.98596 [Angstrom]
 eigenvalues [eV/Angstrom^2] and eigenvectors of the matrix of interatomic force constants (IFCs)
  1  -3.812330     0.001 -0.000  0.166     0.005 -0.000  0.770    -0.004  0.000 -0.202    -0.001  0.000 -0.202    -0.001  0.000 -0.546 <=== Gamma_15 soft mode
  2  -3.812330     0.166 -0.000 -0.001     0.770 -0.000 -0.005    -0.546  0.000  0.001    -0.202  0.000  0.001    -0.202  0.000  0.004
  3  -3.812320     0.000  0.166  0.000     0.000  0.770  0.000    -0.000 -0.202 -0.000    -0.000 -0.546 -0.000    -0.000 -0.202 -0.000
  4   0.179744    -0.000  0.459 -0.000    -0.000  0.448 -0.000    -0.000  0.443 -0.000    -0.000  0.442 -0.000    -0.000  0.443 -0.000
  5   0.179753     0.005  0.000  0.459     0.005  0.000  0.448     0.005  0.000  0.443     0.005  0.000  0.443     0.005  0.000  0.442
  6   0.179753    -0.459 -0.000  0.005    -0.448 -0.000  0.005    -0.442 -0.000  0.005    -0.443 -0.000  0.005    -0.443 -0.000  0.005
  7   4.818055     0.000  0.000  0.000     0.000  0.000  0.000    -0.000 -0.000  0.707     0.000 -0.000 -0.707    -0.000  0.000  0.000
  8   4.818055     0.000 -0.000 -0.000     0.000 -0.000  0.000     0.000  0.000  0.000    -0.707  0.000 -0.000     0.707 -0.000  0.000
  9   4.818055    -0.000 -0.000 -0.000    -0.000 -0.000  0.000     0.000  0.707  0.000     0.000  0.000 -0.000    -0.000 -0.707  0.000
 10   8.165232     0.003 -0.000 -0.852    -0.001  0.000  0.319     0.000  0.000  0.293    -0.001 -0.000  0.293    -0.001  0.000 -0.027
 11   8.165232    -0.852  0.000 -0.003     0.319 -0.000  0.001    -0.027 -0.000  0.001     0.293  0.000  0.001     0.293 -0.000 -0.000
 12   8.165234     0.000  0.852 -0.000    -0.000 -0.319  0.000     0.000 -0.293  0.000    -0.000  0.027  0.000    -0.000 -0.293 -0.000
 13  13.740829     0.000  0.190 -0.000    -0.000 -0.325  0.000    -0.000  0.420 -0.000     0.000 -0.711 -0.000     0.000  0.420  0.000
 14  13.740832    -0.190  0.000 -0.004     0.325 -0.000  0.007     0.711  0.000 -0.010    -0.420 -0.000 -0.010    -0.420  0.000  0.016
 15  13.740832     0.004 -0.000 -0.190    -0.007  0.000  0.325    -0.016 -0.000 -0.420     0.010  0.000 -0.420     0.010 -0.000  0.711
 
 % ./feram_diagonalize15x15 < perovskite-X_o_DS1_DDB 
 acell =    3.98596   3.98596   3.98596 [Angstrom]
 eigenvalues [eV/Angstrom^2] and eigenvectors of the matrix of interatomic force constants (IFCs)
  1  -2.844890    -0.000 -0.000  0.000    -0.000 -0.808 -0.000    -0.000 -0.000  0.000    -0.000  0.540  0.000    -0.000  0.237  0.000
  2  -2.844881    -0.000 -0.000 -0.000    -0.000  0.000 -0.808    -0.000 -0.000  0.000     0.000 -0.000  0.237    -0.000 -0.000  0.540
  3   3.293016     0.000 -0.000  0.000     0.000 -0.000 -0.501     0.000 -0.000 -0.000    -0.000 -0.000 -0.759     0.000 -0.000 -0.415
  4   3.293026    -0.000  0.000 -0.000    -0.000  0.501 -0.000     0.000  0.000  0.000     0.000  0.415 -0.000    -0.000  0.759 -0.000
  5   5.647355    -0.000 -0.064  0.832    -0.000  0.000  0.000    -0.000 -0.042  0.550    -0.000 -0.000  0.000    -0.000  0.000  0.000
  6   5.647355    -0.000 -0.832 -0.064     0.000  0.000  0.000    -0.000 -0.550 -0.042     0.000 -0.000  0.000     0.000  0.000 -0.000
  7   6.306471    -0.000  0.000  0.000    -0.000 -0.000  0.000    -0.000 -0.000  0.000    -0.707 -0.000  0.000     0.707  0.000  0.000
  8   6.422750     0.000 -0.000 -0.000    -0.377  0.000 -0.000     0.000  0.000  0.000    -0.655  0.000 -0.000    -0.655 -0.000 -0.000
  9   7.106444     0.000  0.007 -0.552     0.000  0.000 -0.000     0.000 -0.010  0.834     0.000  0.000 -0.000     0.000 -0.000 -0.000
 10   7.106444     0.000  0.552  0.007    -0.000  0.000  0.000     0.000 -0.834 -0.010    -0.000 -0.000  0.000    -0.000  0.000 -0.000
 11  10.605361    -0.922  0.000  0.000    -0.000 -0.000 -0.000    -0.388 -0.000 -0.000    -0.000 -0.000  0.000    -0.000  0.000 -0.000
 12  11.865325    -0.000 -0.000  0.000     0.000  0.311  0.000    -0.000 -0.000 -0.000    -0.000  0.732 -0.000     0.000 -0.606  0.000
 13  11.865326    -0.000  0.000 -0.000    -0.000 -0.000  0.311    -0.000 -0.000  0.000     0.000 -0.000 -0.606    -0.000  0.000  0.732
 14  27.604766    -0.388 -0.000  0.000    -0.000 -0.000 -0.000     0.922  0.000  0.000     0.000  0.000 -0.000     0.000 -0.000  0.000
 15  34.256065    -0.000 -0.000  0.000    -0.926 -0.000  0.000    -0.000 -0.000 -0.000     0.266  0.000  0.000     0.266 -0.000 -0.000
 
 % ./feram_diagonalize15x15 < perovskite-M_o_DS1_DDB
 acell =    3.98596   3.98596   3.98596 [Angstrom]
 eigenvalues [eV/Angstrom^2] and eigenvectors of the matrix of interatomic force constants (IFCs)
  1  -2.285745    -0.000  0.000  0.000     0.000 -0.000  0.885     0.000  0.000 -0.000     0.000  0.000 -0.000    -0.000 -0.000 -0.466
  2   2.701916    -0.000  0.000  0.000     0.000 -0.000 -0.000    -0.000 -0.707 -0.000     0.707 -0.000  0.000    -0.000 -0.000  0.000
  3   4.181197     0.000  0.563 -0.000     0.398  0.000 -0.000     0.000  0.000 -0.000    -0.000 -0.000  0.000     0.724  0.000  0.000
  4   4.181213    -0.563  0.000  0.000     0.000 -0.398 -0.000    -0.000  0.000 -0.000    -0.000  0.000  0.000     0.000 -0.724  0.000
  5   5.930853    -0.000 -0.000 -1.000    -0.000 -0.000  0.000    -0.000  0.000  0.000     0.000 -0.000  0.000     0.000 -0.000 -0.000
  6   7.209251    -0.726  0.000 -0.000     0.000 -0.181  0.000    -0.000 -0.000 -0.000    -0.000  0.000  0.000    -0.000  0.664  0.000
  7   7.209255     0.000  0.726 -0.000     0.181  0.000  0.000     0.000  0.000 -0.000    -0.000 -0.000  0.000    -0.664 -0.000  0.000
  8   7.259426     0.000  0.000  0.000     0.000  0.000 -0.000     0.000 -0.000  0.705     0.000 -0.000  0.709    -0.000 -0.000 -0.000
  9   7.259426    -0.000  0.000  0.000     0.000 -0.000 -0.000     0.000 -0.000  0.709     0.000 -0.000 -0.705    -0.000  0.000 -0.000
 10   8.728420     0.000 -0.000 -0.000    -0.000  0.000  0.466     0.000  0.000  0.000     0.000 -0.000  0.000     0.000  0.000  0.885
 11   9.261847    -0.000 -0.000 -0.000    -0.000 -0.000 -0.000     0.707 -0.000 -0.000    -0.000 -0.707  0.000     0.000  0.000 -0.000
 12  12.688868    -0.000  0.000  0.000     0.000  0.000 -0.000     0.000  0.707  0.000     0.707 -0.000  0.000    -0.000 -0.000 -0.000
 13  29.698188    -0.000  0.000 -0.000    -0.000  0.000 -0.000     0.707 -0.000  0.000     0.000  0.707  0.000     0.000 -0.000  0.000
 14  32.665709    -0.395 -0.000  0.000     0.000  0.899  0.000    -0.000 -0.000 -0.000    -0.000 -0.000 -0.000    -0.000 -0.187  0.000
 15  32.665721     0.000 -0.395  0.000     0.899 -0.000  0.000     0.000 -0.000 -0.000    -0.000  0.000 -0.000    -0.187  0.000  0.000
 
 % ./feram_diagonalize15x15 < perovskite-R_o_DS1_DDB
 acell =    3.98596   3.98596   3.98596 [Angstrom]
 eigenvalues [eV/Angstrom^2] and eigenvectors of the matrix of interatomic force constants (IFCs)
  1   2.094246     0.000 -0.000 -0.000     0.000 -0.000  0.000    -0.000 -0.500 -0.460     0.500  0.000  0.196     0.460 -0.196  0.000
  2   2.094246    -0.000 -0.000  0.000    -0.000  0.000 -0.000     0.000 -0.000  0.278     0.000 -0.000  0.650    -0.278 -0.650 -0.000
  3   2.094246    -0.000 -0.000  0.000     0.000 -0.000 -0.000     0.000 -0.500  0.460     0.500 -0.000 -0.197    -0.460  0.197  0.000
  4   7.635658    -0.000 -0.000 -0.000    -0.000  0.000  0.000    -0.740  0.000  0.000     0.000  0.071 -0.000     0.000 -0.000  0.669
  5   7.635658    -0.000 -0.000 -0.000     0.000  0.000  0.000    -0.345  0.000  0.000     0.000  0.813 -0.000     0.000 -0.000 -0.468
  6   8.895905    -0.000  0.000  0.978    -0.000  0.000  0.000     0.000  0.146  0.000     0.146  0.000 -0.000     0.000 -0.000  0.000
  7   8.895914     0.700 -0.683  0.000     0.000  0.000  0.000    -0.000  0.000 -0.102     0.000 -0.000  0.105    -0.102  0.105 -0.000
  8   8.895914    -0.683 -0.700 -0.000     0.000 -0.000 -0.000     0.000 -0.000 -0.105    -0.000  0.000 -0.102    -0.105 -0.102  0.000
  9  10.557109     0.147 -0.146  0.000     0.000  0.000  0.000    -0.000 -0.000  0.488    -0.000 -0.000 -0.490     0.488 -0.490 -0.000
 10  10.557109     0.146  0.147  0.000    -0.000  0.000  0.000    -0.000 -0.000 -0.490    -0.000 -0.000 -0.488    -0.490 -0.488 -0.000
 11  10.557118     0.000 -0.000 -0.207     0.000  0.000  0.000     0.000  0.692  0.000     0.692 -0.000 -0.000     0.000 -0.000 -0.000
 12  27.741413     0.000 -0.000 -0.000    -0.707 -0.500 -0.500     0.000  0.000  0.000     0.000  0.000 -0.000     0.000 -0.000  0.000
 13  27.741413     0.000 -0.000  0.000    -0.001 -0.707  0.707     0.000  0.000  0.000     0.000  0.000  0.000     0.000 -0.000  0.000
 14  27.741413    -0.000 -0.000 -0.000    -0.707  0.500  0.500     0.000  0.000  0.000     0.000 -0.000  0.000     0.000  0.000 -0.000
 15  32.573120    -0.000  0.000  0.000    -0.000 -0.000 -0.000    -0.577 -0.000 -0.000    -0.000 -0.577  0.000    -0.000  0.000 -0.577
 
 % ./feram_diagonalize15x15 < perovskite-Sigma_o_DS1_DDB
 acell =    3.98596   3.98596   3.98596 [Angstrom]
  1  -2.839858    0.00 0.00 -0.00 0.00  0.11-0.00    0.00 0.00  0.00-0.00  0.00 0.83   -0.00-0.00 -0.00-0.00 -0.09-0.09   -0.00-0.00 -0.00-0.00 -0.09-0.09    0.00-0.00  0.00-0.00 -0.00-0.51
  2   1.994966    0.34 0.00 -0.34 0.00 -0.00-0.00    0.00 0.28 -0.00-0.28  0.00-0.00    0.15 0.15 -0.28-0.28 -0.00-0.00    0.28 0.28 -0.15-0.15 -0.00-0.00   -0.00 0.32 -0.00-0.32  0.00-0.00
  3   2.828540   -0.00 0.00 -0.00 0.00 -0.44 0.00    0.00 0.00 -0.00 0.00 -0.00-0.38   -0.00-0.00  0.00 0.00 -0.33-0.33   -0.00-0.00  0.00 0.00 -0.33-0.33   -0.00-0.00 -0.00 0.00 -0.00-0.46
  4   3.849726    0.35 0.00 -0.35 0.00  0.00 0.00    0.00 0.29 -0.00-0.29 -0.00 0.00   -0.20-0.20  0.32 0.32  0.00 0.00   -0.32-0.32  0.20 0.20  0.00 0.00   -0.00 0.12 -0.00-0.12 -0.00 0.00
  5   4.930208   -0.21 0.00  0.21 0.00  0.00-0.00    0.00-0.13  0.00 0.13  0.00-0.00    0.20 0.20  0.21 0.21 -0.00-0.00   -0.21-0.21 -0.20-0.20 -0.00-0.00   -0.00 0.52  0.00-0.52  0.00-0.00
  6   5.203297   -0.08 0.00 -0.08 0.00  0.00 0.00   -0.00-0.25 -0.00-0.25 -0.00-0.00   -0.11-0.11 -0.05-0.05 -0.00-0.00   -0.05-0.05 -0.11-0.11 -0.00-0.00   -0.00-0.63 -0.00-0.63  0.00-0.00
  7   6.142422    0.00 0.00 -0.00 0.00  0.00-0.00    0.00 0.00  0.00 0.00 -0.00-0.00   -0.00-0.00 -0.00-0.00 -0.59-0.40   -0.00-0.00  0.00 0.00  0.59 0.40   -0.00-0.00  0.00 0.00 -0.00-0.00
  8   7.000273   -0.00 0.00 -0.00 0.00 -0.89-0.00    0.00 0.00 -0.00 0.00 -0.00 0.26   -0.00-0.00  0.00 0.00  0.19 0.19    0.00 0.00 -0.00-0.00  0.19 0.19   -0.00-0.00 -0.00-0.00 -0.00 0.09
  9   7.184468    0.67-0.00  0.67-0.00 -0.00-0.00   -0.00-0.21 -0.00-0.21 -0.00 0.00    0.05 0.05  0.04 0.04  0.00 0.00    0.04 0.04  0.05 0.05  0.00 0.00   -0.00-0.03 -0.00-0.03  0.00 0.00
 10   8.237461   -0.01 0.00 -0.01 0.00  0.00 0.00    0.00 0.20  0.00 0.20  0.00-0.00    0.07 0.07  0.46 0.46 -0.00-0.00    0.46 0.46  0.07 0.07 -0.00-0.00   -0.00-0.17 -0.00-0.17 -0.00 0.00
 11  10.064120   -0.33 0.00  0.33-0.00 -0.00 0.00   -0.00 0.14 -0.00-0.14 -0.00-0.00   -0.35-0.35 -0.15-0.15  0.00 0.00    0.15 0.15  0.35 0.35  0.00 0.00    0.00 0.29 -0.00-0.29  0.00-0.00
 12  12.050401    0.00 0.00  0.00 0.00 -0.10-0.00    0.00-0.00  0.00-0.00 -0.00 0.32   -0.00-0.00 -0.00-0.00 -0.31-0.31   -0.00-0.00  0.00 0.00 -0.31-0.31   -0.00 0.00  0.00-0.00 -0.00 0.72
 13  18.583901    0.05 0.00  0.05-0.00  0.00 0.00    0.00 0.32  0.00 0.32  0.00-0.00    0.37 0.37 -0.17-0.17  0.00 0.00   -0.17-0.17  0.37 0.37  0.00 0.00   -0.00-0.24 -0.00-0.24  0.00-0.00
 14  19.658994    0.33 0.00 -0.33 0.00  0.00-0.00   -0.00-0.54  0.00 0.54  0.00-0.00   -0.17-0.17 -0.07-0.07  0.00 0.00    0.07 0.07  0.17 0.17  0.00 0.00    0.00 0.17 -0.00-0.17  0.00-0.00
 15  40.181463   -0.21-0.00 -0.21 0.00 -0.00-0.00    0.00-0.50  0.00-0.50  0.00 0.00    0.30 0.30  0.08 0.08 -0.00-0.00    0.08 0.08  0.30 0.30 -0.00-0.00    0.00 0.10 -0.00 0.10 -0.00 0.00

=== Optical dielectric constant epsilon_inf
Optical dielectric constant tensor is in BaTiO3-WuCohenGGA/force-constant-matrix/perovskite-Gamma.out.
 % less perovskite-Gamma.out
       :
   Dielectric tensor, in cartesian coordinates,
      j1       j2             matrix element
   dir pert dir pert     real part    imaginary part
   
    1    7   1    7         6.8691464565         0.0000000000
    1    7   2    7         0.0000000000         0.0000000000
    1    7   3    7         0.0000000000         0.0000000000
   
    2    7   1    7         0.0000000000         0.0000000000
    2    7   2    7         6.8691464565         0.0000000000
    2    7   3    7         0.0000000000         0.0000000000
   
    3    7   1    7         0.0000000000         0.0000000000
    3    7   2    7         0.0000000000         0.0000000000
    3    7   3    7         6.8691464565         0.0000000000
       :

=== Effective charge Z_star and effective mass mass_amu
We can find the calculated Born effective charges for each atom in the
file of BaTiO3-WuCohenGGA/force-constant-matrix/perovskite-Gamma.out.
There are two ways of calculations of effective charges,
(from electric field response) and (from phonon response).
They must be identical within some error.

 % less perovskite-Gamma.out
       :
   Effective charges, in cartesian coordinates,
   (from electric field response) 
    if specified in the inputs, asr has been imposed
      j1       j2             matrix element
   dir pert dir pert     real part    imaginary part
   
    1    1   1    7         2.7419582957         0.0000000000
    2    1   1    7         0.0000000000         0.0000000000
    3    1   1    7         0.0000000000         0.0000000000
    1    2   1    7         7.4934093087         0.0000000000
    2    2   1    7         0.0000000000         0.0000000000
    3    2   1    7         0.0000000000         0.0000000000
    1    3   1    7        -5.9318277473         0.0000000000
    2    3   1    7         0.0000000000         0.0000000000
    3    3   1    7         0.0000000000         0.0000000000
    1    4   1    7        -2.1492074350         0.0000000000
    2    4   1    7         0.0000000000         0.0000000000
    3    4   1    7         0.0000000000         0.0000000000
    1    5   1    7        -2.1492081943         0.0000000000
    2    5   1    7         0.0000000000         0.0000000000
    3    5   1    7         0.0000000000         0.0000000000
       :

The direction of the Gamma_15 soft mode and
The direction to the minimum are not same in principle.
Using one of them, we determine the effective charge
Z_star and the effective mass mass_amu.

 Z_star = 10.33 =
  2.7419582957 *  0.166 +
  7.4934093087 *  0.770 +
 -2.1492074350 * -0.202 +
 -2.1492074350 * -0.202 +
 -5.9318277473 * -0.546
 
 mass_amu = 38.24 = 137.327*0.166**2 + 47.867*0.770**2 + 15.9994*(2*0.202**2 +0.546**2)

=== Self interaction P_kappa2 and nearest neighbor interactions j1, ..., j7
We select eigenvalues and make BaTiO3-WuCohenGGA/force-constant-matrix/eigenvalues2j.in.
Using feram-X.YY.ZZ/src/feram_eigenvalues2j.F, we can calculate P_kappa2 and j1, ..., j7.

 % cat eigenvalues2j.in
 DDB_a = -3.812330
 DDB_b = 34.256065
 DDB_c = -2.844881
 DDB_d = -2.285745
 DDB_e = 32.665721
 DDB_f = 27.741413
 DDB_g =  0.0
 a0          = 3.98596961387263
 Z_star      = 10.33
 epsilon_inf = 6.8691464565
 % feram-X.YY.ZZ/src/feram_eigenvalues2j < eigenvalues2j.in
 ../../src/feram_eigenvalues2j.F: 43: BEGIN: Version 0.14.07
   ../../src/feram_eigenvalues2j.F: 61: FILENAME: stdin
   ../../src/param_module.F:109: BEGIN: read_Param().
     DDB_a = -3.812330
     DDB_b = 34.256065
     DDB_c = -2.844881
     DDB_d = -2.285745
     DDB_e = 32.665721
     DDB_f = 27.741413
     DDB_g =  0.0
     a0          = 3.98596961387263
     Z_star      = 10.33
     epsilon_inf = 6.8691464565
   ../../src/param_module.F:284: END:   read_Param().
   ../../src/param_module.F:290: BEGIN: make_Param().
   ../../src/param_module.F:313: END:   make_Param().
        j_1 =   -2.0840250430 [eV/Angstrom^2] =   -0.0214464062 [Hartree/Bohr^2]
        j_2 =   -1.1290411983 [eV/Angstrom^2] =   -0.0116188029 [Hartree/Bohr^2]
        j_3 =    0.6894579816 [eV/Angstrom^2] =    0.0070951143 [Hartree/Bohr^2]
        j_4 =   -0.6113408159 [eV/Angstrom^2] =   -0.0062912216 [Hartree/Bohr^2]
        j_5 =    0.0000000000 [eV/Angstrom^2] =    0.0000000000 [Hartree/Bohr^2]
        j_6 =    0.2768966803 [eV/Angstrom^2] =    0.0028495045 [Hartree/Bohr^2]
        j_7 =    0.0000000000 [eV/Angstrom^2] =    0.0000000000 [Hartree/Bohr^2]
   P_kappa2 =    8.1460516421 [eV/Angstrom^2] =    0.0838298622 [Hartree/Bohr^2]
   j =  -2.08403 -1.12904  0.68946 -0.61134  0.00000  0.27690  0.00000    [eV/Angstrom^2]
   a0          =   3.98597    [Angstrom]
   Z_star      =  10.33000
   epsilon_inf =   6.86915
 ../../src/feram_eigenvalues2j.F:126: END


 P_kappa2(old) + [kappa - kappa(Gamma_TO)]
 = 8.1460516421 + [-1.51821042113588 - (-3.812330/2)]
 = 8.1460516421 + 0.38795457886412
 = 8.53400622096412
 = P_kappa2(new)

\Fig:IFC ../doc/figures/BaTiO3-000-dispersion-with-ifc/BaTiO3-000-dispersion-with-ifc.jpg
  (A) Half of eigenvalues of the 3x3 long-range dipole-dipole interaction matrix Phi(k)
      are plotted along symmetric axes in the first Brillouin zone of the simple-cubic lattice.
      Special points and k/(2pi)=(1/4, 1/4, 0) (the center of the Sigma axis) are
      indicated with vertical dotted lines. Labels (a)--(g)
      corresponds to Eqs. (15a)--(15g), respectively.
      Tics in the unit of Z^2/epsilon/a^3 is placed in left side.
      Tics in the unit of eV, in the case of the parameter set of [Takeshi Nishimatsu,
      Masaya Iwamoto, Yoshiyuki Kawazoe, and Umesh V. Waghmare: Phys. Rev. B 82, 134106 (2010)]
      is placed in right side.
  (B) Half of eigenvalues of the calculated 15x15 inter-atomic force constant (IFC) matrix (dashed black lines).
      Half of eigenvalues of the total (long-range + short-range) interaction matrix Phi^quad(k) (solid red line).
      Difference between them is the elevation of 0.38795.
/Fig:IFC


== Author of this document
Takeshi Nishimatsu (t-nissie{at}imr.tohoku.ac.jp)

=end
#
# for ulmul.rb
#
require 'rubygems'
require 'ulmul'
$MAX_TABLE_OF_CONTENTS = 3
Itemize::ITEMIZE_INITIATOR  =   '<ul>'
Itemize::ITEMIZE_TERMINATOR =  '</ul>'
Itemize::ITEM_INITIATOR     =   '<li>'
Itemize::ITEM_TERMINATOR    =  '</li>'
Ulmul::PARAGRAPH_INITIATOR  =    '<p>'
Ulmul::PARAGRAPH_TERMINATOR =   '</p>'
Ulmul::VERBATIM_INITIATOR   =  '<pre>'
Ulmul::VERBATIM_TERMINATOR  = '</pre>'
class Ulmul
  include HTML
  include HTML5
end
u=Ulmul.new()
u.subs_rules = lambda{|s|
  s.
  gsub(/&/,'&amp;').
  gsub(/</,'&lt;').
  gsub(/>/,'&gt;').
  gsub(/(BaTiO3-WuCohenGGA\/\S*(in|files|nqs|rb|delta|gp|out|fhi|param|Makefile))/, '<a href="\1">\1</a>').
  gsub(/(brdmin-6\.2\.3-2011-07-01\.patch)/,                                        '<a href="\1">\1</a>').
  gsub(/(http:\S*|https:\S*)(\s|$)/, '<a href="\1">\1</a>\2')}

u.parse(ARGF)
puts u.file(stylesheets=["style.css"],javascripts=[],name="Takeshi Nishimatsu",language="en")

# Local variables:
#   mode: RD
#   compile-command: "ruby parameters.txt parameters.txt > parameters.html"
# End:
