MPQC 3.0.0-alpha
Loading...
Searching...
No Matches
iter_logger.h
1//
2// iter_logger.h
3//
4// Copyright (C) 2014 David Hollman
5//
6// Author: David Hollman
7// Maintainer: DSH
8// Created: Jun 13, 2014
9//
10// This file is part of the SC Toolkit.
11//
12// The SC Toolkit is free software; you can redistribute it and/or modify
13// it under the terms of the GNU Library General Public License as published by
14// the Free Software Foundation; either version 2, or (at your option)
15// any later version.
16//
17// The SC Toolkit is distributed in the hope that it will be useful,
18// but WITHOUT ANY WARRANTY; without even the implied warranty of
19// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20// GNU Library General Public License for more details.
21//
22// You should have received a copy of the GNU Library General Public License
23// along with the SC Toolkit; see the file COPYING.LIB. If not, write to
24// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
25//
26// The U.S. Government is granted a limited license as per AL 91-7.
27//
28
29
30#ifndef _lib_chemistry_qc_scf_h
31#define _lib_chemistry_qc_scf_h
32
33#include <functional>
34#include <utility>
35#include <chemistry/qc/scf/scf.h>
36
37#include <util/misc/xml.h>
38
39namespace sc {
40
42
43class SCFIterationData;
44
46 public:
47
48 typedef std::function<void(boost::property_tree::ptree&, const XMLWriter&)> element_write_function;
49
50 private:
51
52 bool log_evals_;
53 bool log_density_;
54 bool log_coeffs_;
55
56 std::vector<element_write_function> other_details_;
57 std::vector<std::vector<element_write_function>> other_iter_details_;
58
59 std::vector<SCFIterationData> iterations_;
60
61 public:
62
63 SCFIterationLogger(const Ref<KeyVal>& keyval);
64
65 boost::property_tree::ptree& write_xml(boost::property_tree::ptree& parent, const XMLWriter& writer);
66
67 // TODO handle alpha and beta for evals and density
68
69 void new_iteration();
70
71 void log_density(RefSymmSCMatrix density, SpinCase1 spin_case=AnySpinCase1);
72
73 void log_evals(RefDiagSCMatrix evals, SpinCase1 spin_case=AnySpinCase1);
74
75 void log_coeffs(RefSCMatrix evals, SpinCase1 spin_case=AnySpinCase1);
76
77 bool log_coeffs_enabled(){ return log_coeffs_; }
78
79 template <typename Func, typename... Args>
80 void log_global_misc(Func&& func, Args&&... args) {
81 other_details_.emplace_back(std::bind(
82 func, std::placeholders::_1, std::placeholders::_2, std::forward<Args>(args)...
83 ));
84 }
85
86 template <typename Func, typename... Args>
87 void log_iter_misc(Func&& func, Args&&... args) {
88 other_iter_details_.back().emplace_back(std::bind(
89 func, std::placeholders::_1, std::placeholders::_2, std::forward<Args>(args)...
90 ));
91 }
92
93};
94
96
98
99 public:
100
101 SCFIterationLogger* parent;
102 int number;
103 RefDiagSCMatrix evals = 0;
104 RefDiagSCMatrix alpha_evals = 0;
105 RefDiagSCMatrix beta_evals = 0;
106 RefSymmSCMatrix density = 0;
107 RefSymmSCMatrix alpha_density = 0;
108 RefSymmSCMatrix beta_density = 0;
109 RefSCMatrix coeffs = 0;
110 RefSCMatrix alpha_coeffs = 0;
111 RefSCMatrix beta_coeffs = 0;
112
113
114 boost::property_tree::ptree& write_xml(boost::property_tree::ptree& parent, const XMLWriter& writer);
115
116};
117
118
119}
120
121
122#endif /* _lib_chemistry_qc_scf_h */
Classes which need runtime information about themselves and their relationship to other classes can v...
Definition class.h:233
The RefDiagSCMatrix class is a smart pointer to an DiagSCMatrix specialization.
Definition matrix.h:389
The RefSCMatrix class is a smart pointer to an SCMatrix specialization.
Definition matrix.h:135
The RefSymmSCMatrix class is a smart pointer to an SCSymmSCMatrix specialization.
Definition matrix.h:265
A template class that maintains references counts.
Definition ref.h:361
Definition iter_logger.h:97
Definition iter_logger.h:45
Definition xml.h:44
Definition xmlwriter.h:223
Contains all MPQC code up to version 3.
Definition mpqcin.h:14

Generated at Wed Sep 25 2024 02:45:30 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.12.0.