Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix vibration animation #1487

Merged
merged 1 commit into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion avogadro/core/molecule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ void Molecule::readProperties(const Molecule& other)
m_label = other.m_label;
m_colors = other.m_colors;
// merge data maps by iterating through other's map
for (auto it = other.m_data.constBegin(); it != other.m_data.constEnd(); ++it) {
for (auto it = other.m_data.constBegin(); it != other.m_data.constEnd();
++it) {
// even if we have the same key, we want to overwrite
m_data.setValue(it->first, it->second);
}
Expand Down Expand Up @@ -1218,6 +1219,11 @@ bool Molecule::setCoordinate3d(int coord)
return false;
}

void Molecule::clearCoordinate3d()
{
m_coordinates3d.clear();
}

Array<Vector3> Molecule::coordinate3d(int index) const
{
return m_coordinates3d[index];
Expand Down
5 changes: 5 additions & 0 deletions avogadro/core/molecule.h
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,11 @@ class AVOGADROCORE_EXPORT Molecule
Array<Vector3> coordinate3d(int index) const;
bool setCoordinate3d(const Array<Vector3>& coords, int index);

/**
* Clear coordinate sets (except the default set)
*/
void clearCoordinate3d();

/**
* Timestep property is used when molecular dynamics trajectories are read
*/
Expand Down
3 changes: 2 additions & 1 deletion avogadro/qtplugins/spectra/spectra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,11 @@
m_molecule->setForceVector(atom, v);
++atom;
}
m_molecule->emitChanged(QtGui::Molecule::Atoms | QtGui::Molecule::Added);
// m_molecule->emitChanged(QtGui::Molecule::Atoms | QtGui::Molecule::Added);
Dismissed Show dismissed Hide dismissed

int frames = 5; // TODO: needs an option
int frameCounter = 0;
m_molecule->clearCoordinate3d();
m_molecule->setCoordinate3d(atomPositions, frameCounter++);

// Current coords + displacement.
Expand Down
Loading