#### The first example will demonstrate some of the basic steps of performing a CPMD calculation with a very simple molecule: hydrogen, and a very simple task: calculate the electronic structure. We will use that as an example to have a look at the input file format, and how to read the output.

## Wavefunction Optimization

### Input File Format

For nearly all CPMD calculations, you first have to calculate the electronic structure of your system, and use that as a base for further calculations. For our first calculation you’ll need the input file 1-h2-wave.inp and the pseudo-potential file H_MT_LDA.psp.

Now let’s have a look at the input file. The
input is organized in sections which start with &NAME and end with
&END. Everything outside those sections is ignored. Also all
keywords have to be in upper case or else they will be ignored. The
sequence of the sections does not matter, nor does the order of
keywords, except where noted in the manual. A minimal input file must
have a &CPMD, &SYSTEM and an &ATOMS section. For more
details on the input syntax, please have a look at the CPMD manual.

&INFO isolated hydrogen molecule. single point calculation. &END

The input file starts with an (optional) &INFO section. This section allows you to put comments about the calculation into the input file and they will be repeated in the output file. This can be very useful to match input and output files.

&CPMD OPTIMIZE WAVEFUNCTION CONVERGENCE ORBITALS 1.0d-7

This first part of &CPMD section instructs the program to do a wavefunction optimization (i.e. a single point calculation) with a very tight convergence criterion (the default is 1.0d-5).

CENTER MOLECULE ON PRINT FORCES ON &END

The rest of the &CPMD section has the molecule moved to the center of the simulation cell and asks to calculate and print the forces on each atom at the end of the run.

&SYSTEM SYMMETRY 1 ANGSTROM CELL 8.00 1.0 1.0 0.0 0.0 0.0 CUTOFF 70.0 &END

The &SYSTEM section contains various parameters related to the simulations cell and the representation of the electronic structure. The keywords SYMMETRY, CELL and CUTOFF are required and define the (periodic) symmetry, shape, and size of the simulation cell, as well as the plane wave cutoff (i.e. the size of the basis set). The keyword ANGSTROM additionally indicates that all lengths and coordinates are given in angstrom (and not in a.u.).

&DFT FUNCTIONAL LDA &END

The &DFT section is used to select the density functional and related parameters. In this case we go with the local density approximation (which also is the default).

&ATOMS *H_MT_LDA.psp LMAX=S 2 4.371 4.000 4.000 3.629 4.000 4.000 &END

Finally the &ATOMS section is needed to specify
the atom coordinates and the pseudopotentials, that are used to
represent them. The detailed syntax of the pseudopotential specification
is a bit complicated and will not be needed nor discussed here. If you
want to know more, please have a look at the Further Details of the
Input section of the CPMD manual.

**Output File Format**

Now type:

cpmd.x 1-h2-wave.inp> 1-h2-wave.out

to start the calculation, which should be completed in less than a minute. The main output of the CPMD program is now in the file 1-h2-wave.out. Let’s have a closer look at the contents of this file.

PROGRAM CPMD STARTED AT: Mon Jul 25 15:46:31 2011 SETCNST| USING: CODATA 2006 UNITS ****** ****** **** **** ****** ******* ******* ********** ******* *** ** *** ** **** ** ** *** ** ** *** ** ** ** ** ** ** ******* ** ** ** ** *** ****** ** ** ** *** ******* ** ** ** ******* ****** ** ** ** ****** VERSION 3.15.1 COMPILED WITH GROMOS-AMBER QM/MM SUPPORT COPYRIGHT IBM RESEARCH DIVISION MPI FESTKOERPERFORSCHUNG STUTTGART The CPMD consortium Home Page: http://www.cpmd.org Mailing List: cpmd-list@cpmd.org E-mail: cpmd@cpmd.org *** Jul 25 2011 -- 12:49:25 ***

We start with the header, where you can see, when the run was started, what version on CPMD you were using, and when it was compiled.

THE INPUT FILE IS: ../1-h2-wave.inp THIS JOB RUNS ON: bladeppc7 THE CURRENT DIRECTORY IS: /homes/sp/fd/teo/WebIN/references/01-h2/1-h2-wave THE TEMPORARY DIRECTORY IS: /homes/sp/fd/teo/WebIN/references/01-h2/1-h2-wave THE PROCESS ID IS: 4298

Here we have some technical information about the environment, where this job was run.

