|
Dacapo manualVersion 0.1
1 IntroductionDacapo is a total energy program based on density functional theory. It uses a plane wave basis for the valence electronic states and describes the core-electron interactions with Vanderbilt ultrasoft pseudo-potentials. The program performs self-consistent calculations for both Local Density Approximation (LDA) and various Generalized Gradient Approximation (GGA) exchange-correlations potentials, using state-of-art iterative algorithms. The code may perform molecular dynamics / structural relaxation simultaneous with solving the Schrodinger equations within density functional theory. The program may be compiled for seriel as well as parallel execution and the code has been ported to many hardware platforms. The manual describes how to use the dacapo program from the Campos Atomistic Simulation enviroment, or for short ASE. 2 Setting up the atomic configurationThe atoms for Dacapo are defined via the ASE ListOfAtoms object. A ListOfAtoms object is a collection of atoms. The ASE implementation of a ListOfAtoms can be used like this:
>>> from ASE import Atom, ListOfAtoms
>>> atoms = ListOfAtoms([Atom('C', (0, 0, 0)),
... Atom('O', (0, 0, 1.0))])
>>> atoms.SetUnitCell((10,10,10))
This will define a CO molecule, with a CO distance of 1A, in a cubic 10Ax10Ax10A unitcell. For more details of the ListOfAtoms class see listofatoms in the ASE manual. The atoms defined here can be attached to a Dacapo calculator by using: atoms.SetCalculator(calculator) alternatively, one can attach the atoms to a calculator by using: calculator.SetListOfAtoms(atoms) The next chapter describes how to define the calculator for dacapo. 3 Dacapo ASE calculator interfaceAs a minimum for defining a calculation in python you need to specify the atoms as described above, and you need to set the planewave cutoff and the number of bands, this will look like this using the python interface: >>> from Dacapo import Dacapo >>> calculator = Dacapo() >>> calculator.SetNumberOfBands(6) >>> calculator.SetPlaneWaveCutoff(340) >>> atoms.SetCalculator(calculator) >>> calculator.GetPotentialEnergy() The rest of this chapter describes the different methods you can use for the calculator object. More detailed explanation of the python construction found above can be found in the tutorials. For the most important of the method described one can use keyword arguments in the construction of the Dacapo calculator, the table below list the keywords:
So the example above can be written more compact: >>> calculator = Dacapo( ... nbands=6, ... planewavecutoff=340) 3.1 Number of bands and Electronic temperatureThe method 'SetNumberOfBands(nbands)' can be used to define the number of bands for the calculatior. nbands should be a least equal to halv the number of valence electrons. The occupation statitstics can be set using the method SetOccupationStatistics(method). dacapo support two methods for occupation statistics:
3.2 Planewave and Density-cutoffThe method SetPlaneWaveCutoff(planewavecutoff) defines the plavewave cutoff for the calculation. The unit for planewavecutoff is eV. The method SetDensityCutoff(densitycutoff) sets the density cutoff. By default the two cutoffs are equal, corresponding to using just one grid. For elements like Cu using ultra-soft pseudo potentials the ultra-soft pseudo-wavefunction are very soft, while the density still requires a fine grid, in this case it can be advantagous to set a larger value for densitycutoff that for planewavecutoff. 3.3 Changing file namesThe following two methods can be use to change the file names used by dacapo:
The method: SetScratch(scratchdir): will set the scratch directory used for swapfiles to scratchdir. Default for this directory is /scratch/<username> or if this is not found just /scratch. 3.4 Exchange-correlation functionalYou can use the method SetXCFunctional(exc) to select the exchange-correlation used for the calculation. exc is one of:
The method GetXCFunctional tells which of the above defined exchange-correlation functionals are currently used. 3.5 Defining a spin-polarized calculationOne can use the method SetSpinPolarized(True) to tell dacapo that the calculation should be spin-polarized. One also need to specify an initial magnetic moment for the atoms. You can do this in the construction of the atoms, by using:
>>> from ASE import Atom, ListOfAtoms
>>> atoms = ListOfAtoms([Atom('O', (0, 0, 0),magmom=1.0),
... Atom('O', (0, 0, 1.2),magmom=1.0)])
This can also be set using the ListOfAtoms method SetMagneticMoments((1,1)) or setting the SetMagneticMoment method on each atom. This will define a initial total magnetic moment of 2 Bohr magneton, for the O2 molecule, this being also the self-consistent result. You could also use, SetMagneticMoments((1,-1)), this will define a 'anti-ferro' magnetic state with total magnetic moment of zero. If this case probably the end result is still the same (2 Bohr magneton) but the number of self-consistent iterations will increase. 3.6 K-pointsThe method SetBZKPoints(kpts) can be used to define the k-points in the BZ. In general kpts are a python list of k-points defined in units of the reciprocal cell. You can however specify a 10x10x10 Monkhorst-Pack 3dimensional set simple by using SetBZKpoint((10,10,10)). Below is a list of the special k-points sets that can be used:
You can use the method GetBZKPoints, to access the k-points just defined. The method GetIBZKPoints returns the symmetry reduced set of k-points. 3.7 Pseudo-potentialsYou can change or view the pseudopotentials use for an element using the methods:
3.8 Charge-density mixingThe method SetChargeMixing(value) can be used to enable or disable charge density mixing. Using SetChargeMixing(True) the program will use Pulay mixing for the density (default). Using SetChargeMixing(False) correspond to running a calculation using the Harris-Foulkes functional using the input density. See also the Harris calculation example. The method SetKerkerPreconditioning(value) can be used to set Kerker preconditioning for the density mixing. For value=True Kerker preconditiong is used, i.e. q is different from zero, see eq. 82 in Kresse/FurthmÂüller: Comp. Mat. Sci. 6 (1996). The value of q is fix to give a damping of 20 of the lowest q vector. For value=False q is zero and mixing is linear (default). 3.9 Eigenvalue solverThe eigenvalue solver can be set using the method SetEigenvalueSolver(method). Here method is one of:
3.10 Dipole-correction
3.11 Setting non-default executable
3.12 Symmetry
3.13 Electrostatic decoupling
3.14 Stress calculationBy default dacapo will not calculate the stress acting on the unitcell, you can use the method: CalculateStress: to tell dacapo to calculate the stress. 3.15 Local density of statesDacapo can calculate the density of states projected onto atomic orbitals. Warning The density of states are not implemented for planewave parallel calculations, so the number of nodes must match the number kpoints (after they have been reduce by symmetry). So if you for example have 4 IBZ kpoints, you can use 4 or 2 parallel nodes and still get the projected density of states. Typically one would do: >>> atoms = ListOfAtoms(..) >>> >>> calc = Dacapo(..) >>> calc.CalculateAtomicDOS() >>> >>> atoms.SetCalculator(calc) >>> >>> energy = atoms.GetPotentialEnergy() >>> dos = calc.GetLDOS(atoms=[1],angularchannels=["s"]) >>> dos.GetPlot() This will return a density of states projected onto the s-orbital of the first atom (atom numbers starts from 1). The method: CalculateAtomicDOS(energywindow=None) tells the fortran program to calculate the local density of states projected onto atomic orbitals, using energywindow for calculating the energy resolved LDOS. The method: GetLDOS(**keywords ): returns an instance of AtomProjectedDOSTool (see below). Keyword for the GetDOS method:
The resulting DOS are added over the members of the three list (atoms,angularchannels and spin). GetDOS returns a instance of the class AtomProjectedDOSTool (Thanks to John Kitchen for providing grace plot and band moments methods). Methods for AtomProjectedDOSTool:
Note The eigen values are not relative to the Fermi level, you can get the fermi level for the calculation using calc.GetFermilevel() 3.15.1 Multicenter orbitalsYou add the multicenter orbitals using >>> sim.mcen = MultiCenterProjectedDOS() now you can add a multicenter orbital like >>> sim.mcen.add([(0,0,0,1.0),(1,0,0,-1.0)]) this will define an atom1_s-atom2_s orbital. The general form is [{(atomnr,l,m,weight)}] You can retrieve information using >>> sim.mcen.read(spin=0/1,cutoff="Infinite"/"short") defaults are spin=0, cutoff="Infinite". This will return a list of instances of the class MultiCenterProjectedDOSTool. This class have the methods: GetBandMoment (GetBandMoment(1) will return the first moment of the band) GetCutoff GetData GetDescription GetEFermi GetGracePlot GetIntegratedDOS (integrated up til the Fermi level) GetPlot (you can combine plot like GetPlot(parent = otherplot), otherplot.Replot()) GetSpin SaveData (SaveData(filename)) The MultiCenterProjectedDOSTool is getting all methods (except GetDescription, GetSpin) from AtomProjectedDOSTool, which are returned if you use: >>> sim.ados.GetDOS(atoms=[1],angularchannels=['s'], spin=[spin])) Note the numbering is here from 1. You can add the following attributes to sim.mcen: sim.mcen.EnergyWindow=(-10,5) sim.mcen.EnergyWidth=0.25 sim.mcen.NumberEnergyPoints=100 sim.mcen.CutoffRadius=1.5 The direction cosines for which the spherical harmonics are set up are using the next different atom in the list (cyclic) as direction pointer, so the z-direction is chosen along the direction to this next atom. At the moment the rotation matrices is only given in the text file, you can use grep 'MUL: Rmatrix' out_o2.txt to get this information. 3.16 Changing convergence parameters
can be used to set convergence parameters for the calculations. The following keywords are defined:
SetConvergenceParameters(energy=0.00001,density=0.0001,occupation=0.001) correspond to the default settings.
can be used to retrieve the convergence parameters. 3.17 NetCDF specific methodsTwo methods are defined for general reading and writing of NetCDF entries. This provides a method for reading and writing any NetCDF variable defined in the dacapo netcdf manual, so that any settings for the dacapo fortran program, not defined by the standard sets of method from the DFT Calculator or from the extra Dacapo method described above, can be defined. The methods are listed below:
The effect of writing: >>> calc = Dacapo() >>> calc.SetNumberOfBands(10) and
>>> calc = Dacapo()
>>> calc.SetNetCDFEntry('ElectronicBands',att='NumberOfBands',value=10)
is the same. Now you can get the information by either using >>> print calc.GetNumberOfBands() or
>>> print calc.GetNetCDFEntry('ElectronicBands',att='NumberOfBands')
4 Getting information from the calculatorBelow follow a list of the methods one can use to read information from the calculator:
5 Working with the Dacapo calculator5.1 reading from an old calculationIf you want to restart a calculation or read specific information from an old calculation, one have to access the information via the atoms, using: >>> atoms = Dacapo.ReadAtoms(filename='oldfile') Now you can get the calculator, attached to the atoms, and get the information, using: >>> calc = atoms.GetCalculator() >>> print calc.GetEigenValues() A short-hand version of this is: >>> print >>> Dacapo.ReadAtoms(filename='oldfile').GetCalculator.GetEigenValues() Often ASE methods take the atoms as the argument, using the GetCalculator method to access the relevant information, i.e the VTK methods for 3D plotting: >>> from ASE.Visualization.VTK import VTKPlotWaveFunction >>> atoms = Dacapo.ReadAtoms(filename='oldfile') >>> VTKPlotWaveFunction(atoms) 6 Pseudo-potentialsFor an overview of the pseudopotentials for dacapo, see the dacapo pseudopotential page. 7 Minimization and Dynamics using pythonMinimization of structures is done using the mimimization algorithms implemented in ASE. Constrains on atoms are done using ASE filters. The next section describes the use of filters. 7.1 Setting up a constrain filterIn the simplest form a filter is just a wrapper around a ListOfAtoms object, eg. for a filters constraining some atoms in a ListOfAtoms, the filter is just a shortened version of the orginal ListOfAtoms. For a full description see the filter in the ASE manual. Constraining one atom in a CO-molecule:
>>> from ASE import Atom, ListOfAtoms
>>> from ASE.Filters import Subset
>>> atoms = ListOfAtoms([Atom('C', (0, 0, 0), tag=117),
... Atom('O', (1.2, 0, 0))])
>>> mask=[atom.GetTag() == 1 for atom in atoms]
>>> subset = Subset(atoms,mask)
Another often used constrain is to fix a bond-lenght. For a example of combining the subset filter and the fix bond length filter, see the h2o example. 7.2 Setting up a dynamicsOnce the filter is defined on can setup a minimization or dynamics working that takes this filter as input. To setup a conjugate-gradient minimizer using the filter subset defined above, one can use: >>> from ASE.Dynamics import ConjugateGradient >>> from ASE.Dynamics.LineMinimizers.LM1 import LM1 >>> dyn = ConjugateGradient(subset, fmax=0.05,lineMin=LM1(0.05)) >>> dyn.Converge() For a full description of the minimization and dynamics algorithms available see dynamics in the ASE manual. 7.3 Generating a netcdf trajectoryTo save the atomic configurations, energies, forces etc, produced from the mimimizer defined above, you need to add a trajectory object to the minimizer:
>>> path = NetCDFTrajectory('CO-trajectory.nc', atoms)
>>> dyn.Attach(path)
See the h2o example. For more information on trajectories see trajectory in the ASE manual. 8 Wavefunction and density plotsSee the example plot wavefunction:. 9 Wannier orbitalsUsing the ASE Wannier module one can find the most localized set of Wannier orbitals for a dacapo calculation. More details will be added. See the Wannier example. 10 Nudged Elastic Band Minimum energy pathSee the Nudged Elastic Band method for a general description. See the Nudged Elastic Band example for a dacapo application of this method. |