next up previous
Next: [edit] Performance issues (PWscf) Up: User's Guide for Quantum-ESPRESSO Previous: [edit] Using PWscf

Subsections

[edit] Using CP

This section is intended to explain how to perform basic Car-Parrinello (CP) simulations using the CP codes.

It is important to understand that a CP simulation is a sequence of different runs, some of them used to “prepare” the initial state of the system, and other performed to collect statistics, or to modify the state of the system itself, i.e. modify the temperature or the pressure.

To prepare and run a CP simulation you should:

1. Define the system:

        (a) atomic positions
        (b) system cell
        (c) pseudopotentials
        (d) number of electrons and bands
        (e) cut-offs
        (f) FFT grids (CP code only)

2. The first run, when starting from scratch, is always an electronic minimization, with fixed ions and cell, to bring the electronic system on the ground state (GS) relative to the starting atomic configuration.
Example of input file (Benzene Molecule):

        &control
           title = ’ Benzene Molecule ’,
           calculation = ’cp’,
           restart_mode = ’from_scratch’,
           ndr = 51,
           ndw = 51,
           nstep = 100,
           iprint = 10,
           isave = 100,
           tstress = .TRUE.,
           tprnfor = .TRUE.,
           dt    = 5.0d0,
           etot_conv_thr = 1.d-9,
           ekin_conv_thr = 1.d-4,
           prefix = ’c6h6’
           pseudo_dir=’/scratch/acv0/benzene/’,
           outdir=’/scratch/acv0/benzene/Out/’
        /
        &system
           ibrav = 14,
           celldm(1) = 16.0,
           celldm(2) = 1.0,
           celldm(3) = 0.5,
           celldm(4) = 0.0,
           celldm(5) = 0.0,
           celldm(6) = 0.0,
           nat = 12,
           ntyp = 2,
           nbnd = 15,
           nelec = 30,
           ecutwfc = 40.0,
           nr1b= 10, nr2b = 10, nr3b = 10,
           xc_type = ’BLYP’
        /
        &electrons
           emass = 400.d0,
           emass_cutoff = 2.5d0,
           electron_dynamics = ’sd’,
        /
        &ions
           ion_dynamics = ’none’,
        /
        &cell
           cell_dynamics = ’none’,
           press = 0.0d0,
         /
         ATOMIC_SPECIES
         C 12.0d0 c_blyp_gia.pp
         H 1.00d0 h.ps
         ATOMIC_POSITIONS (bohr)
         C     2.6 0.0 0.0
         C     1.3 -1.3 0.0
         C    -1.3 -1.3 0.0
         C    -2.6 0.0 0.0
         C    -1.3 1.3 0.0
         C     1.3 1.3 0.0
         H     4.4 0.0 0.0
         H     2.2 -2.2 0.0
         H    -2.2 -2.2 0.0
         H    -4.4 0.0 0.0
         H    -2.2 2.2 0.0
         H     2.2 2.2 0.0

You can find the description of the input variables in file INPUT CP in the Doc/ directory. A short description of the logic behind the choice of parameters in contained in INPUT.HOWTO

[edit] Reach the electronic groundstate (GS)

The first step in a CP scheme is to reach the electronic ground state, for a given electronic position. Sometimes a single run is not enough to reach the GS. In this case, you need to re-run the electronic minimization stage. Use the input of the first run, changing restart mode = ’from scratch’ to restart mode = ’restart’.

Important: unless you are already experienced with the system you are studying or with the code internals, usually you need to tune some input parameters, like emass, dt, and cut-offs. For this purpose, a few trial runs could be useful: you can perform short minimizations (say, 10 steps) changing and adjusting these parameters to your need. You could specify the degree of convergence with these two thresholds:

etot conv thr: total energy difference between two consecutive steps

ekin conv thr: value of the fictitious kinetic energy of the electrons

Usually we consider the system on the GS when ekin conv thr <∼ 10−5 . You could check the value of the fictitious kinetic energy on the standard output (column EKINC).

Different strategies are available to minimize electrons, but the most used ones are:

 electron_dynamics = ’sd’
 electron_dynamics = ’damp’,
 electron_damping = 0.1,

See input description to compute damping factor, usually the value is between 0.1 and 0.5.

[edit] Relax the system

Once your system is in the GS, depending on how you have prepared the starting atomic configuration, you

1. Minimize ionic positions.

As we pointed out in 4) if the interatomic forces are too high, the system could “explode” if we switch on the ionic dynamics. To avoid that we need to relax the system. Again there are different strategies to relax the system, but the most used are again steepest descent or damped dynamics for ions and electrons. You could also mix electronic and ionic minimization scheme freely, i.e. ions in steepest and electron in damping or vice versa.

