Skip to content

Commit

Permalink
schrodinger#51 Issue: Update clear() method
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeAnk2829 committed Mar 30, 2023
1 parent c4dd5b0 commit 6f2d030
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 16 deletions.
43 changes: 33 additions & 10 deletions sketcherMinimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
#include "sketcherMinimizerMaths.h"
#include "sketcherMinimizerRing.h"
#include "sketcherMinimizerStretchInteraction.h"

#include "sketcherMinimizerAtom.h"
#include "sketcherMinimizerBond.h"
#include "sketcherMinimizerFragment.h"
using namespace std;
using namespace schrodinger;

Expand All @@ -54,7 +56,7 @@ sketcherMinimizer::sketcherMinimizer(float precision)

sketcherMinimizer::~sketcherMinimizer()
{
clear();
void clear();
}

void sketcherMinimizer::setScoreResidueInteractions(bool b)
Expand Down Expand Up @@ -161,11 +163,13 @@ void sketcherMinimizer::canonicalOrdering(sketcherMinimizerMolecule* minMol)
}
}

void sketcherMinimizer::initialize(
sketcherMinimizerMolecule* minMol) // min mol is split into molecules if
// needed and then added to the minimizer
{
clear();
void sketcherMinimizer::initialize(sketcherMinimizerMolecule* minMol) {
// min mol is split into molecules if
// needed and then added to the minimizer
void clear();
m_proximityRelations.clear();

m_proximityRelations.clear();
m_referenceAtoms = minMol->_atoms;
m_referenceBonds = minMol->_bonds;

Expand Down Expand Up @@ -335,7 +339,7 @@ void sketcherMinimizer::flagCrossAtoms()
}
}

void sketcherMinimizer::clear()
void sketcherMinimizer :: clear()
{
for (auto& _referenceAtom : m_referenceAtoms) {
delete _referenceAtom;
Expand Down Expand Up @@ -367,10 +371,29 @@ void sketcherMinimizer::clear()
}

m_molecules.clear();

for(auto& _atoms : m_atoms) {
delete _atoms;
}
m_atoms.clear();

for(auto& _bonds : m_bonds) {
delete _bonds;
}
m_bonds.clear();

for(auto& _residueInteractions : m_residueInteractions) {
delete _residueInteractions;
}
m_residueInteractions.clear();

for(auto& _independentFragments : m_independentFragments) {
delete _independentFragments;
}
m_independentFragments.clear();
}

void sketcherMinimizer::splitIntoMolecules(
sketcherMinimizerMolecule* mol, vector<sketcherMinimizerMolecule*>& mols)
void sketcherMinimizer::splitIntoMolecules(sketcherMinimizerMolecule* mol, vector<sketcherMinimizerMolecule*>& mols)
{

if (mol->_atoms.empty()) {
Expand Down
10 changes: 4 additions & 6 deletions sketcherMinimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class CoordgenTemplates
class EXPORT_COORDGEN sketcherMinimizer
{

public:
public:
sketcherMinimizer(float precision = SKETCHER_STANDARD_PRECISION);
~sketcherMinimizer();

Expand Down Expand Up @@ -283,9 +283,10 @@ class EXPORT_COORDGEN sketcherMinimizer
static void loadTemplates();
static CoordgenTemplates m_templates;

private:
/*all non-terminal bonds to a metal atom are treated as if they were zero order bonds (this usually results
in a longer bond*/

private:
bool m_treatNonterminalBondsToMetalAsZOBs = true;

CoordgenFragmentBuilder m_fragmentBuilder;
Expand All @@ -302,7 +303,6 @@ class EXPORT_COORDGEN sketcherMinimizer
std::vector<sketcherMinimizerBond*> m_proximityRelations;
std::vector<sketcherMinimizerBond*> m_extraBonds;
std::vector<sketcherMinimizerMolecule*> m_molecules;

/* return the position of res, which is part of SSE, given that the first
* residue of SSE is placed at startF and consecutive residues are placed
* increment away from each other. All distances are expressed in floats,
Expand All @@ -322,7 +322,6 @@ class EXPORT_COORDGEN sketcherMinimizer

/* clear data and free memory */
void clear();

/* flag atoms that will be drawn with 90° angles (e.g. phosphate P) */
void flagCrossAtoms();

Expand Down Expand Up @@ -439,8 +438,7 @@ class EXPORT_COORDGEN sketcherMinimizer
sketcherMinimizerResidue* residue);

/* assign coordinates to residues */
void placeResidues(const std::vector<sketcherMinimizerAtom*>& atoms =
std::vector<sketcherMinimizerAtom*>(0));
void placeResidues(const std::vector<sketcherMinimizerAtom*>& atoms = std::vector<sketcherMinimizerAtom*>(0));

/* assign coordinates to residues in the context of a protein-protein
interaction diagram */
Expand Down

0 comments on commit 6f2d030

Please sign in to comment.