****************************************************************************** * INFO - INFO - INFO - INFO - INFO - INFO - INFO - INFO - INFO - INFO - INFO * ****************************************************************************** * isolated hydrogen molecule. * * single point calculation. * ******************************************************************************

Here we see the contents of the &INFO section copied to the output.

SINGLE POINT DENSITY OPTIMIZATION USING SEED 123456 TO INIT. PSEUDO RANDOM NUMBER GEN. PATH TO THE RESTART FILES: ./ GRAM-SCHMIDT ORTHOGONALIZATION MAXIMUM NUMBER OF STEPS: 10000 STEPS MAXIMUM NUMBER OF ITERATIONS FOR SC: 10000 STEPS PRINT INTERMEDIATE RESULTS EVERY 10001 STEPS STORE INTERMEDIATE RESULTS EVERY 10001 STEPS NUMBER OF DISTINCT RESTART FILES: 1 TEMPERATURE IS CALCULATED ASSUMING EXTENDED BULK BEHAVIOR FICTITIOUS ELECTRON MASS: 400.0000 TIME STEP FOR ELECTRONS: 5.0000 TIME STEP FOR IONS: 5.0000 CONVERGENCE CRITERIA FOR WAVEFUNCTION OPTIMIZATION: 1.0000E-07 WAVEFUNCTION OPTIMIZATION BY PRECONDITIONED DIIS THRESHOLD FOR THE WF-HESSIAN IS .5000 MAXIMUM NUMBER OF VECTORS RETAINED FOR DIIS: 10 STEPS UNTIL DIIS RESET ON POOR PROGRESS: 10 FULL ELECTRONIC GRADIENT IS USED SPLINE INTERPOLATION IN G-SPACE FOR PSEUDOPOTENTIAL FUNCTIONS NUMBER OF SPLINE POINTS: 5000

This section now gives you a summary of the parameters read in from the &CPMD section, or their respective default settings.

EXCHANGE CORRELATION FUNCTIONALS LDA EXCHANGE: NONE LDA XC THROUGH PADE APPROXIMATION S.GOEDECKER, J.HUTTER, M.TETER PRB 54 1703 (1996) *** DETSP| SIZE OF THE PROGRAM IS kBYTES *** ***************************** ATOMS **************************** NR TYPE X(bohr) Y(bohr) Z(bohr) MBL 1 H 8.259993 7.558904 7.558904 3 2 H 6.857816 7.558904 7.558904 3 **************************************************************** NUMBER OF STATES: 1 NUMBER OF ELECTRONS: 2.00000 CHARGE: .00000 ELECTRON TEMPERATURE(KELVIN): .00000 OCCUPATION 2.0

[...] **************************************************************** * ATOM MASS RAGGIO NLCC PSEUDOPOTENTIAL * * H 1.0080 1.2000 NO S LOCAL * ****************************************************************

This part of the output tells you which and how many atoms and electrons are used, what functional and what pseudopotentials were used, and what the values of some related parameters are.

Immediately after, you can find any information related to your parallel (in case you use a parallel executable) execution. Specifically the MPI information:

PARAPARAPARAPARAPARAPARAPARAPARAPARAPARAPARAPARAPARAPARAPARAPARA NCPU NGW NHG PLANES GXRAYS HXRAYS ORBITALS Z-PLANES 0 2135 17037 10 161 637 0 1 1 2138 17072 11 160 636 0 1 2 2142 17074 10 160 636 0 1 3 2142 17078 11 160 636 0 1 4 2144 17076 10 160 636 1 1 5 2142 17088 11 160 636 0 1 6 2142 17086 10 160 636 0 1 7 2148 17094 11 160 636 0 1 G=0 COMPONENT ON PROCESSOR : 0 PARAPARAPARAPARAPARAPARAPARAPARAPARAPARAPARAPARAPARAPARAPARAPARA

and OpenMP:

OPENMPOPENMPOPENMPOPENMPOPENMPOPENMPOPENMPOPENMPOPENMPOPENMPOPEN NUMBER OF CPUS PER TASK 1 OPENMPOPENMPOPENMPOPENMPOPENMPOPENMPOPENMPOPENMPOPENMPOPENMPOPEN

where the number of MPI tasks (2 for this example) and the number of CPU per task (1 in this example), as specified by the user, are summarized.

