Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DFTB+ interface upgrade #179

Merged
merged 12 commits into from
Nov 5, 2024
Merged

DFTB+ interface upgrade #179

merged 12 commits into from
Nov 5, 2024

Conversation

danielhollas
Copy link
Contributor

No description provided.

Copy link

codecov bot commented May 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.86%. Comparing base (7ab1dd6) to head (2fff83e).
Report is 1 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #179   +/-   ##
=======================================
  Coverage   91.86%   91.86%           
=======================================
  Files          47       47           
  Lines        6748     6748           
  Branches      758      758           
=======================================
  Hits         6199     6199           
  Misses        537      537           
  Partials       12       12           
Flag Coverage Δ
unittests 20.41% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@danielhollas danielhollas force-pushed the dftb-interface-cleanup branch from d47720a to 59a915b Compare May 17, 2024 16:45
@danielhollas danielhollas force-pushed the dftb-interface-cleanup branch from 59a915b to 984c710 Compare May 17, 2024 16:53
@danielhollas danielhollas marked this pull request as ready for review May 17, 2024 21:56
@danielhollas danielhollas changed the title WIP: DFTB+ interface upgrade DFTB+ interface upgrade May 17, 2024
Copy link
Contributor

@juraskov juraskov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not tested the code on my machine. I added general comments, mainly on what to do when people do not work on clusters with the same env as in Prague. Also, might be worth adding a README file for DFTB or at least add somewhere link for documentation and for different parameters.

charge = 0.0
#ReadInitialCharges = yes
SlaterKosterFiles = Type2FileNames {
Prefix = "/home/hollas/3ob-2-1/"
Prefix = "/home/hollas/3ob-3-1/"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably add something general with a comment for users, instead of hollas home which will not be present on most clusters.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this and added a note at the top of r.dftb that this file needs to be modified.

input=input$ibead
geom=../geom.dat.$ibead
if [[ -f ../SetEnvironment.sh ]]; then
# This is specific to Prague clusters
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What should people do if they do not use the Prague clusters? Remove SetEnvironment or change it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If they are not on Prague clusters this file will simply not exist.

# This is specific to Prague clusters
source ../SetEnvironment.sh DFTB
else
# We assume dftb+ is in PATH already
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some test would be better instead of assumption.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opted not to add a check for this, since if it is not in the PATH we will fail to execute anyway, and the default unix error message should be clear enough. I did add a note about this at the top of the file though.

interfaces/DFTB/r.dftb Show resolved Hide resolved
@danielhollas
Copy link
Contributor Author

Also, might be worth adding a README file for DFTB or at least add somewhere link for documentation and for different parameters.

I expanded the comment at the top of the r.dftb file and included a link to the dftb+ website.

geom=../geom.dat."$ibead"
natom=$(wc -l < "$geom")

function prepare_dftb_inputs() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created two new functions, generate_dftb_inputs and extract_energy_and_gradients, hopefully this makes the high-level flow of the script easier to follow. Happy to hear suggestions how to make this even better.

@danielhollas
Copy link
Contributor Author

I've tested the refactored interface locally with DFTB+ 24.1 by checking the energy conservation in a short NVE simulation of a single water molecule

input.in

  &nhcopt    
  inose=0,»       »       ! Thermostating: Nose-Hoover 1, microcanonical 0,GLE 2, LE 3    
  temp=298.15,»   »       ! initial temperature for Maxwell-Boltzmann sampling [au]    
  /    
      
  &general    
  nstep=1000,    
  irest=0,    
  pot='dftb'    
  mdtype='MD',    
      
  dt=20., »       ! number of steps and timestep    
      
  nwrite=1,    
  nwritex=1,    
  nrest=1,    
  /

So this is now ready for review again.

@danielhollas danielhollas requested a review from juraskov October 15, 2024 14:00
Copy link
Contributor

@juraskov juraskov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My questions were answered and the new implemented functions look good!

@danielhollas danielhollas merged commit 3c61708 into master Nov 5, 2024
18 checks passed
@danielhollas danielhollas deleted the dftb-interface-cleanup branch November 5, 2024 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants