Skip to content

Commit

Permalink
fix the library example basis folder problem and rename constants
Browse files Browse the repository at this point in the history
  • Loading branch information
tjira committed Feb 12, 2024
1 parent f616dc5 commit 3de4807
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 12 deletions.
2 changes: 2 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# TODO List

- [ ] Add BAGEL interface with excited state dynamics
- [ ] Add Mulliken analysis
- [x] Add some tests
- [x] Add the ability to export the atomic integrals
- [x] Add the ability to use orca to perform ground state dynamics
Expand Down
3 changes: 3 additions & 0 deletions example/library/fci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ int main(int argc, char** argv) {
// get executable path for the executable to run from anywhere
auto path = std::filesystem::weakly_canonical(argv[0]).parent_path();

// set the basis folder path to the project root
setenv("LIBINT_DATA_PATH", path.parent_path().parent_path().c_str(), true);

// create the molecule stream
std::ifstream mstream(path / "../molecule/water.xyz");

Expand Down
3 changes: 3 additions & 0 deletions example/library/mp2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ int main(int argc, char** argv) {
// get executable path for the executable to run from anywhere
auto path = std::filesystem::weakly_canonical(argv[0]).parent_path();

// set the basis folder path to the project root
setenv("LIBINT_DATA_PATH", path.parent_path().parent_path().c_str(), true);

// create the molecule stream
std::ifstream mstream(path / "../molecule/water.xyz");

Expand Down
3 changes: 3 additions & 0 deletions example/library/rhf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ int main(int argc, char** argv) {
// get executable path for the executable to run from anywhere
auto path = std::filesystem::weakly_canonical(argv[0]).parent_path();

// set the basis folder path to the project root
setenv("LIBINT_DATA_PATH", path.parent_path().parent_path().c_str(), true);

// create the molecule stream
std::ifstream mstream(path / "../molecule/water.xyz");

Expand Down
3 changes: 3 additions & 0 deletions example/library/uhf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ int main(int argc, char** argv) {
// get executable path for the executable to run from anywhere
auto path = std::filesystem::weakly_canonical(argv[0]).parent_path();

// set the basis folder path to the project root
setenv("LIBINT_DATA_PATH", path.parent_path().parent_path().c_str(), true);

// create the molecule stream
std::ifstream mstream(path / "../molecule/water.xyz");

Expand Down
6 changes: 2 additions & 4 deletions include/constant.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

#include <iostream>

#define AMU 1822.888486192
#define AU2K 315774.67
#define A2BOHR 1.889726124626
#define AMU2AU 1822.888486192
#define AU2FS 0.02418884254
#define AU2K 315774.67
#define BOHR2A 0.529177210903
#define BOLTZMANN 3.166811429e-6
#define CFREQ 5140.486777894163
9 changes: 3 additions & 6 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ int main(int argc, char** argv) {
if (rmpopt.at("export").at("coulombmo")) EigenWrite(inputpath / "JMO.mat", ints.Jmo);
}

// run the calculation and print the new line
// run the calculation
res = rmp.run(system, ints, res);

// print the total energy
Expand Down Expand Up @@ -359,15 +359,12 @@ int main(int argc, char** argv) {
}
}

// if the exact calculation was requested
} else if (input.contains("model")) {
// create the model system
ModelSystem model(mdlopt.at("mass"), mdlopt.at("potential"), mdlopt.at("limits"), mdlopt.at("ngrid"));

// if the solving was requested
if (input.contains("solve")) {Printer::Title("EXACT QUANTUM DYNAMICS");

// create the adianatic solver object
// create the adiabatic solver object
ModelSolver msv(msaopt.get<ModelSolver::OptionsAdiabatic>());

// if nonadiabatic model was specified assign to the solver the nonadiabatic version
Expand All @@ -387,6 +384,6 @@ int main(int argc, char** argv) {
}
}

// finalize the integral engine and print the elapsed time
// print the elapsed time
std::stringstream ess; ess << "ELAPSED TIME: " << Timer::Format(Timer::Elapsed(programtimer)); Printer::Title(ess.str(), false);
}
7 changes: 5 additions & 2 deletions src/method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void Method<M>::dynamics(System system, Integrals ints, Result res, bool print)

// fill the mass matrix
for(size_t i = 0; i < system.getAtoms().size(); i++) {
m.row(i) = [](double m) {return Vector<>::Constant(3, m);}(an2m.at(system.getAtoms().at(i).atomic_number) * AMU);
m.row(i) = [](double m) {return Vector<>::Constant(3, m);}(an2m.at(system.getAtoms().at(i).atomic_number) * AMU2AU);
}

// get the degrees of freedom and write the initial geometry
Expand Down Expand Up @@ -82,9 +82,12 @@ Vector<> Method<M>::frequency(const System& system, const Matrix<>& H) {
MM(i, i) = std::sqrt(1 / an2m.at(system.getAtoms().at(i / 3).atomic_number));
}

// frequency conversion factor
constexpr double convert = 5140.486777894163;

// calculate the frequencies in atomic units, convert them, exract them and return
Eigen::EigenSolver<Matrix<>> solver(MM * H * MM); auto eval = solver.eigenvalues();
Vector<> freqs = (eval.cwiseSqrt() - eval.cwiseSqrt().imag()).real() * CFREQ;
Vector<> freqs = (eval.cwiseSqrt() - eval.cwiseSqrt().imag()).real() * convert;
std::sort(freqs.begin(), freqs.end(), std::greater<>()); return freqs;
}

Expand Down

0 comments on commit 3de4807

Please sign in to comment.