(a) suppose we want to perform a steepest for ions. Then we should specify the following section for ions:

        &ions
          ion_dynamics = ’sd’,
        /
        Change also the ionic masses to accelerate the minimization:
        ATOMIC_SPECIES
         C 2.0d0 c_blyp_gia.pp
         H 2.00d0 h.ps

while leaving unchanged other input parameters. Note that if the forces are really high (> 1.0 atomic units), you should always use stepest descent for the first relaxation steps (∼ 100).

(b) as the system approaches the equilibrium positions, the steepest descent scheme slows down, so is better to switch to damped dynamics:

        &ions
          ion_dynamics = ’damp’,
          ion_damping = 0.2,
          ion_velocities = ’zero’,
        /

A value of ion damping between 0.05 and 0.5 is usually used for many systems. It is also better to specify to restart with zero ionic and electronic velocities, since we have changed the masses.

Change further the ionic masses to accelerate the minimization:

          ATOMIC_SPECIES
          C 0.1d0 c_blyp_gia.pp
          H 0.1d0 h.ps

(c) when the system is really close to the equilibrium, the damped dynamics slow down too, especially because, since we are moving electron and ions together, the ionic forces are not properly correct, then it is often better to perform a ionic step every N electronic steps, or to move ions only when electron are in their GS (within the chosen threshold).

This can be specified adding, in the ionic section, the ion_nstepe parameter, then the ionic input section become as follows:

        &ions
          ion_dynamics = ’damp’,
          ion_damping = 0.2,
          ion_velocities = ’zero’,
          ion_nstepe = 10,
        /

Then we specify in the control input section:

          etot_conv_thr = 1.d-6,
          ekin_conv_thr = 1.d-5,
          forc_conv_thr = 1.d-3

As a result, the code checks every 10 electronic steps whether the electronic system satisfies the two thresholds etot_conv_thr, ekin_conv_thr: if it does, the ions are advanced by one step. The process thus continues until the forces become smaller than forc_conv_thr.
Note that to fully relax the system you need many run, and different strategies, that you shold mix and change in order to speed-up the convergence. The process is not automatic, but is strongly based on experience, and trial and error.

Remember also that the convergence to the equilibrium positions depends on the energy threshold for the electronic GS, in fact correct forces (required to move ions toward the minimum) are obtained only when electrons are in their GS. Then a small threshold on forces could not be satisfied, if you do not require an even smaller threshold on total energy.

2. Randomization of positions.

If you have relaxed the system or if the starting system is already in the equilibrium positions, then you need to move ions from the equilibrium positions, otherwise they won’t move in a dynamics simulation. After the randomization you should bring electrons on the GS again, in order to start a dynamic with the correct forces and with electrons in the GS. Then you should switch off the ionic dynamics and activate the randomization for each species, specifying the amplitude of the randomization itself. This could be done with the following ionic input section:

         &ions
           ion_dynamics = ’none’,
           tranp(1) = .TRUE.,
           tranp(2) = .TRUE.,
           amprp(1) = 0.01
           amprp(2) = 0.01
         /

In this way a random displacement (of max 0.01 a.u.) is added to atoms of specie 1 and 2. All other input parameters could remain the same. Note that the difference in the total energy (etot) between relaxed and randomized positions can be used to estimate the temperature that will be reached by the system. In fact, starting with zero ionic velocities, all the difference is potential energy, but in a dynamics simulation, the energy will be equipartitioned between kinetic and potential, then to estimate the temperature take the difference in energy (de), convert it in Kelvins, divide for the number of atoms and multiply by 2/3. Randomization could be useful also while we are relaxing the system, especially when we suspect that the ions are in a local minimum or in an energy plateau.

[edit] CP dynamics

At this point after having minimized the electrons, and with ions dis- placed from their equilibrium positions, we are ready to start a CP dynamics. We need to specify ’verlet’ both in ionic and electronic dynamics. The threshold in control input section will be ignored, like any parameter related to minimization strategy. The first time we perform a CP run after a minimization, it is always better to put velocities equal to zero, unless we have velocities, from a previous simulation, to specify in the input file. Restore the proper masses for the ions. In this way we will sample the microcanonical ensemble. The input section changes as follow:

          &electrons
             emass = 400.d0,
             emass_cutoff = 2.5d0,
             electron_dynamics = ’verlet’,
             electron_velocities = ’zero’,
          /
          &ions
             ion_dynamics = ’verlet’,
             ion_velocities = ’zero’,
          /
          ATOMIC_SPECIES
          C 12.0d0 c_blyp_gia.pp
          H 1.00d0 h.ps

