votca 2024.2-dev
Loading...
Searching...
No Matches
apdft.cc
Go to the documentation of this file.
1/*
2 * Copyright 2009-2020 The VOTCA Development Team (http://www.votca.org)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17
18// Standard includes
19#include <iomanip>
20
21// Local VOTCA includes
23#include "votca/xtp/orbitals.h"
24#include "votca/xtp/vxc_grid.h"
25
26// Local private VOTCA includes
27#include "apdft.h"
28
29namespace votca {
30namespace xtp {
31
33
34 grid_accuracy_ = options.get(".grid").as<std::string>();
35 orbfile_ = options.ifExistsReturnElseReturnDefault<std::string>(
36 ".input", job_name_ + ".orb");
37 outputfile_ = options.ifExistsReturnElseReturnDefault<std::string>(
38 ".output", job_name_ + "_state.dat");
39 state_ = options.get(".state").as<QMState>();
40}
41
42bool APDFT::Run() {
43
44 Orbitals orb;
46 AOBasis basis = orb.getDftBasis();
47 Vxc_Grid grid;
48 grid.GridSetup(grid_accuracy_, orb.QMAtoms(), basis);
49
50 DensityIntegration<Vxc_Grid> integration(grid);
51
53 std::vector<double> potential_values;
54 potential_values.reserve(orb.QMAtoms().size());
55 for (const auto &atom : orb.QMAtoms()) {
56 potential_values.push_back(integration.IntegratePotential(atom.getPos()));
57 }
58
59 std::fstream outfile;
60 outfile.open(outputfile_, std::fstream::out);
61 outfile << "AtomId, Element, Potential[Hartree]" << std::endl;
62 for (Index i = 0; i < orb.QMAtoms().size(); i++) {
63 outfile << orb.QMAtoms()[i].getId() << " " << orb.QMAtoms()[i].getElement()
64 << " " << std::setprecision(14) << potential_values[i] << std::endl;
65 }
66 outfile.close();
67 return true;
68}
69
70} // namespace xtp
71} // namespace votca
class to manage program options with xml serialization functionality
Definition property.h:55
Property & get(const std::string &key)
get existing property
Definition property.cc:79
T as() const
return value as type
Definition property.h:283
T ifExistsReturnElseReturnDefault(const std::string &key, T defaultvalue) const
Definition property.h:321
Container to hold Basisfunctions for all atoms.
Definition aobasis.h:42
std::string grid_accuracy_
Definition apdft.h:43
std::string outputfile_
Definition apdft.h:46
std::string orbfile_
Definition apdft.h:44
void ParseOptions(const tools::Property &user_options)
Definition apdft.cc:32
QMState state_
Definition apdft.h:45
double IntegratePotential(const Eigen::Vector3d &rvector) const
double IntegrateDensity(const Eigen::MatrixXd &density_matrix)
container for molecular orbitals
Definition orbitals.h:46
Eigen::MatrixXd DensityMatrixFull(const QMState &state) const
Definition orbitals.cc:140
const QMMolecule & QMAtoms() const
Definition orbitals.h:172
void ReadFromCpt(const std::string &filename)
Definition orbitals.cc:692
const AOBasis & getDftBasis() const
Definition orbitals.h:208
Identifier for QMstates. Strings like S1 are converted into enum +zero indexed int.
Definition qmstate.h:132
std::string job_name_
Definition qmtool.h:50
void GridSetup(const std::string &type, const QMMolecule &atoms, const AOBasis &basis)
Definition vxc_grid.cc:229
base class for all analysis tools
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26