************************** SUPERCELL *************************** SYMMETRY: SIMPLE CUBIC LATTICE CONSTANT(a.u.): 15.11781 CELL DIMENSION: 15.1178 1.0000 1.0000 .0000 .0000 .0000 VOLUME(OMEGA IN BOHR^3): 3455.14726 LATTICE VECTOR A1(BOHR): 15.1178 .0000 .0000 LATTICE VECTOR A2(BOHR): .0000 15.1178 .0000 LATTICE VECTOR A3(BOHR): .0000 .0000 15.1178 RECIP. LAT. VEC. B1(2Pi/BOHR): .0661 .0000 .0000 RECIP. LAT. VEC. B2(2Pi/BOHR): .0000 .0661 .0000 RECIP. LAT. VEC. B3(2Pi/BOHR): .0000 .0000 .0661 REAL SPACE MESH: 84 84 84 WAVEFUNCTION CUTOFF(RYDBERG): 70.00000 DENSITY CUTOFF(RYDBERG): (DUAL= 4.00) 280.00000 NUMBER OF PLANE WAVES FOR WAVEFUNCTION CUTOFF: 17133 NUMBER OF PLANE WAVES FOR DENSITY CUTOFF: 136605 ****************************************************************

This part of the output presents the settings read in from the &SYSTEM section of the input file and some derived parameters.

[...] (K+E1+L+N+X) TOTAL ENERGY = -1.09689770 A.U. (K) KINETIC ENERGY = 0.81247072 A.U. (E1=A-S+R) ELECTROSTATIC ENERGY = -0.48640053 A.U. (S) ESELF = 0.66490380 A.U. (R) ESR = 0.17302593 A.U. (L) LOCAL PSEUDOPOTENTIAL ENERGY = -0.84879440 A.U. (N) N-L PSEUDOPOTENTIAL ENERGY = 0.00000000 A.U. (X) EXCHANGE-CORRELATION ENERGY = -0.57417350 A.U.

After some output to report the setup of the initial guess for the electron structure, we now see a summary of the various energy contribution of to the total energy of the system, based on the initial guess. Now the program is ready to start the wavefunction optimization. The image illustrates, how the electron density is redistributed: density from the blue area is moved to the red area.

Starting from the initial guess based on atomic wavefunctions the wavefunction for the total system is now calculated with an optimization procedure. You can follow the progress of the optimization in the output file.

NFI GEMAX CNORM ETOT DETOT TCPU 1 3.816E-02 2.886E-03 -1.096898 0.000E+00 .03 2 8.838E-03 1.170E-03 -1.130522 -3.362E-02 .03 3 2.644E-03 2.718E-04 -1.132363 -1.841E-03 .03 4 5.300E-04 5.257E-05 -1.132456 -9.282E-05 .03 5 1.357E-04 1.007E-05 -1.132459 -3.693E-06 .03 6 3.758E-05 2.015E-06 -1.132460 -1.654E-07 .03 7 6.721E-06 4.105E-07 -1.132460 -9.583E-09 .03 8 6.526E-07 1.316E-07 -1.132460 -3.287E-10 .03 9 1.064E-07 3.130E-08 -1.132460 -1.792E-11 .04 10 1.702E-08 6.820E-09 -1.132460 -8.251E-13 .04

The columns have the following meaning:

- NFI: Step number (number of finite iterations)
- GEMAX: largest off-diagonal component
- CNORM: average of the off-diagonal components
- ETOT: total energy
- DETOT: change in total energy to the previous step
- TCPU: (CPU) time for this step.

And you can see that the calculation stops after the convergence criterion of 1.0d-7 has been reached for the GEMAX value.

**************************************************************** * * * FINAL RESULTS * * * **************************************************************** ATOM COORDINATES GRADIENTS (-FORCES) 1 H 8.2600 7.5589 7.5589 1.780E-02 1.506E-17 3.844E-17 2 H 6.8578 7.5589 7.5589 -1.780E-02 -2.366E-17 1.459E-17 **************************************************************** ELECTRONIC GRADIENT: MAX. COMPONENT = 7.63671E-09 NORM = 1.02554E-09 NUCLEAR GRADIENT: MAX. COMPONENT = 1.77985E-02 NORM = 1.02760E-02 TOTAL INTEGRATED ELECTRONIC DENSITY IN G-SPACE = 2.000000 IN R-SPACE = 2.000000 (K+E1+L+N+X) TOTAL ENERGY = -1.13245953 A.U. (K) KINETIC ENERGY = 1.09007152 A.U. (E1=A-S+R) ELECTROSTATIC ENERGY = -.47319175 A.U. (S) ESELF = .66490380 A.U. (R) ESR = .17302593 A.U. (L) LOCAL PSEUDOPOTENTIAL ENERGY = -1.09902230 A.U. (N) N-L PSEUDOPOTENTIAL ENERGY = .00000000 A.U. (X) EXCHANGE-CORRELATION ENERGY = -.65031699 A.U. ****************************************************************

