| 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_CALC_DEFAULTMODEL_H |
| 7 |
#define AVOGADRO_CALC_DEFAULTMODEL_H |
| 8 |
|
| 9 |
#include "avogadrocalcexport.h" |
| 10 |
|
| 11 |
#include <avogadro/calc/chargemodel.h> |
| 12 |
|
| 13 |
namespace Avogadro { |
| 14 |
|
| 15 |
namespace Core { |
| 16 |
class Molecule; |
| 17 |
} |
| 18 |
|
| 19 |
namespace Calc { |
| 20 |
|
| 21 |
/** |
| 22 |
* @class DefaultModel defaultmodel.h <avogadro/calc/defaultmodel.h> |
| 23 |
* @brief Default charge model for file-provided atomic charges |
| 24 |
* @author Geoffrey R. Hutchison |
| 25 |
* |
| 26 |
* This is a default model for using atomic partial charges from a |
| 27 |
* file (e.g., quantum chemistry packages often provide Mulliken charges) |
| 28 |
* |
| 29 |
* The class |
| 30 |
*/ |
| 31 |
|
| 32 |
class AVOGADROCALC_EXPORT DefaultModel : public ChargeModel |
| 33 |
{ |
| 34 |
public: |
| 35 |
DefaultModel(const std::string& identifier = ""); |
| 36 |
~DefaultModel() override = default; |
| 37 |
|
| 38 |
/** |
| 39 |
* Create a new instance of the file format class. Ownership passes to the |
| 40 |
* caller. |
| 41 |
*/ |
| 42 |
DefaultModel* newInstance() const override { return new DefaultModel; } |
| 43 |
|
| 44 |
/** |
| 45 |
* @brief A unique identifier defined by the file |
| 46 |
*/ |
| 47 |
std::string identifier() const override { return m_identifier; } |
| 48 |
|
| 49 |
/** |
| 50 |
* @brief Set the identifier |
| 51 |
*/ |
| 52 |
virtual void setIdentifier(const std::string& identifier) |
| 53 |
{ |
| 54 |
m_identifier = identifier; |
| 55 |
} |
| 56 |
|
| 57 |
/** |
| 58 |
* @brief We don't have any other name beyond the identifier in the file |
| 59 |
*/ |
| 60 |
std::string name() const override { return m_identifier; } |
| 61 |
|
| 62 |
/** |
| 63 |
* @brief This default method is defined for whatever is in a molecule |
| 64 |
* @return all elements - technically not true, but we don't have the mol |
| 65 |
*/ |
| 66 |
Core::Molecule::ElementMask elements() const override { return (m_elements); } |
| 67 |
|
| 68 |
/** |
| 69 |
* @brief Retrieve the relevant charges from the molecule for our defined type |
| 70 |
*/ |
| 71 |
MatrixX partialCharges(Core::Molecule& mol) const override; |
| 72 |
|
| 73 |
MatrixX partialCharges(const Core::Molecule& mol) const override; |
| 74 |
|
| 75 |
protected: |
| 76 |
std::string m_identifier; |
| 77 |
Core::Molecule::ElementMask m_elements; |
| 78 |
}; |
| 79 |
|
| 80 |
} // namespace Calc |
| 81 |
} // namespace Avogadro |
| 82 |
|
| 83 |
#endif // AVOGADRO_CALC_CHARGEMODEL_H |