| 1 |
/****************************************************************************** |
| 2 |
This source file is part of the Avogadro project. |
| 3 |
This source code is released under the 3-Clause BSD License, (see "LICENSE"). |
| 4 |
******************************************************************************/ |
| 5 |
|
| 6 |
#ifndef AVOGADRO_QUANTUMIO_NWCHEMLOG_H |
| 7 |
#define AVOGADRO_QUANTUMIO_NWCHEMLOG_H |
| 8 |
|
| 9 |
#include "avogadroquantumioexport.h" |
| 10 |
#include <avogadro/core/array.h> |
| 11 |
#include <avogadro/core/gaussianset.h> |
| 12 |
#include <avogadro/io/fileformat.h> |
| 13 |
|
| 14 |
#include <vector> |
| 15 |
|
| 16 |
namespace Avogadro { |
| 17 |
namespace QuantumIO { |
| 18 |
|
| 19 |
class AVOGADROQUANTUMIO_EXPORT NWChemLog : public Io::FileFormat |
| 20 |
{ |
| 21 |
public: |
| 22 |
NWChemLog(); |
| 23 |
~NWChemLog() override; |
| 24 |
void outputAll(); |
| 25 |
|
| 26 |
Operations supportedOperations() const override |
| 27 |
{ |
| 28 |
return Read | File | Stream | String; |
| 29 |
} |
| 30 |
|
| 31 |
FileFormat* newInstance() const override { return new NWChemLog; } |
| 32 |
std::string identifier() const override { return "Avogadro: NWChem"; } |
| 33 |
std::string name() const override { return "NWChem Log"; } |
| 34 |
std::string description() const override { return "NWChem log file format."; } |
| 35 |
|
| 36 |
std::string specificationUrl() const override { return ""; } |
| 37 |
|
| 38 |
std::vector<std::string> fileExtensions() const override; |
| 39 |
std::vector<std::string> mimeTypes() const override; |
| 40 |
|
| 41 |
[[nodiscard]] bool read(std::istream& in, Core::Molecule& molecule) override; |
| 42 |
[[nodiscard]] bool write(std::ostream&, const Core::Molecule&) override |
| 43 |
{ |
| 44 |
// Empty, as we do not write out NWChem log files. |
| 45 |
return false; |
| 46 |
} |
| 47 |
|
| 48 |
private: |
| 49 |
void processLine(std::istream& in, Core::Molecule& mol); |
| 50 |
|
| 51 |
// Read the atoms, and their geometry. |
| 52 |
void readAtoms(std::istream& in, Core::Molecule& mol); |
| 53 |
|
| 54 |
// Read the projected frequencies. |
| 55 |
void readFrequencies(const std::string& line, std::istream& in, |
| 56 |
Core::Molecule& mol); |
| 57 |
|
| 58 |
// Read the projected frequency intensities. |
| 59 |
void readIntensities(std::istream& in, Core::Molecule& mol); |
| 60 |
|
| 61 |
// Read unit cell information |
| 62 |
void readLattice(std::istream& in, Core::Molecule& mol, double factor = 1.0); |
| 63 |
|
| 64 |
Real m_coordinateScale = 1.0; |
| 65 |
|
| 66 |
Core::Array<double> m_frequencies; |
| 67 |
Core::Array<double> m_intensities; |
| 68 |
Core::Array<Core::Array<Vector3>> m_Lx; |
| 69 |
}; |
| 70 |
|
| 71 |
} // End namespace QuantumIO |
| 72 |
} // End namespace Avogadro |
| 73 |
|
| 74 |
#endif |