shankar1729 / jdftx

JDFTx: software for joint density functional theory
http://jdftx.org
79 stars 49 forks source link

Issue with calculating adsorption energy #310

Closed yygao7 closed 6 months ago

yygao7 commented 6 months ago

Dear Shankar,

I attempted to calculate the adsorption energy using both VASP and JDFTx separately. The calculation process is as follows:

Fads = F( NO ) – F( ) – F( NO ) = -435.2356455 – (-409.2763019) – (-25.94538336) = -0.37987314 Eads = E( NO ) – E( ) – E( NO ) = -626.00511 – (-613.86243) – (-12.306743) = 0.164063 Where F and E represent the energies calculated by JDFTx and VASP in a vacuum, respectively.

The structure computed by JDFTx was optimized using VASP. It can be observed that there is a significant difference in the results obtained from the two software packages. Additionally, from the perspective of the adsorption configuration, the adsorption energy should be positive.

I have attached the relevant documentation for your reference. I wonder if there are any issues in my JDFTx input file. I am looking forward to your suggestions.

Thanks for your time!

Best, Cathy jdftx-gas.zip jdftx-gasonslab.zip jdftx-slab.zip

ximik69 commented 6 months ago

Hi Cathy, I looked your files through and have several suggestions. First of all one can compare the results of different programs only if calculating under the same conditions. There is no info about parameters in vasp. There one should pay attention to exclusion or compensation of interactions between layers, incl. forming dipoles and compensation of them. What I have seen in jdftx input files - NO is optimized but slabs with it or w/o it are not. I didn't check whether distances d(N-O) are exactly the same for isolated and adsorbed molecule. Everything should either be optimized or not. Mixing opt with noopt can give epic differences.

If I would calculate adsorbtion, I'd add coulomb-truncation slab 0 0 1 and coulomb-truncation embed 0 0 0.5 to slabs.

Cheers.

yygao7 commented 6 months ago

Thank you for your kind advice!

As you suggested, I added the coulomb trunaction commands to the input file, and recalculated the energy of the optimized structure. However, when I calculating the energy of the slab with gas NO, the calculation crashed with the following error:

"---------- Setting up coulomb interaction ---------- Setting up double-sized grid for truncated Coulomb potentials: R = [ 35.742 -17.8721 0.104129 ] [ 0 30.949 0.11749 ] [ 0 0 75.6497 ] unit cell volume = 83682.1 G = [ 0.175793 0.101515 -0.000399633 ] [ 0 0.203017 -0.000315303 ] [ 0 -0 0.0830563 ] Chosen fftbox size, S = [ 144 144 320 ] Integer grid location selected as the embedding center: Grid: [ 0 0 80 ] Lattice: [ 0 0 0.5 ] Cartesian: [ 0.0260322 0.0293726 18.9124 ] Constructing Wigner-Seitz cell: 14 faces (6 quadrilaterals, 8 hexagons) Range-separation parameter for embedded mesh potentials due to point charges: 0.628518 bohrs. Lattice direction 001 is not perpendicular to the other two basis vectors. End date and time: Fri Dec 22 12:36:16 2023 (Duration: 0-0:00:00.55) Failed."

However, it didn’t occur when calculating the energy of the slab.

Would you please give me some hint where my computations might have gone wrong?

Thank you for your time!

Best, Cathy gasonslab-coulomb.zip

ximik69 commented 6 months ago

It seems you have z-axis almost but not exactly perpendicular to other axes.

If it is isolated slab, which is the case, you can adjust by hand z axis in your NO-on-slab system. Good question whether it slightly changes geometry of slab+NO or not. Or how to change the unit cell without changing geometry of slab and adsorbate. At least angles are very close to 90 thus I think you can neglect changes. Just export model to vesta or diamond, change unit cell angles to 90 and then insert data into jdftx input file.

Hope that helps.

Best, Igor.

shankar1729 commented 6 months ago

Hi Cathy,

Igor's suggestions on adding coulomb truncation would definitely help improve the accuracy of your simulation. However, likely your energy difference is emerging from the gas-phase NO calculation in JDFTx. You don't have any spin settings set, so you are calculating an unpolarized configuration with a higher energy than the ground state with an unpaired spin.

Make sure you set spintype z-spin and elec-initial-magnetization 1 yes to constrain to one unpaired spin for the gas-phase NO. (You could also leave the magnetization unconstrained and use fermi smearing, but I would recommend constraining the spin state for molecules when you know them explicitly.)

Best, Shankar

yygao7 commented 6 months ago

Dear Igor,

Thanks for your advice!

I will adjust the z axis to ensure that the third direction is exactly orthogonal to the first two and recalculate again.

Thanks again for helping me.

Best, Cathy

yygao7 commented 6 months ago

Dear Shankar,

Thank you for pointing out my problem.

I've encountered another issue now. When I do fixed potential calculations, the ElecMinimize can’t converge with the following error:

“ElecMinimize: Step failed along negative gradient direction. ElecMinimize: Probably at roundoff error limit. (Stopping) Setting wave functions to eigenvectors of Hamiltonian”

But the calculation in vacuum and solution converged well.

The slab contains iron. I suspect it might be due to the absence of elec-initial-magnetization settings in my calculations, or could there be other issues in my input file? I am looking forward to your advice.

Thanks in advance!

Best, Cathy constantpotential.zip

shankar1729 commented 6 months ago

Hi Cathy,

Your smearing is likely too small for the chosen supercell and k-point sampling, leading to a bumpy energy landscape for optimizing the occupations. Use a larger smearing ~ 0.01 Eh, possibly with the Cold or MP1 options if you are concerned about the electronic entropy being unphysical.

Unrelated, your chosen number of processes (64) is not efficient for a calculation with nStates = 10. Please see the Getting started page and numerous other threads here on how to optimally use the hybrid MPI + threads parallelization.

Best, Shankar

yygao7 commented 6 months ago

Dear Shankar,

Thanks for your reply, and it helps a lot!

I changed the smearingWidth to 0.01 Eh and it converged successfully. But I'm puzzled as to why, when I replace the Fe element with other elements such as Co, Ni, Cu, the convergence can be achieved using the same smearing width as before. The supercell and k-point sampling are the same.

Additionally, thank you for addressing the issues I encountered with parallelization. I have now utilized the -n and -c options in accordance with the instructions on the 'Getting Started' page to enhance the speed of my calculations.

Best, Cathy

shankar1729 commented 6 months ago

Glad to hear that: the lack of convergence is difficult to predict. The low smearing can create a problematic energy landscape, but it depends on the electronic structure near the Fermi level. Additionally, even in a problematic energy landscape, you may not always encounter the convergence difficulty.

Best, Shankar

yygao7 commented 6 months ago

Dear Shankar,

Thank you for all your responses; they are very helpful in guiding me through the use of JDFTx.

Have a nice day!

Best, Cathy