QuantumATK Forum

QuantumATK => General Questions and Answers => Topic started by: marmotte on August 27, 2013, 10:28

Title: Grimme's DFT-D2 semi-empirical model for van der Waals interactions
Post by: marmotte on August 27, 2013, 10:28
Dear ATK team,

Many thanks for the new version 13.8.b1. It is really and excellent version. :D

I need to know how to setup calculations with D2-DFT ? Could you please help on how to set-up these calculations ?

Thank you
Title: Re: Grimme's DFT-D2 semi-empirical model for van der Waals interactions
Post by: Anders Blom on August 27, 2013, 12:46
We are preparing a tutorial on this. For now, please see the two attached files.

Edit: After some bug fixes, the DFTD2 script has been moved into our core functionality. Attached now is a pure script for graphene that works without any additional import statements.
Title: Re: Grimme's DFT-D2 semi-empirical model for van der Waals interactions
Post by: marmotte on August 27, 2013, 14:22
Hi Anders, Thank you  ! I think I will wait for your tutorial and may be an upgraded version because I still have problem when running these script such as "import extendedCalculatorWithDFTD2" ...please advise if we need to add/on some extra module for that.
Title: Re: Grimme's DFT-D2 semi-empirical model for van der Waals interactions
Post by: Anders Blom on August 27, 2013, 15:23
You just need to place the two files I attached in the same directory, and run "atkpython graphene.py" in this directory.
Title: Re: Grimme's DFT-D2 semi-empirical model for van der Waals interactions
Post by: marmotte on August 28, 2013, 09:48
Hi Anders,
I followed your instruction and I'm getting this error

                            |--------------------------------------------------|
Calculating Kinetic Matrix : ==================================================
Traceback (most recent call last):
  File "graphene.py", line 68, in <module>
    optimizer_method=QuasiNewton(),
  File "./zipdir/NL/Dynamics/Optimization/OptimizeGeometry.py", line 211, in OptimizeGeometry
  File "./zipdir/NL/Dynamics/Optimization/OptimizeGeometry.py", line 263, in runRelaxation
  File "./zipdir/NL/Dynamics/ASEAtomsInterface.py", line 173, in get_forces
  File "./zipdir/NL/Dynamics/ASEAtomsInterface.py", line 97, in _update
  File "./zipdir/NL/Analysis/TotalEnergy.py", line 26, in __init__
  File "/home/goumris/D2-DFT/graphene/DFTD2.py", line 173, in _calculateTotalEnergy
    translation = NLEngine.Cartesian3DDouble()
AttributeError: 'module' object has no attribute 'Cartesian3DDouble'

Timing:                          Total     Per Step        %

--------------------------------------------------------------------------------

Exchange-Correlation    :       6.53 s       0.65 s      25.53% |=============|
Valence Density         :       3.73 s       0.37 s      14.59% |=======|
Real Space Integral     :       3.65 s       0.37 s      14.29% |=======|
Diagonalization         :       3.06 s       0.34 s      11.97% |======|
Constant Terms          :       0.74 s       0.74 s       2.89% |=|
Difference Density      :       0.68 s       0.07 s       2.67% ||
Basis Set Generation    :       0.48 s       0.48 s       1.88% ||
Real Space Basis        :       0.27 s       0.27 s       1.06% ||
Core Density            :       0.11 s       0.01 s       0.44% |
Neutral Atom Potential  :       0.07 s       0.07 s       0.26% |
Hartree Potential       :       0.04 s       0.00 s       0.17% |
Mixing                  :       0.04 s       0.00 s       0.17% |
Setting Density Matrix  :       0.00 s       0.00 s       0.01% |
Hubbard Term            :       0.00 s       0.00 s       0.00% |
--------------------------------------------------------------------------------

and when I want to run the script graphne.py from the VNL interface, I have also this error

+------------------------------------------------------------------------------+
| NanoLanguageScript execution started                                         |
+------------------------------------------------------------------------------+
# ------------------------------------------------------------ #
# This time-limited preview version will expire on 2013-10-01. #
# ------------------------------------------------------------ #
+------------------------------------------------------------------------------+
|                                                                              |
| Atomistix ToolKit 13.8.b1 [Build a1c2415]                                    |
|                                                                              |
+------------------------------------------------------------------------------+
Traceback (most recent call last):
  File "/tmp/1866424033809726.py", line 4, in <module>
    from DFTD2 import extendedCalculatorWithDFTD2
ImportError: No module named DFTD2
+------------------------------------------------------------------------------+
| NanoLanguageScript execution finished                                        |
+------------------------------------------------------------------------------+

Thx
Title: Re: Grimme's DFT-D2 semi-empirical model for van der Waals interactions
Post by: Anders Blom on August 28, 2013, 10:12
It's quite simple :)

In the first case, "atkpython" actually refers to 12.8. If you check your PATH settings to make sure you run 13.8 instead, it will work.

If you want to do it from within VNL, create a new project located in the directory where the two files are located (VNL menu, choose Project>New). Once the project is defined and opened, you should see the two files - just drop graphene.py on the Job Manager.
Title: Re: Grimme's DFT-D2 semi-empirical model for van der Waals interactions
Post by: marmotte on August 28, 2013, 12:02
I did it using Vnl and also with new project. But still have problem with it

+------------------------------------------------------------------------------+
| NanoLanguageScript execution started                                         |
+------------------------------------------------------------------------------+
# ------------------------------------------------------------ #
# This time-limited preview version will expire on 2013-10-01. #
# ------------------------------------------------------------ #
+------------------------------------------------------------------------------+
|                                                                              |
| Atomistix ToolKit 13.8.b1 [Build a1c2415]                                    |
|                                                                              |
+------------------------------------------------------------------------------+
Traceback (most recent call last):
  File "/tmp/4479250470234043.py", line 4, in <module>
    from DFTD2 import extendedCalculatorWithDFTD2
ImportError: No module named DFTD2
+------------------------------------------------------------------------------+
| NanoLanguageScript execution finished                                        |
+----------------------------------------------------------------------------

could you please help me ?

Many thanks
Title: Re: Grimme's DFT-D2 semi-empirical model for van der Waals interactions
Post by: Anders Blom on August 28, 2013, 15:16
I see you are on Linux. I'm on Windows, it works fine. I have to investigate. However, it would help a lot if you could provide the EXACT steps you follow.

Mine are: Drop the file graphene.py on Job manager. Click Run.

For now run on the command line instead.
Title: Re: Grimme's DFT-D2 semi-empirical model for van der Waals interactions
Post by: Anders Blom on August 28, 2013, 15:22
Please insert these two lines at the top of the script, before running it:

Code: python
import sys
print sys.path

and see if the project directory is part of the output. It should be!
Title: Re: Grimme's DFT-D2 semi-empirical model for van der Waals interactions
Post by: Anders Blom on September 2, 2013, 09:46
This turns out to be a bug in the beta-version. It can be solved by adding

Code: python
import sys, os
sys.path.append(os.curdir)

to the beginning of graphene.py.
Title: Re: Grimme's DFT-D2 semi-empirical model for van der Waals interactions
Post by: ramkrishna on September 23, 2013, 15:46
Dear Sir,
     Does this DFT-D2 come with the GGA calculations only or we can use it with LDA also??

Regards
Ramkrishna
Title: Re: Grimme's DFT-D2 semi-empirical model for van der Waals interactions
Post by: Anders Blom on September 23, 2013, 16:01
Yes, the vdW potential is something you add to the existing exchange-correlation potential, whichever it is.
Title: Re: Grimme's DFT-D2 semi-empirical model for van der Waals interactions
Post by: Nordland on September 23, 2013, 17:08
You can use it with LDA, however it is important to know that the functional is fitted to give correct results for GGA.
There is a global scaling parameter in the code called S. The global scaling parameter S has been optimized for several different DFT functionals such as PBE (S=0.75), BLYP (S=1.2), and B3LYP (S=1.05). Therefore before using it with any other functional one should really consider what is the appropriate value of S.
Title: Re: Grimme's DFT-D2 semi-empirical model for van der Waals interactions
Post by: ams_nanolab on September 25, 2013, 08:46
Dear Dr. Blom,

I am getting the following error running the script for mos2 , i think some additions are needed in the D2DFT.py file in the R0 and C6 map (I am guessing).

For graphene it is running fine. So I guess it is the absence of Mo and S in the D2DFT.py , kindly give the parameters.

Attached is the screenshot.
Title: Re: Grimme's DFT-D2 semi-empirical model for van der Waals interactions
Post by: Anders Blom on September 25, 2013, 09:16
Yes, precisely. If you can find a reference for the relevant values in the literature, you can easily insert them yourself into the list of supported elements in the script.
Title: Re: Grimme's DFT-D2 semi-empirical model for van der Waals interactions
Post by: ams_nanolab on September 25, 2013, 11:15
Yes I understand, but where to find the values for Mo, W etc. transition metals ? Could you point. Are there any theoretical formula?
Title: Re: Grimme's DFT-D2 semi-empirical model for van der Waals interactions
Post by: Anders Blom on September 25, 2013, 12:59
Turns out that if you (or rather, we!) read Grimme's article a bit closer, the same parameters apply to the whole list of elements from Y to Cd, so you can use that value for Mo. Presumably this is an approximation, but so is the whole approach anyway.

Thus, add, in the relevant places,

PeriodicTable.Mo :  1.606*Angstrom,

PeriodicTable.Mo : 24.67*C6_unit,

and try that. There are already parameters for S in the script.

For W (tungsten) it seems there are no parameters at least in Grimme's article - there are no parameters above Xe. Perhaps they have been published elsewhere, you can try to search for it.
Title: Re: Grimme's DFT-D2 semi-empirical model for van der Waals interactions
Post by: ams_nanolab on September 25, 2013, 14:56
Thanks it is working now, will look for W database, if found will post it.  ;D
Title: Re: Grimme's DFT-D2 semi-empirical model for van der Waals interactions
Post by: marmotte on September 27, 2013, 21:45
Dear Anders,

Could you please tell me if the D2-DFT approach will be in the final version 13.8 ? I mean, if we will be able to run the Geometry optimization and also extract the band structure, DOS etc.. .
By the way, could you please update us about the final version 13.8 ?

Thank you
Title: Re: Grimme's DFT-D2 semi-empirical model for van der Waals interactions
Post by: Anders Blom on September 27, 2013, 23:48
We will see precisely how it appears in the final version, but it will someone be part of the released package.

I must also point out that there is a bug in the version of the script above (I will actually remove it). The correct script is attached here - and it also supports calculating the stress using the Grimme additional potential.

The D2 approach can already today be used for geometry optimizations and bands structure and DOS etc (although I suspect it has a rather small influence on those quantities), using the attached script.
Title: Re: Grimme's DFT-D2 semi-empirical model for van der Waals interactions
Post by: Anders Blom on October 20, 2013, 17:42
The DFTD2 functionality is now available in the main NanoLanguage module, and thus you don't need any special import statements to use it. The attached file will run as-is in 13.8 (but not some of the preview versions to 13.8, like the beta-versions).
Title: Re: Grimme's DFT-D2 semi-empirical model for van der Waals interactions
Post by: atk_user on April 21, 2014, 08:42
Dear, Anders Blom

Is it possible to calculate the Density of States (DOS) with DFT-D2 (PBE-vdW)? How about I-V calculation with DFT-D2?
I tried but the DOS is the same to the results of the DFT (PBE) functional. (The geometry optimization work fine!!)

Here is the part of my input file (Exchange-Correlation and DOS part)
Code
#----------------------------------------
# Exchange-Correlation
#----------------------------------------
exchange_correlation = GGA.PBE

numerical_accuracy_parameters = NumericalAccuracyParameters(
    k_point_sampling=(40, 1, 2),
    )

DFTD2LCAO = extendedCalculatorWithDFTD2(LCAOCalculator)
calculator = DFTD2LCAO(
    basis_set=basis_set,
    exchange_correlation=exchange_correlation,
    numerical_accuracy_parameters=numerical_accuracy_parameters,
    )

bulk_configuration.setCalculator(calculator)
nlprint(bulk_configuration)
bulk_configuration.update()
nlsave('analysis.nc', bulk_configuration)

# -------------------------------------------------------------
# Density of states
# -------------------------------------------------------------
density_of_states = DensityOfStates(
    configuration=bulk_configuration,
    kpoints=MonkhorstPackGrid(40,4,1),
    energy_zero_parameter=FermiLevel,
    bands_above_fermi_level=None,
    )
nlsave('analysis.nc', density_of_states)
nlprint(density_of_states)
Title: Re: Grimme's DFT-D2 semi-empirical model for van der Waals interactions
Post by: Anders Blom on April 21, 2014, 23:34
Why would you expect there to be a difference?