If you want to specify the initial velocities for ions, you have to set ion velocities = ’from input’, and add the IONIC VELOCITIES card, after the ATOMIC_POSITION card, with the list of velocities in atomic units.

IMPORTANT: in restarting the dynamics after the first CP run, remember to remove or comment the velocities parameters:

          &electrons
             emass = 400.d0,
             emass_cutoff = 2.5d0,
             electron_dynamics = ’verlet’,
            ~! electron_velocities = ’zero’,
          /
          &ions
             ion_dynamics = ’verlet’,
            ~! ion_velocities = ’zero’,
          /

otherwise you will quench the system interrupting the sampling of the microcanonical ensemble.

[edit] Varying the temperature

It is possible to change the temperature of the system or to sample the canonical ensemble fixing the average temperature, this is done using the Nose thermostat. To activate this thermostat for ions you have to specify in the ions input section:

          &ions
             ion_dynamics = ’verlet’,
             ion_temperature = ’nose’,
             fnosep = 60.0,
             tempw = 300.0,
            ~! ion_velocities = ’zero’,
          /

where fnosep is the frequency of the thermostat in THz, this should be chosen to be comparable with the center of the vibrational spectrum of the system, in order to excite as many vibrational modes as possible. tempw is the desired average temperature in Kelvin.

Note to avoid a strong coupling between the Nose' thermostat and the system, proceed by step. Don't switch on the thermostat from a completely relaxed configuration, but before adding a random displacement is strongly recommended. Check which is the average temperature via few step of a microcanonical simulation. Don't increase the temperature too much. Finally switch on the thermostat. In the case of molecular system, different modes has to be thermalized, in that case it is better to use a chain of thermostat or equivalently running different simulations with different frequencies.

[edit] The Nose' for electrons

It is possible to specify also the thermostat for the electrons, this is usually activated in metal or in system where we have a transfer of energy between ionic and electronic degrees of freedom. Beware: the usage of electronic thermostats is quite delicate. The following information comes from K. Kudin:

The main issue is that there is usually some “natural” fictitious kinetic energy that electrons gain from the ionic motion (“drag”). One could easily quantify how much of the fictitious energy comes from this drag by doing a CP run, then a couple of CG (same as BO) steps, and then going back to CP. The fictitious electronic energy at the last CP restart will be purely due to the drag effect.

The thermostat on electrons will either try to overexcite the otherwise "cold" electrons, or it will try to take them down to an unnaturally cold state where their fictitious kinetic energy is even below what would be just due pure drag. Neither of this is good.

I think the only workable regime with an electronic thermostat is a mild overexcitation of the electrons, however, to do this one will need to know rather precisely what is the fictititious kinetic energy due to the drag.


[edit] Self-interaction Correction

