-
Notifications
You must be signed in to change notification settings - Fork 23
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
Molecules in high pressure environments #467
Draft
hugoastrom
wants to merge
8
commits into
MRChemSoft:master
Choose a base branch
from
hugoastrom:confinement
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c4aa7d0
Add Confinement class
791d136
Add input file keywords and section
e85a07e
confinement potential -> confinement_operator in fock_builder
1fe3b5e
changes
hugoastrom 28b5d52
edits
hugoastrom a216ca9
Test to implement cavity
hugoastrom 078d07b
Fix indentation in driver
hugoastrom 9f36818
Edits to the confinement function
hugoastrom File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include "ConfinementFunction.h" | ||
#include "environment/Cavity.h" | ||
#include "utils/math_utils.h" | ||
|
||
namespace mrchem { | ||
|
||
ConfinementFunction::ConfinementFunction(double r_0, const int N, double s, std::vector<double> R, std::vector<mrcpp::Coord<3>> centers) | ||
: radius(r_0) | ||
, slope(s) | ||
, stiffness(N) | ||
, cavity_radii(R) | ||
, centers(centers) {} | ||
|
||
double ConfinementFunction::evalf(const mrcpp::Coord<3> &r) const { | ||
double f = 0.0; | ||
|
||
const int N = this->stiffness; | ||
auto r_0 = this->radius; | ||
auto s = this->slope; | ||
auto R = this->cavity_radii; | ||
auto coords = this->centers; | ||
|
||
Cavity sphere(coords, R, s); | ||
|
||
//double min_dist = 1000.0; | ||
//double &rad = min_dist; | ||
//for (auto& center : coords) { | ||
// double distance = math_utils::calc_distance(r, center); | ||
// if (distance < min_dist) { | ||
//rad = distance; | ||
// } | ||
//} | ||
|
||
//f += std::pow(min_dist / r_0, N); | ||
mrcpp::Coord<3> origin = {0.0, 0.0, 0.0}; | ||
f += std::pow(math_utils::calc_distance(origin, r) / r_0, N); | ||
f *= (1 - sphere.evalf(r)); | ||
|
||
return f; | ||
} | ||
|
||
} // namespace mrchem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#pragma once | ||
|
||
#include <MRCPP/MWFunctions> | ||
|
||
namespace mrchem { | ||
|
||
class ConfinementFunction : public mrcpp::RepresentableFunction<3> { | ||
public: | ||
ConfinementFunction(double r_0, const int N, double slope, std::vector<double> R, std::vector<mrcpp::Coord<3>> centers); | ||
|
||
auto getRadius() { return this->radius; } | ||
auto getStiffness() { return this->stiffness; } | ||
auto getSlope() { return this->slope; } | ||
auto getCavityradii() { return this->cavity_radii; } | ||
auto getCenters() { return this->centers; } | ||
|
||
protected: | ||
|
||
double radius; // | ||
const int stiffness; // stffness parameter | ||
double slope; // cavity boundary slope | ||
std::vector<double> cavity_radii; | ||
std::vector<mrcpp::Coord<3>> centers; | ||
|
||
double evalf(const mrcpp::Coord<3> &r) const override; | ||
|
||
}; | ||
|
||
} // namespace mrchem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
target_sources(mrchem PRIVATE | ||
${CMAKE_CURRENT_SOURCE_DIR}/NuclearOperator.cpp | ||
${CMAKE_CURRENT_SOURCE_DIR}/ZoraOperator.cpp | ||
${CMAKE_CURRENT_SOURCE_DIR}/ConfinementPotential.cpp | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#pragma once | ||
|
||
#include "tensor/RankZeroOperator.h" | ||
#include "ConfinementPotential.h" | ||
#include "chemistry/Molecule.h" | ||
|
||
/** @class ConfinementOperator | ||
* | ||
* @brief Operator containing a ConfinementPotential | ||
* | ||
* A TensorOperator realization of @class ConfinementPotential. | ||
* | ||
*/ | ||
|
||
namespace mrchem { | ||
|
||
class ConfinementOperator final : public RankZeroOperator { | ||
public: | ||
ConfinementOperator(double r_0, const int N, double s, std::vector<double> R, std::vector<mrcpp::Coord<3>> centers) { | ||
potential = std::make_shared<ConfinementPotential>(r_0, N, s, R, centers); | ||
|
||
// Invoke operator= to assign *this operator | ||
RankZeroOperator &Co = (*this); | ||
Co = potential; | ||
Co.name() = "Co"; | ||
} | ||
~ConfinementOperator() override = default; | ||
|
||
auto getRadius() { return this->potential->getRadius(); } | ||
auto getStiffness() { return this->potential->getStiffness(); } | ||
|
||
private: | ||
std::shared_ptr<ConfinementPotential> potential{nullptr}; | ||
}; | ||
|
||
} // namespace mrchem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#include "ConfinementPotential.h" | ||
#include "analyticfunctions/ConfinementFunction.h" | ||
|
||
#include "utils/math_utils.h" | ||
#include "chemistry/Molecule.h" | ||
|
||
namespace mrchem { | ||
|
||
ConfinementPotential::ConfinementPotential(double r_0, const int N, double s, std::vector<double> R, std::vector<mrcpp::Coord<3>> coords) | ||
: QMPotential(1, false) | ||
, radius(r_0) | ||
, stiffness(N) | ||
, slope(s) | ||
, cavity_radii(R) | ||
, centers(coords) {} | ||
|
||
|
||
void ConfinementPotential::setup(double prec) { | ||
// Initalize the function representing the confinement | ||
ConfinementFunction *f_loc = nullptr; | ||
|
||
f_loc = new ConfinementFunction(this->getRadius(), this->getStiffness(), this->getSlope(), this->getCavityradii(), this->getCenters()); | ||
|
||
// Project the potential onto the function representation | ||
mrcpp::ComplexFunction V_loc(false); | ||
mrcpp::cplxfunc::project(V_loc, *f_loc, NUMBER::Real, prec); | ||
|
||
mrcpp::ComplexFunction &V_c = (*this); | ||
setApplyPrec(prec); | ||
V_c = V_loc; | ||
delete f_loc; | ||
|
||
} | ||
|
||
void ConfinementPotential::clear() { | ||
mrcpp::ComplexFunction::free(NUMBER::Total); | ||
clearApplyPrec(); | ||
} | ||
|
||
|
||
} // namespace mrchem |
Oops, something went wrong.
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.
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.
Seems you have some indentation issues which should be fixed