Refactor implicit solvation model #6836
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is the refactoring part of the previous PR #6832 (comment).
Now, it seems that the efficiency of the surchem module has been improved by approximately 100%, which likely comes from reducing the creation/deletion of large matrices. As discussed in #6832 (comment), I deleted the local functions and used the unified interface XC_Functional::grad_rho. Redundant variables are also removed.
I merely tested two examples, and they are attached here for validation:
One is the optimization of ethanol in water, namely the example in #6794, where the time for cal_vel decreased from 1607.60s to 772.56s. The other one is the scf calculation of a Ag slab with cooh (adapted from http://bbs.keinsci.com/thread-57694-1-1.html), where the time for cal_vel decreased from 749.44s to 375.28s.
test.zip
Reminder
Linked Issue
Fix #...
Unit Tests and/or Case Tests for my changes
What's changed?
Any changes of core modules? (ignore if not applicable)