Skip to content

Instantly share code, notes, and snippets.

@jarvist
Last active July 24, 2021 16:09
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jarvist/4673243 to your computer and use it in GitHub Desktop.
Save jarvist/4673243 to your computer and use it in GitHub Desktop.
NWCHEM input file for CDFT on a Ethylene (C2H4) / C2F4 molecular pair for calculating charge transfer state energies + comparing to a TD-DFT method.
title "C2F4 C2H4 with displacement: 04.00 Angstroms"
echo "This is a story about an ordinary teddy bear."
#Hellow 64GB / 16 node machine... will you be my friend?
memory stack 750 mb heap 1500 mb global 1500 mb
echo "Thundercats HO!"
geometry molA units angstroms noautoz noautosym
#First our Ethylene... B3lyp/6-311g* optimisation, Gaussian, using symmetry. JMF 2013-01-28
C 0.000000 0.000000 0.663493
C 0.000000 0.000000 -0.663493
H 0.000000 0.922503 1.236446
H 0.000000 -0.922503 1.236446
H 0.000000 -0.922503 -1.236446
H 0.000000 0.922503 -1.236446
end
geometry molB
#Now our C2F2... B3lyp/6-311g* optimisation, Gaussian, using symmetry. JMF 2013-01-28
C 04.00 0.000000 0.660905
C 04.00 0.000000 -0.660905
F 04.00 1.103866 1.386732
F 04.00 -1.103866 1.386732
F 04.00 -1.103866 -1.386732
F 04.00 1.103866 -1.386732
end
geometry molAB units angstroms noautoz noautosym
#First our Ethylene... B3lyp/6-311g* optimisation, Gaussian, using symmetry. JMF 2013-01-28
C 0.000000 0.000000 0.663493
C 0.000000 0.000000 -0.663493
H 0.000000 0.922503 1.236446
H 0.000000 -0.922503 1.236446
H 0.000000 -0.922503 -1.236446
H 0.000000 0.922503 -1.236446
#Now our C2F2... B3lyp/6-311g* optimisation, Gaussian, using symmetry. JMF 2013-01-28
C 04.00 0.000000 0.660905
C 04.00 0.000000 -0.660905
F 04.00 1.103866 1.386732
F 04.00 -1.103866 1.386732
F 04.00 -1.103866 -1.386732
F 04.00 1.103866 -1.386732
end
basis
* library 6-31++G*
end
#Fragments for molA
set geometry molA
dft
xc b3lyp
odft
vectors input atomic output molA.mos
end
task dft ignore
#Fragments for molB
set geometry molB
dft
xc b3lyp
odft
vectors input atomic output molB.mos
end
task dft ignore
#Ground state DFT please, for the dimer
set geometry molAB
dft
mult 1
vectors input fragment molA.mos molB.mos output molAB.mos #Fragment guess
xc b3lyp
end
task dft energy
#Now do a TDDFT calculation based on this, solving for first singlet (~CT state)
tddft
nroots 1
singlet
end
task tddft energy
#OK; now let's try the big constrained calculation
set geometry molAB
dft
vectors input fragment molA.mos molB.mos output molABcdft.mos #Fragment guess...
iterations 50
print kinetic_energy
xc b3lyp
convergence nolevelshifting
#code for Constrained DFT - see http://www.nwchem-sw.org/index.php/Density_Functional_Theory_for_Molecules#CDFT_--_Constrained_DFT
odft
mult 1
# vectors swap beta 128 127 #unsure how to calculate this for PCBM... 231 alpha electrons 231 beta electrons <- mono PCBM
cdft 1 6 charge +1.0 #Ethylene
cdft 1 6 spin +1.0
cdft 7 12 charge -1.0 #C2F4
cdft 7 12 spin -1.0
end
set dft:cdft_maxiter 1000
task dft energy
title "This is a story about an ordinary teddy bear."
echo "Thundercats HO!"
#Hellow 64GB / 16 node machine... will you be my friend?
memory stack 750 mb heap 1500 mb global 1500 mb
geometry units angstroms noautoz noautosym
#First our Ethylene... B3lyp/6-311g* optimisation, Gaussian, using symmetry. JMF 2013-01-28
C 0.000000 0.000000 0.663493
C 0.000000 0.000000 -0.663493
H 0.000000 0.922503 1.236446
H 0.000000 -0.922503 1.236446
H 0.000000 -0.922503 -1.236446
H 0.000000 0.922503 -1.236446
#Now our C2F2... B3lyp/6-311g* optimisation, Gaussian, using symmetry. JMF 2013-01-28
C 10.000000 0.000000 0.660905
C 10.000000 0.000000 -0.660905
F 10.000000 1.103866 1.386732
F 10.000000 -1.103866 1.386732
F 10.000000 -1.103866 -1.386732
F 10.000000 1.103866 -1.386732
end
basis
* library 6-31++G*
end
dft
iterations 50
print kinetic_energy
xc b3lyp
# convergence nolevelshifting
#code for Constrained DFT - see http://www.nwchem-sw.org/index.php/Density_Functional_Theory_for_Molecules#CDFT_--_Constrained_DFT
odft
mult 1
# vectors swap beta 128 127 #unsure how to calculate this for PCBM... 231 alpha electrons 231 beta electrons <- mono PCBM
cdft 1 6 charge +1.0 #Ethylene
cdft 1 6 spin +1.0
cdft 7 12 charge -1.0 #C2F4
cdft 7 12 spin -1.0
end
set dft:cdft_maxiter 1000
task dft energy
#tddft
# nroots 1
# singlet
#end
#
#task tddft energy
@jarvist
Copy link
Author

jarvist commented Jan 30, 2013

NB: I was stuck for ages due to not using a diffuse basis set, therefore the CDFT could not impose a suitable factor to cause the change in potential!
This NWCHEM script is probably overkill - you don't really need to do a fragment DFT setup for this calculation anymore, but I left it here as it might be a useful basis for doing charge transfer CDFT (diabatic states) calculations.

@jarvist
Copy link
Author

jarvist commented Apr 16, 2015

Thankyou Jarv from the past for your little NB - I've found myself doing exactly the same thing (too minimal a basis), and ended up Googling my way here.
The error you get is just the typical CDFT failed to optimise one: "CDFT failed to optimize multipliers"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment