[DFTB-Plus-User] Atomic Forces at every step and Potential Energy

Bálint Aradi aradi at uni-bremen.de
Tue Jun 14 15:57:35 CEST 2022


Dear Oreoluwa,

Probably you compiled the wrong version of the code. Follow these steps 
to get the right version:

git clone https://github.com/aradi/dftbplus
cd dftbplus
git checkout mdForces

When I compile this version with the usual steps:

mkdir _build
cd _build
FC=gfortran CC=gcc cmake ..
make -j

I obtain a dftb+ version, which, when run for the md/H3 test case (in 
test/app/dftb+/md/H3), produces an md.out file with the forces in it:

MD step: 0
Potential Energy:                   -0.5445941169 H          -14.8192 eV
MD Kinetic Energy:                   0.0025950468 H            0.0706 eV
Total MD Energy:                    -0.5419990701 H          -14.7485 eV
MD Temperature:                      0.0008650156 au         273.1500 K
Force on atom #1 [au]:  -7.1970518908E-02  -1.5781891282E-01 
-0.0000000000E+00
Force on atom #2 [au]:   1.9782104650E-02  -4.1916247087E-04 
-0.0000000000E+00
Force on atom #3 [au]:   5.2188414259E-02   1.5823807530E-01 
-0.0000000000E+00
MD step: 1
Potential Energy:                   -0.5458348287 H          -14.8529 eV
MD Kinetic Energy:                   0.0038315383 H            0.1043 eV
Total MD Energy:                    -0.5420032904 H          -14.7487 eV
MD Temperature:                      0.0012771794 au         403.3009 K
Force on atom #1 [au]:  -6.8858940425E-02  -1.5332931548E-01 
-8.0921107091E-04
Force on atom #2 [au]:   1.7544677250E-02   3.8327724362E-04 
6.2354663951E-05
Force on atom #3 [au]:   5.1314263174E-02   1.5294603824E-01 
7.4685640696E-04
...

Best regards,

Bálint


On 06.06.22 17:22, Oreoluwa Adesina wrote:
> Hello Dr. Bálint,
> 
> We compiled and ran the DFTB+ version that you recommended I use. 
> Unfortunately, I think we are doing something wrong because we still do 
> not get the forces output at every time step. We have looked at all the 
> output files, and they do not differ from calculations performed with 
> the previously compiled version. Which output file should we expect to 
> see the forces at every step printed to?
> 
> A colleague and I further tried to modify the DFTB+ source code 
> ourselves, but were not successful in extracting the forces at the 
> desired times. We are wondering if there are certain part(s) of the code 
> that should be modified beyond what we tried.
> 
> Roughly, we tried finding what function prints the detailed output file 
> at the very end of the run (specifically these were the functions named 
> writeDetailedOut4 and writeDetailedOut5, more specifics in the examples 
> below and the code snippet attached for examples 1 and 2) and instead 
> have that run at every time step (examples 1 and 2), this did not work. 
> We attempted calling the function directly and creating a helper 
> function to set up some defaults and call the function (example 1). 
> Neither of these solutions worked, and with our lack of knowledge of 
> Fortran and the many lines of code in this program, we could not think 
> of what else to do. Attached is a modified version of the “main loop” 
> that was edited, for further clarification of what was worked on.
> 
> Specific Examples of Code Changes:
> 
> 1. Dftbplus/Main.F90 - line 453: creating a subroutine 
> everyDetailedOut4() that inside calls the subroutine writeDetailedOut4 
> and then calling this subroutine at line 193 inside of the 'main 
> geometry loop' I am unsure if this was even the correct track but it was 
> a start.
> 
> 2. Dftbplus/Main.F90 - line 193, call writeDetailedOut4 in this loop 
> every iteration to attempt to get the forces to keep printing every 
> step, but this did not work either.
> 
>                  3. Dftbplus/initprogram.F90 - line 811, setting this 
> logical value to                             true, so every time the 
> main geometry loop hits here, it should flag    as true and write 
> detailed output.
> 
> If you have any other code suggestions, please let us know.
> 
> Do you have any suggestions on what to do? Or do you have an idea as to 
> what we are doing wrong?
> 
> Thank you.
> 
> --
> 
> Oreoluwa Adesina.
> 
> *From: *DFTB-Plus-User 
> <dftb-plus-user-bounces at mailman.zfn.uni-bremen.de> on behalf of Bálint 
> Aradi <aradi at uni-bremen.de>
> *Date: *Tuesday, February 8, 2022 at 7:09 AM
> *To: *dftb-plus-user at mailman.zfn.uni-bremen.de 
> <dftb-plus-user at mailman.zfn.uni-bremen.de>
> *Subject: *Re: [DFTB-Plus-User] Atomic Forces at every step and 
> Potential Energy
> 
> ◆This message was sent from a non-UWYO address. Please exercise caution 
> when clicking links or opening attachments from external sources.
> 
> 
> Dear Oreoluwa,
> 
> currently there is no option to print the forces during an MD, so you
> would have to re-run single point simulations for those images of the
> MD, for which the forces are interesting.
> 
> On the other hand, it is really trivial to implement the feature you ask
> for. I've created a branch (mdForces) in my personal DFTB+ fork:
> 
> https://github.com/aradi/dftbplus/tree/mdForces 
> <https://github.com/aradi/dftbplus/tree/mdForces>
> 
> which contains a version of DFTB+, where the forces are written in
> md.out at every step. Feel free to check it out, to compile the code and
> to test it. Let me know how it runs, we may add that as an official
> feature later, if it turns out to be useful.
> 
> Best regards,
> 
> Bálint
> 
> 
> 
> On 02.02.22 18:56, Oreoluwa Adesina wrote:
>> Hello,
>>
>> I am trying to calculate the forces per atom per iteration and potential
>> energy per atom per iteration during a molecular dynamics calculation in
>> dftb+.
>>
>> I have tried modifying the writing options, having set CalculateForces
>> to Yes under the Analysis block, but have not been able to export the
>> atom-resolved forces/energies at every step, or save the detailed.out at
>> every step.
>>
>> Is there a way to get the forces per atom per iteration and potential
>> energy per atom per iteration for an MD calculation? I am currently
>> using the VelocityVerlet driver.
>>
>> Thank you.
>>
>>>>
>> Kind regards,
>>
>> Oreoluwa Adesina.
>>
>> Graduate Student (https://de-sousa-oliveira.xyz/groupmembers/
>> <https://de-sousa-oliveira.xyz/groupmembers/ 
> <https://de-sousa-oliveira.xyz/groupmembers/>>)
>>
>>
>> _______________________________________________
>> DFTB-Plus-User mailing list
>> DFTB-Plus-User at mailman.zfn.uni-bremen.de
>> https://mailman.zfn.uni-bremen.de/cgi-bin/mailman/listinfo/dftb-plus-user <https://mailman.zfn.uni-bremen.de/cgi-bin/mailman/listinfo/dftb-plus-user>
> 
> 
> --
> Dr. Bálint Aradi
> Bremen Center for Computational Materials Science, University of Bremen
> http://www.bccms.uni-bremen.de/cms/people/b-aradi/ 
> <http://www.bccms.uni-bremen.de/cms/people/b-aradi/>
> 
> 
> _______________________________________________
> DFTB-Plus-User mailing list
> DFTB-Plus-User at mailman.zfn.uni-bremen.de
> https://mailman.zfn.uni-bremen.de/cgi-bin/mailman/listinfo/dftb-plus-user


-- 
Dr. Bálint Aradi
Bremen Center for Computational Materials Science, University of Bremen
http://www.bccms.uni-bremen.de/cms/people/b-aradi/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.zfn.uni-bremen.de/pipermail/dftb-plus-user/attachments/20220614/25a09465/attachment.sig>


More information about the DFTB-Plus-User mailing list