From 4496561abe995040e0517babf5211a355756d345 Mon Sep 17 00:00:00 2001 From: Geoff Hutchison Date: Thu, 21 Nov 2024 11:03:49 -0500 Subject: [PATCH] Initial support for reading coordinate sets from ORCA Needs more testing Signed-off-by: Geoff Hutchison --- avogadro/quantumio/orca.cpp | 16 ++++++++++++++++ avogadro/quantumio/orca.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/avogadro/quantumio/orca.cpp b/avogadro/quantumio/orca.cpp index 387fa589b5..605a952c94 100644 --- a/avogadro/quantumio/orca.cpp +++ b/avogadro/quantumio/orca.cpp @@ -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 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(); @@ -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(); diff --git a/avogadro/quantumio/orca.h b/avogadro/quantumio/orca.h index 006872a0b9..6d9eed5282 100644 --- a/avogadro/quantumio/orca.h +++ b/avogadro/quantumio/orca.h @@ -61,6 +61,8 @@ class AVOGADROQUANTUMIO_EXPORT ORCAOutput : public Io::FileFormat std::vector m_atomNums; std::vector m_atomPos; + std::vector> m_coordSets; + std::vector m_energies; Vector3 m_dipoleMoment;