Skip to content

Commit

Permalink
output gradient to scf.json
Browse files Browse the repository at this point in the history
  • Loading branch information
ahurta92 committed Jul 1, 2024
1 parent 951da99 commit a15f76c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/madness/chem/SCF.cc
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@ void scf_data::print_data() {
for (const auto &[key, value]: e_data) { print(key, " : ", value); }
}

void scf_data::add_gradient(const Tensor<double> &grad) {
gradient = tensor_to_json(grad);
}


// SCF::SCF(World & world, const char *filename) : SCF(world, (world.rank() == 0 ? std::make_shared<std::ifstream>(filename) : nullptr)){
// }
Expand Down Expand Up @@ -1452,6 +1456,7 @@ tensorT SCF::derivatives(World& world, const functionT& rho) const {
r[i * 3 + 2]);
}
}
e_data.add_gradient(r);
return r;
}

Expand Down
4 changes: 4 additions & 0 deletions src/madness/chem/SCF.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ class MomentFunctor : public FunctionFunctorInterface<double, 3> {
class scf_data {

std::map<std::string, std::vector<double>> e_data;
json gradient;
json hessian;
int iter;
public:

Expand All @@ -181,6 +183,8 @@ class MomentFunctor : public FunctionFunctorInterface<double, 3> {
void print_data();

void add_data(std::map<std::string, double> values);

void add_gradient(const Tensor<double> &grad);
};


Expand Down

0 comments on commit a15f76c

Please sign in to comment.