Here we have the final summary of the results from
our single point calculation. Since we have requested the output of the
(atomic) forces you can see them alongside the atom coordinates. Please
note, that regardless of the input units, coordinates in the CPMD output
are always in atomic units. Although the calculation started with the
experimental H-H bond length there are still some significant forces in
the direction of the molecular axis. A clear indication, that within the
approximations used in this calculation the equilibrium H-H distance
lies somewhere else (but not too far away).

================================================================ BIG MEMORY ALLOCATIONS XF 158950 PSI 158950 RHOE 79475 GNL 80320 INZHP 76667 YF 158950 ATWFR 100400 GK 51111 WORK 100400 SCR 113859 ---------------------------------------------------------------- [PEAK NUMBER 90] PEAK MEMORY 1379357 = 11.0 MBytes ================================================================ **************************************************************** * * * TIMING * * * **************************************************************** SUBROUTINE CALLS CPU TIME ELAPSED TIME LOADPA 1 .18 .18 GLOSUM 98 .13 .13 ATRHO 1 .13 .13 FFTCOM 25 .09 .09 N-FFTCOM 37 .06 .06 XCENER 12 .06 .06 NUMPW 1 .03 .03 RGGEN 1 .03 .03 FORMFN 1 .02 .02 FFT-G/S 161 .02 .02 INVFFTN 24 .02 .02 FWFFT 12 .02 .02 INVFFT 13 .02 .02 FWFFTN 13 .01 .01 RHOOFR 11 .01 .01 EICALC 12 .01 .01 VOFRHOA 12 .01 .01 GORDER 1 .00 .00 ODIIS 11 .00 .00 VPSI 13 .00 .00 PHASE 25 .00 .00 VOFRHOB 12 .00 .00 PUTPS 1 .00 .00 ---------------------------------------------------------------- TOTAL TIME .85 .85 **************************************************************** CPU TIME : 0 HOURS 0 MINUTES .91 SECONDS ELAPSED TIME : 0 HOURS 0 MINUTES .91 SECONDS *** CPMD| SIZE OF THE PROGRAM IS kBYTES *** PROGRAM CPMD ENDED AT: Mon Jul 25 15:46:32 2011

In the final part of the output, we see some statistics regarding memory and CPU time usage. This is mainly of interest for CPMD developers, but it does not hurt to have an occasional look and see if the numbers are reasonable. Please note, that the retrieval of this information is highly platform dependent, and that on some platforms the output may be bogus or very unreliable.

Finally for parallel jobs, you will also get a summary on the performance of MPI (same consideration as above holds regarding the reliability of these numbers):

================================================================ = COMMUNICATION TASK AVERAGE MESSAGE LENGTH NUMBER OF CALLS = = SEND/RECEIVE 59868. BYTES 21. = = BROADCAST 5567. BYTES 302. = = GLOBAL SUMMATION 548. BYTES 153. = = GLOBAL MULTIPLICATION 0. BYTES 1. = = ALL TO ALL COMM 496933. BYTES 62. = = PERFORMANCE TOTAL TIME = = SEND/RECEIVE 4043.849 MB/S .000 SEC = = BROADCAST 52.110 MB/S .032 SEC = = GLOBAL SUMMATION 1.920 MB/S .131 SEC = = GLOBAL MULTIPLICATION .000 MB/S .001 SEC = = ALL TO ALL COMM 207.264 MB/S .149 SEC = = SYNCHRONISATION .077 SEC = ================================================================

### Other Output Files

Apart from the console output, our CPMD run created a few other files. Most importantly the restart file RESTART.1 and its companion file LATEST. The restart file contains the final state of the system when the program terminated. This is needed to start other calculations, which need a converged wavefunction as a starting point. The file GEOMETRY.xyz contains the coordinates of the atoms in a format, that can be read in by many molecular visualization programs. The other files (for instance GEOMETRY in this example) can be ignored.