Skip to content

Commit

Permalink
Initial support for reading coordinate sets from ORCA
Browse files Browse the repository at this point in the history
Needs more testing

Signed-off-by: Geoff Hutchison <[email protected]>
  • Loading branch information
ghutchis committed Nov 21, 2024
1 parent 125e7a8 commit 4496561
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
16 changes: 16 additions & 0 deletions avogadro/quantumio/orca.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,18 @@ bool ORCAOutput::read(std::istream& in, Core::Molecule& molecule)
molecule.setSpectra("NMR", nmrData);
}

molecule.setCoordinate3d(molecule.atomPositions3d(), 0);
if (m_coordSets.size() > 1) {
for (unsigned int i = 1; i < m_coordSets.size(); i++) {
Array<Vector3> positions;
positions.reserve(molecule.atomCount());
for (size_t j = 0; j < molecule.atomCount(); ++j) {
positions.push_back(m_atomPos[j] * BOHR_TO_ANGSTROM);
}
molecule.setCoordinate3d(positions, i);
}
}

// guess bonds and bond orders
molecule.perceiveBondsSimple();
molecule.perceiveBondOrders();
Expand Down Expand Up @@ -152,6 +164,10 @@ void ORCAOutput::processLine(std::istream& in, GaussianSet* basis)
if (Core::contains(key, "CARTESIAN COORDINATES (A.U.)")) {
m_coordFactor = 1.; // leave the coords in BOHR ....
m_currentMode = Atoms;
// if there are any current coordinates, push them back
if (m_atomPos.size() > 0) {
m_coordSets.push_back(m_atomPos);
}
m_atomPos.clear();
m_atomNums.clear();
m_atomLabel.clear();
Expand Down
2 changes: 2 additions & 0 deletions avogadro/quantumio/orca.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ class AVOGADROQUANTUMIO_EXPORT ORCAOutput : public Io::FileFormat

std::vector<int> m_atomNums;
std::vector<Eigen::Vector3d> m_atomPos;
std::vector<std::vector<Eigen::Vector3d>> m_coordSets;
std::vector<double> m_energies;

Vector3 m_dipoleMoment;

Expand Down

0 comments on commit 4496561

Please sign in to comment.