-
Notifications
You must be signed in to change notification settings - Fork 143
Refactor: move functions with libxc in class XC_Functional
to namespace XC_Functional_Libxc
#5064
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
Conversation
…ce XC_Functional_Libxc
const double &rhoup, const double &rhodw, | ||
double &exc, double &vxcup, double &vxcdw) | ||
{ | ||
double e, vup, vdw; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
initialize the variables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
double *rho_ud, *vxc_ud; | ||
exc = vxcup = vxcdw = 0.0; | ||
|
||
rho_ud = new double[2]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will it be possible to use std::vector instead of new and delete?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
grho[1] = gdr1 * gdr2; | ||
grho[2] = gdr2.norm2(); | ||
|
||
const double rho_threshold = 1E-6; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what are the reasons to choose these thresholds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know. It's just moved from the old files.
#include <tuple> | ||
#include <vector> | ||
|
||
class Charge; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is just a declaration to avoid the "error: unknown type name 'Charge'" error when compiling, as the following functions in this file need this as a parameter type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the function parameter which is just a pointer Charge*
or a reference Charge&
, it's better to write class Charge
before the function instead of #include "charge.h"
in the header files.
@mohanchen points out some problems in the previous code. This PR writes nothing new but moves them to new files. |
Fixed. |
if(func.info->kind==XC_CORRELATION) | ||
{ | ||
if ( rho[0]<rho_threshold || sqrt(std::abs(grho[0]))<grho_threshold ) | ||
sgn[0] = 0.0; | ||
if ( rho[1]<rho_threshold || sqrt(std::abs(grho[2]))<grho_threshold ) | ||
sgn[1] = 0.0; | ||
} | ||
|
||
double s = 0.0; | ||
std::vector<double> v1xc(2), v2xc(3), v3xc(2), lapl(2), vlapl(2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest not use std::vector or new/delete for these variables which should be allocated on stack memory!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
No description provided.