MADNESS 0.10.1
NWChem.h
Go to the documentation of this file.
1/* This file is a part of Slymer, which is distributed under the Creative
2 Commons Attribution-NonCommercial 4.0 International Public License.
3
4 (c) 2017 Stony Brook University. */
5
6/**
7 * \file ESInterface/NWChem.h
8 * \brief API and helper routines for interfacing with NWChem.
9 */
10
11#ifndef __ESInterface_NWChem_h__
12#define __ESInterface_NWChem_h__
13
14#include <iostream>
15#include <memory>
18
19namespace slymer {
20
21/// Class for interfacing with NWChem (tested on version 6.6).
23protected:
24 /// The base file name of the NWChem output.
25 std::string my_fname;
26
27 /// Storage for the actual basis functions.
28 std::vector<std::unique_ptr<GaussianFunction>> gaussians;
29
30public:
31 NWChem_Interface() = delete;
32
33 /// Publically-accessible version of the file name.
34 const std::string &fname;
35
36 /**
37 * \brief Wrap the output of a NWChem computation.
38 *
39 * The parameter is the base file name (potentially including path) for the
40 * NWChem output files. For example, the NWChem log file will be fname.out,
41 * the molecular orbitals file will be fname.movecs, etc.
42 *
43 * \param[in] fname_ Base file name for the NWChem computation.
44 * \param[in,out] err_ Output stream for error or warning messages.
45 */
46 NWChem_Interface(const std::string &fname_, std::ostream &err_)
47 : ES_Interface(err_), my_fname(fname_), gaussians(0), fname(my_fname) {}
48
49 /**
50 * \brief Changes the base file name.
51 *
52 * \param[in] fname_ The new base file name for the NWChem computation.
53 */
54 void reset(const std::string &fname_) {
56 my_fname = fname_;
57 gaussians.clear();
58 }
59
60 /**
61 * \brief Read the specified properties and store them in the member variables.
62 *
63 * \throw std::invalid_argument if the NWChem logfile (fname.out) cannot be
64 * opened.
65 * \throw std::runtime_error if there is an error reading the NWChem output
66 * file.
67 *
68 * \param[in] props The properties to be read, using a bit flag combination.
69 */
70 virtual void read(Properties::Properties props) override;
71
72protected:
73 /**
74 * \brief Extract and store the atom types and positions.
75 *
76 * \param[in,out] in The stream containing the NWChem output file.
77 */
78 void read_atoms(std::istream &in);
79
80 /**
81 * \brief Extract and store the basis set.
82 *
83 * \todo Reading Cartesian-type d and f shells has not been tested.
84 * \note Only shells of type s, p, d, f, g and h are implemented.
85 *
86 * \param[in,out] in The stream containing the NWChem output file.
87 */
88 void read_basis_set(std::istream &in);
89
90 /**
91 * \brief Read the NWChem movecs file containing occupation numbers,
92 * MO energies, and MO coefficients.
93 *
94 * \param[in] props Properties to store from the read (from the list above).
95 * \param[in,out] in The stream for the NWChem output movecs file.
96 */
97 void read_movecs(const Properties::Properties props, std::istream &in);
98};
99
100} // namespace slymer
101
102#endif
Abstract base class for interfacing with electronic structure codes.
Definition ESInterface.h:56
void reset()
Reset the interface.
Definition ESInterface.h:131
Class for interfacing with NWChem (tested on version 6.6).
Definition NWChem.h:22
std::string my_fname
The base file name of the NWChem output.
Definition NWChem.h:25
std::vector< std::unique_ptr< GaussianFunction > > gaussians
Storage for the actual basis functions.
Definition NWChem.h:28
void reset(const std::string &fname_)
Changes the base file name.
Definition NWChem.h:54
NWChem_Interface(const std::string &fname_, std::ostream &err_)
Wrap the output of a NWChem computation.
Definition NWChem.h:46
void read_movecs(const Properties::Properties props, std::istream &in)
Read the NWChem movecs file containing occupation numbers, MO energies, and MO coefficients.
Definition NWChem.cc:808
void read_basis_set(std::istream &in)
Extract and store the basis set.
Definition NWChem.cc:173
virtual void read(Properties::Properties props) override
Read the specified properties and store them in the member variables.
Definition NWChem.cc:26
void read_atoms(std::istream &in)
Extract and store the atom types and positions.
Definition NWChem.cc:81
const std::string & fname
Publically-accessible version of the file name.
Definition NWChem.h:34
std::bitset< 5 > Properties
Different properties that can be read from electronic structure codes.
Definition ESInterface.h:45
Definition basis.h:22