Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/indigo-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ jobs:
build_indigo_utils_x86_64:
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.set_matrix.outputs.matrix) }}
matrix: ${{ fromJSON(needs.set_matrix.outputs.matrix || '{"os":["ubuntu-latest","windows-latest"]}') }}
runs-on: ${{ matrix.os }}
# needs: [build_bingo_postgres_linux_x86_64, build_bingo_postgres_windows_msvc_x86_64, build_bingo_postgres_macos_x86_64]
needs: [build_bingo_postgres_linux_x86_64, build_bingo_postgres_windows_msvc_x86_64, set_matrix ]
Expand Down
6 changes: 6 additions & 0 deletions api/c/indigo/indigo.h
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,12 @@ CEXPORT int indigoGetSGroupNumCrossBonds(int sgroup);
CEXPORT int indigoCreateCrossBonds(int sgroup);
CEXPORT int indigoClearSGroupCrossBonds(int sgroup);

// Issue #3604: New SGroup API methods
CEXPORT int indigoAddSGroup(int molecule, const char* type, int extindex);
CEXPORT int indigoSetSGroupAtoms(int sgroup, int natoms, int* atoms);
CEXPORT int indigoSetSGroupBonds(int sgroup, int nbonds, int* bonds);
CEXPORT int indigoIterateSGroupCrossBonds(int sgroup);

CEXPORT int indigoAddSGroupAttachmentPoint(int sgroup, int aidx, int lvidx, const char* apid);
CEXPORT int indigoDeleteSGroupAttachmentPoint(int sgroup, int index);
// Returns iterator of superatom attachment points (SAP entries) for a superatom S-group.
Expand Down
2 changes: 1 addition & 1 deletion api/c/indigo/src/indigo_abbreviations_expand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ namespace indigo

int sid = mol.sgroups.addSGroup(SGroup::SG_TYPE_SUP);
Superatom& super = (Superatom&)mol.sgroups.getSGroup(sid);
super.subscript.readString(mol.getPseudoAtom(v), true);
super.label.readString(mol.getPseudoAtom(v), true);
for (int ve = expanded.vertexBegin(); ve != expanded.vertexEnd(); ve = expanded.vertexNext(ve))
super.atoms.push(mapping[ve]);

Expand Down
31 changes: 27 additions & 4 deletions api/c/indigo/src/indigo_molecule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,7 @@ IndigoObject* IndigoSGroupAtomsIter::next()
return new IndigoAtom(_mol, _sgroup.atoms[_idx]);
}

IndigoSGroupBondsIter::IndigoSGroupBondsIter(BaseMolecule& mol, SGroup& sgroup) : IndigoObject(SGROUP_ATOMS_ITER), _mol(mol), _sgroup(sgroup)
IndigoSGroupBondsIter::IndigoSGroupBondsIter(BaseMolecule& mol, SGroup& sgroup) : IndigoObject(SGROUP_BONDS_ITER), _mol(mol), _sgroup(sgroup)
{
_idx = -1;
}
Expand All @@ -1159,7 +1159,7 @@ IndigoSGroupBondsIter::~IndigoSGroupBondsIter()

bool IndigoSGroupBondsIter::hasNext()
{
return _idx + 1 < _sgroup.bonds.size();
return _idx + 1 < _sgroup.getBonds().size();
}

IndigoObject* IndigoSGroupBondsIter::next()
Expand All @@ -1168,7 +1168,30 @@ IndigoObject* IndigoSGroupBondsIter::next()
return 0;

_idx++;
return new IndigoBond(_mol, _sgroup.bonds[_idx]);
return new IndigoBond(_mol, _sgroup.getBonds()[_idx]);
}

IndigoSGroupXBondsIter::IndigoSGroupXBondsIter(BaseMolecule& mol, SGroup& sgroup) : IndigoObject(SGROUP_BONDS_ITER), _mol(mol), _sgroup(sgroup)
{
_idx = -1;
}

IndigoSGroupXBondsIter::~IndigoSGroupXBondsIter()
{
}

bool IndigoSGroupXBondsIter::hasNext()
{
return _idx + 1 < _sgroup.xbonds.size();
}

IndigoObject* IndigoSGroupXBondsIter::next()
{
if (!hasNext())
return 0;

_idx++;
return new IndigoBond(_mol, _sgroup.xbonds[_idx]);
}

int _indigoIterateAtoms(Indigo& self, int molecule, int type)
Expand Down Expand Up @@ -1312,7 +1335,7 @@ CEXPORT int indigoCountBonds(int molecule)

auto sg = _getSGroupFromObject(obj);
if (sg)
return sg.get().bonds.size();
return sg.get().getBonds().size();

BaseMolecule& mol = obj.getBaseMolecule();

Expand Down
16 changes: 16 additions & 0 deletions api/c/indigo/src/indigo_molecule.h
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,22 @@ class IndigoSGroupBondsIter : public IndigoObject
int _idx;
};

// Iterates xbonds (crossing bonds) directly, not polymorphic getBonds()
class IndigoSGroupXBondsIter : public IndigoObject
{
public:
IndigoSGroupXBondsIter(BaseMolecule& mol, SGroup& sgroup);
~IndigoSGroupXBondsIter() override;

IndigoObject* next() override;
bool hasNext() override;

protected:
BaseMolecule& _mol;
SGroup& _sgroup;
int _idx;
};

class IndigoMoleculeComponent : public IndigoObject
{
public:
Expand Down
Loading
Loading