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

Refactor: move functions with libxc in class XC_Functional to namespace XC_Functional_Libxc #5064

Closed
wants to merge 10 commits into from

Conversation

PeizeLin
Copy link
Collaborator

@PeizeLin PeizeLin commented Sep 8, 2024

No description provided.

const double &rhoup, const double &rhodw,
double &exc, double &vxcup, double &vxcdw)
{
double e, vup, vdw;
Copy link
Collaborator

Choose a reason for hiding this comment

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

initialize the variables

Copy link
Collaborator Author

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];
Copy link
Collaborator

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?

Copy link
Collaborator Author

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;
Copy link
Collaborator

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?

Copy link
Collaborator Author

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;
Copy link
Collaborator

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?

Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

@maki49
Copy link
Collaborator

maki49 commented Sep 8, 2024

@mohanchen points out some problems in the previous code. This PR writes nothing new but moves them to new files.
However, there are some compile errors when building with -DENABLE_LIBRI=ON.

@PeizeLin
Copy link
Collaborator Author

PeizeLin commented Sep 9, 2024

@mohanchen points out some problems in the previous code. This PR writes nothing new but moves them to new files. However, there are some compile errors when building with -DENABLE_LIBRI=ON.

Fixed.

@PeizeLin PeizeLin force-pushed the refactor_libxc branch 6 times, most recently from efb888b to f80f5a8 Compare September 10, 2024 07:01
@PeizeLin PeizeLin force-pushed the refactor_libxc branch 2 times, most recently from 549180d to 2d49c3d Compare September 12, 2024 15:56
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);
Copy link
Collaborator

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!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated

@PeizeLin PeizeLin force-pushed the refactor_libxc branch 2 times, most recently from 550839b to 31cdc4c Compare September 20, 2024 14:13
@PeizeLin PeizeLin closed this by deleting the head repository Sep 20, 2024
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.

4 participants