This is an old revision of the document!
−Table of Contents
How to run NAMD computations using the CP2K-NEWTONX interface
This is a short tutorial on how to use the CP2K-NEWTONX interface to a) generate initial conditions to compute photoabsorption spectra and b) to run non-adiabatic dynamics simulations using orbital derivative couplings. A more comprehensive tutorial on all NEWTONX features, including a documentation of the required specifications for the CP2K interface, can be found on the NEWTONX homepage, https://newtonx.org/documentation-tutorials/.
Brief theory recap
The interface enables to use electronic-structure data from CP2K and combine it with the surface hopping module of NEWTONX. Excitation energies ΩM and excited-state eigenvectors XM to describe the excited state M are provided by CP2K, relying on the Tamm-Dancoff eigenvalue problem,
AXM=ΩMSXM,∑κk[Fμκσδik−FikσSμκ]XMκkσ+∑λKμλσ[DXM]Cλiσ=∑κΩMSμκXMκiσ,
with S representing the conventional atomic-orbital overlap matrix, F the Kohn-Sham matrix, K the kernel comprising – depending on the chosen functional – Coulomb, exchange and exchange-correlation contributions, and C the molecular orbital coefficients. μ,ν,… denote atomic orbitals, i,j,… occupied molecular orbitals. The corresponding excited-state gradient is obtained setting up a variational Lagrangian and taking the derivative with respect to the nuclear coordinates R (see also https://www.cp2k.org/howto:tddft).
By performing a TDDFPT computation, excitation energies ΩM(R(t)), excited-state eigenvectors XM(R(t)) and corresponding excited-state gradients ∇ΩM(R(t)) are provided by CP2K. On the so-defined potential energy surfaces, the nuclei are propagated classically relying on the surface hopping code of NEWTONX,
R(t+Δt)=R(t)+v(t)Δt+12a(t)Δt2,v(t+Δt)=v(t)+12(a(t)+a(t+Δt))Δt,a(t)=−1m∇ΩM(R(t)).
The coefficients cM(t) of the total wave function Ψ(R(t)) over all excited states M are obtained implying hopping probabilities PM→N of Tully's surface hopping,
Ψ(R(t))=∑McM(t)ΨM(R(t))idcM(t)dt=∑NcN(t)(δMNEN(R(t))−iσMN(t)),PM→N=max[0,−2Δt|cM|2Re(cMcN∗)σMN].
The therefore required non-adiabatic time derivative couplings σMN can be obtained relying on semi-empirical models (Baeck-An; please cite Barbatti et al., Open Research Europe 1, 49 (2021).) or as numerical time derivative couplings (orbital time derivative (OD); please cite Ryabinkin et al., J. Phys. Chem. Lett. 6, 4200 (2015); Barbatti et al., Molecules 21, 1603 (2021).), with the corresponding molecular orbital overlap matrix St−Δt,t being provided by CP2K,
σODMN=∑iaXMia∂∂tXNia+∑iabXMiaXNibSt−Δt,tab−∑ijaPijXMiaXNjaSt−Δt,tjiSt−Δt,tpq=⟨ϕi(R(t−Δt))|ϕj(R(t))⟩Δt. a,b,… denote virtual molecular orbitals.
General input setup
The input sections for TDDFPT energy and gradient computations are described in the CP2K tutorial https://www.cp2k.org/howto:tddft. To furthermore provide the required CP2K output, subsequently read in by NEWTONX, the following print statements have to be added to the CP2K input files:
FORCE_EVAL/PRINT/FORCES
: prints the excited-state forcesTDDFPT/PRINT/NAMD_PRINT
with keyword optionPRINT_PHASES
: prints the excited-state eigenvectors in MO format as well as the corresponding phases.VIBRATIONAL_ANALYSIS/PRINT/NAMD_PRINT
: prints normal modes to generate initial conditions
It should furthermore be noted that cartesian coordinates have to be provided in terms of the external file “coord.cp2k” and that the number of atoms has to be specified in the CP2K input file in the SUBSYS section.
A) Initial conditions and photoabsorption spectra
The following tutorial to obtain photoabsorption spectra is based on https://vdv.dcf.mybluehost.me/nx/wp-content/uploads/2020/02/tutorial-2_2.pdf.
For the electronic-structure calculation with CP2K, a cp2k.inp
and cp2k.par
file as well as a coordinate file named coord.cp2k
has to be provided in a subdirectory called JOB_AD
, with cp2k.inp
including all required print sections stated above. Furthermore, to generate the initial conditions, the initqp_input
file requires to specify iprog = 10
for CP2K and file_nmodes = cp2k.eig
to refer to the corresponding output file comprising the normal modes provided by CP2K. All other keywords are to be chosen as outlined in the corresponding NEWTONX tutorial.
Examplary input files for computing the absorption spectrum of a water molecule are given below:
- h2o_cp2k.inp
&GLOBAL PROJECT testsuite_ad RUN_TYPE ENERGY PREFERRED_DIAG_LIBRARY SL PRINT_LEVEL medium &END GLOBAL &FORCE_EVAL &PRINT # print statement for ground-state or excited-state forces &FORCES &END FORCES &END PRINT METHOD Quickstep &PROPERTIES &TDDFPT # TDDFPT input section to compute 10 excited states &DIPOLE_MOMENTS DIPOLE_FORM LENGTH &END DIPOLE_MOMENTS KERNEL FULL NSTATES 10 MAX_ITER 100 MAX_KV 20 CONVERGENCE [eV] 1.0e-5 RKS_TRIPLETS F &PRINT # NAMD print section to print excited-state eigenvectors &NAMD_PRINT PRINT_VIRTUALS T PRINT_PHASES T &END NAMD_PRINT &END PRINT &END TDDFPT &END PROPERTIES &DFT &QS METHOD GAPW EPS_DEFAULT 1.0E-17 &END QS &SCF SCF_GUESS restart &OT PRECONDITIONER FULL_ALL MINIMIZER DIIS &END OT &OUTER_SCF MAX_SCF 900 EPS_SCF 1.0E-7 &END OUTER_SCF MAX_SCF 10 EPS_SCF 1.0E-7 &END SCF POTENTIAL_FILE_NAME POTENTIAL BASIS_SET_FILE_NAME EMSL_BASIS_SETS &MGRID CUTOFF 1000 REL_CUTOFF 100 NGRIDS 5 &END MGRID &POISSON PERIODIC NONE PSOLVER MT &END &XC &XC_FUNCTIONAL PBE &END XC_FUNCTIONAL &END XC &END DFT &SUBSYS &CELL ABC 8.0 8.0 8.0 PERIODIC NONE &END CELL &COORD @include coord.cp2k # Coordinates are provided externally for the interface &END COORD &TOPOLOGY &CENTER_COORDINATES T &END NATOMS 3 CONNECTIVITY OFF &END TOPOLOGY &KIND H BASIS_SET 6-311Gxx POTENTIAL ALL &END KIND &KIND O BASIS_SET 6-311Gxx POTENTIAL ALL &END KIND &END SUBSYS &END FORCE_EVAL
The resulting output file of the initcond.pl script of NEWTONX states that the read-in cartesian normal modes are first transfered to mass-weighted normal modes.
Cartesian normal modes (1/sqrt(amu)) 0.00 0.00 0.00 0.00 0.00 0.00 1523.92 3851.12 0.0000 -0.0492 0.0001 -0.1268 0.5632 -0.0083 0.0000 -0.0000 -0.0886 0.0000 -0.0000 -0.0169 0.0047 0.5777 0.0000 -0.0000 -0.0000 -0.0000 -0.0000 0.5630 0.1269 0.0155 -0.0715 0.0487 0.0001 0.3905 -0.0004 -0.1267 0.5632 -0.0082 -0.4184 -0.5910 0.7043 0.0008 0.7071 -0.0162 0.0040 0.5768 0.0000 0.0000 -0.0001 -0.5885 0.0007 0.5630 0.1270 0.0155 0.5678 -0.3867 0.0000 0.3905 -0.0004 -0.1267 0.5632 -0.0083 0.4184 0.5910 0.7043 -0.0009 -0.7071 -0.0170 0.0051 0.5768 0.0000 0.0000 -0.0000 0.5885 -0.0007 0.5630 0.1269 0.0154 0.5678 -0.3867 3986.44 0.0712 -0.0000 0.0000 -0.5650 0.0000 -0.4222 -0.5650 0.0000 0.4222 Mass weighted normal modes Frequencies will be multiplied by ANH_F = 1.00000 0.00 0.00 0.00 0.00 0.00 0.00 1523.92 3851.12 0.0001 -0.1967 0.0006 -0.5069 2.2526 -0.0330 0.0000 -0.0000 -0.3543 0.0000 -0.0000 -0.0677 0.0186 2.3104 0.0000 -0.0000 -0.0001 -0.0000 -0.0002 2.2517 0.5077 0.0619 -0.2861 0.1949 0.0001 0.3920 -0.0004 -0.1272 0.5654 -0.0083 -0.4200 -0.5933 0.7071 0.0008 0.7099 -0.0162 0.0040 0.5791 0.0000 0.0000 -0.0001 -0.5908 0.0007 0.5652 0.1275 0.0155 0.5700 -0.3882 0.0000 0.3921 -0.0004 -0.1272 0.5654 -0.0083 0.4200 0.5933 0.7071 -0.0009 -0.7099 -0.0171 0.0051 0.5790 0.0000 0.0000 -0.0000 0.5908 -0.0007 0.5652 0.1274 0.0155 0.5700 -0.3882 3986.44 0.2847 -0.0000 0.0000 -0.5672 0.0000 -0.4238 -0.5672 0.0000 0.4238
The thereon based initial conditions are summarized in the output files dubbed “final_output”, comprising geometries and velocities, as examplarily given below,
Initial condition = 1 Geometry in COLUMBUS and NX input format: o 8.0 5.00630777 5.00000001 4.46399957 15.99491464 h 1.0 6.37684065 5.00000128 5.50815661 1.00782504 h 1.0 3.52303474 5.00000149 5.58297278 1.00782504 Velocity in NX input format: -0.000089112 0.000000000 -0.000020915 0.000417197 0.000000002 0.000694479 0.000997296 0.000000013 -0.000362483 Epot of initial state (eV): 0.0865 Epot of final state (eV): 19.0799 Vertical excitation (eV): 18.9935 Is Ev in the required range? YES Ekin of initial state (eV): 0.0479 Etot of initial state (eV): 0.1343 Oscillator strength: 0.1221 State: 10
Moreover, the output file cross-section.dat
comprises the data points of the computing photoabsorption spectrum, as shown below.