The self-interaction correction (SIC) included in the CP part of QE is based on the Constrained Local-Spin-Density approach proposed my F. Mauri and coworkers (M. D'Avezac et al. PRB 71, 205210 (2005)). It was used the fisdrt time in the QE-package by F. Baletto, C. Cavazzoni and S.Scandolo (PRL95, 176801 (2005)).

This approach is a simple and nice way to treat ONE, and only one, excess charge (EC). More, it is necessary to check a priori the spin up and spin down eigen-values are not too much different, for the corresponding neutral system. working in the Local-Spind-Density-Approximation (setting nspin = 2). If these two conditions are satisfy and you are interest in charged systems, you could apply the SIC. This approach is a on-the-fly method to correct the self-interaction with the excess charge with itself. Other post-processing approaches, such as the Makov-Payne, are available (see PW pages for more info).

Briefly, both the Hartree and the exchange-correlation part has been corrected to avoid the interaction of the EC with tself.

For example, for the Boron atoms, where we have an even number of electrons (valence electrons = 3), the parameters for working with the SIC are:

          &system
          nbnd= 2,
          nelec= 3,
          nelup = 2,
          neldw = 1,
          sic_alpha = 1.d0,
          sic_epsilon = 1.0d0,
          sic = 'sic_mac',
          force_pairing = .true.,
          &ions
          ion_dynamics = 'none',
          ion_radius(1) = 0.8d0,
          sic_rloc = 1.0,
          ATOMIC_POSITIONS (bohr)
          B 0.00 0.00 0.00 0 0 0 1


The two main parameters are: force_pairing = .true. which forces the paired electrons to be the same; and the sic=sic_mac which is the variable to use the Mauri's correction. Remember to add an extra-column in ATOMIC_POSITIONS with 1 to active the sic for those atoms.


Warning: Problems are coming using this approach for dissociation mechanism driven by excess electrons,.

Comment1: Two parameters sic_alpha and sic_epsilon have been introduced following the suggestion of M. Sprik (ICR(05)) to treat the radical (OH)-H_2O. In any case, a complete ab-initio approach is followed using sic_alpha=sic_epsilon=1.

Comment2: When you applied this SIC scheme to a molecule or to an atom, which are neutral, keep in mind to add the correction to the energy level as proposed by Landau: in a neutral system, subtracting the self-intereaction, the unpaired e- feels a charge system, even if using a compensating positive background. The correction term is approx. 2.317(Madelung)/2L_box, where L_box is the linear dimension of your box (=celldm(1)).

Comment3: An example is going to appear asap, in the while for firther information send an email to francesca.baletto@kcl.ac.uk.

[edit] Variable-cell MD

The variable-cell MD is when the Car-Parrinello technique is also applied to the cell. This technique is useful to study system at very high pressure.

[edit] Conjugate Gradient

This page is under construction.

[edit] ensemble-DFT

The ensemble-DFT (eDFT) is a robust method to simulate the metals in the framework of ab-initio molecular dynamics. It was introduced in 1997 by Marzari et al.

The specific subroutines for the eDFT are in ensemble_dft.f90 where you define all the quantities of interest. The subroutine inner_loop_cold.f90 (in older version than CVS it was called inner_cold.f90), called both by cg_sub.f90, control the inner loop, and so the minimization of the free energy A with respect to the occupation matrix.


To select a eDFT calculations, the user has to choice:

           calculation = 'cp'
           occupations= 'ensemble' 
           tcg = .true.
           passop= 0.3
           maxiter = 250

to use the CG procedure. In the eDFT it is also the outer loop, where the energy is minimized with respect to the wavefunction keeping fixed the occupation matrix. While the specific parameters for the inner loop. Since eDFT was born to treat metals, keep in mind that we want to describe the broadening of the occupations around the Fermi energy. Below the new parameters in the electrons list, are listed.

NOTA the degauss is in Hartree, while in PW is in Ryd (!!!). The range is 0.011-0.022 Ha.

The input for a Al surface is:

           &CONTROL
            calculation = 'cp',
            restart_mode = 'from_scratch',
            nstep  = 10,
            iprint = 5,
            isave  = 5,
            dt    = 125.0d0,
            prefix = 'Aluminum_surface',
            pseudo_dir = '~/UPF/',
            outdir = '/scratch/'
            ndr=50
            ndw=51
           /
           &SYSTEM
            ibrav=  14,
            celldm(1)= 21.694d0, celldm(2)= 1.00D0, celldm(3)= 2.121D0,
            celldm(4)= 0.0d0,   celldm(5)= 0.0d0, celldm(6)= 0.0d0,
            nat= 96,
            ntyp= 1,
            nspin=1,
            ecutwfc= 15,
            nbnd=160,
            nelec=291,
            xc_type = 'pbe'
            occupations= 'ensemble',
            smearing='cs',
            degauss=0.018,
           /
           &ELECTRONS
            orthogonalization = 'Gram-Schmidt',
            startingwfc = 'random',
            ampre = 0.02,
            tcg = .true.,
            passop= 0.3,
            maxiter = 250,
            emass_cutoff = 3.00,
            conv_thr=1.d-6
            n_inner = 2,
            lambda_cold = 0.03,
            niter_cold_restart = 2,
           /
           &IONS
            ion_dynamics  = 'verlet',
            ion_temperature = 'nose'
            fnosep = 4.0d0,
            tempw = 500.d0
           /
           ATOMIC_SPECIES
            Al 26.89 Al.pbe.UPF

NOTA1 remember that the time step is to integrate the ionic dynamics, so you can choose something in the range of 1-5 fs.
NOTA2 with eDFT you are simulating metals or systems for which the occupation number is also fractional, so the number of band, nbnd, has to be chosen in order to have some empty states. As a rule of thumb, starting with an initial occupation numbers around 1.6-1.8 (more bands are you considering more the calculation is accurate, but it is longer. The CPU time scales almost linear with the number of bands.)
NOTA3 the parameter emass_cutoff is used during the preconditioning and it has a completely different meaning with respect to the CP. It ranges between 4 and 7.

All the other parameters have the same meaning in the usual CP input, and they are discussed above.


next up previous
Next: [edit] Performance issues (PWscf) Up: User's Guide for Quantum-ESPRESSO Previous: [edit] Using PWscf
Paolo Giannozzi 2008-07-01