Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
61c355c
#3604 Add api methods to interact with atoms and bonds in s-groups
even1024 Apr 29, 2026
4ffa035
#3604 Add api methods to interact with atoms and bonds in s-groups
even1024 Apr 29, 2026
f7ca433
misc fixes
even1024 Apr 29, 2026
44d0a12
misc fixes
even1024 Apr 29, 2026
8aa8718
misc fixes
even1024 Apr 29, 2026
f9af5a9
test fix
even1024 Apr 29, 2026
d26a89c
refactored
even1024 Apr 30, 2026
1ad842f
refactor
even1024 May 4, 2026
849286b
refactor
even1024 May 4, 2026
8f6e534
nullable refactoring
even1024 May 7, 2026
80a6026
nullable refactoring
even1024 May 7, 2026
39892d4
nullable refactoring
even1024 May 9, 2026
6ac28ba
last commit
even1024 May 10, 2026
6c4d75d
clang format fixes
even1024 May 10, 2026
bbf7739
python formatting fix
even1024 May 10, 2026
a696f70
replace _checkSGroupIndices with read-only getOrderedSGroups
even1024 May 12, 2026
c3a9a88
fix review: cycle guard, xbonds iter, display_pos roundtrip, ext_inde…
even1024 May 14, 2026
c8c544a
fix sgroup xbonds roundtrip
even1024 May 14, 2026
7fc7874
clean sgroup extindex test
even1024 May 15, 2026
4f9941a
black format
even1024 May 15, 2026
e82b7bd
update sgroup layout ref
even1024 May 15, 2026
45c248d
fix displayed sgroup position
even1024 May 15, 2026
4dbeb6d
python 2 fix
even1024 May 15, 2026
0e4c68b
ci fix
even1024 May 15, 2026
84b5362
Restore Nullable fail-fast semantics
even1024 May 28, 2026
260547e
Refactor SGroup ordering info
even1024 May 28, 2026
c6e2ce6
Fix SGroup serialization ordering
even1024 May 29, 2026
e853505
Move SGroup ordering into MoleculeSGroups
even1024 May 29, 2026
0462251
Handle unset DataSGroup display position in CMF
even1024 May 29, 2026
2ccadf6
Guard SGroup Nullable reads and ordering
even1024 May 30, 2026
e0a66ba
Refine SGroup ordering serialization
even1024 Jun 4, 2026
7cb31d3
Format CML saver includes
even1024 Jun 4, 2026
1a8d9e2
Fix Nullable copy semantics
even1024 Jun 4, 2026
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
6 changes: 6 additions & 0 deletions api/c/indigo/indigo.h
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,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 @@ -762,7 +762,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 @@ -1188,7 +1188,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 @@ -1199,7 +1199,7 @@ IndigoSGroupBondsIter::~IndigoSGroupBondsIter()

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

IndigoObject* IndigoSGroupBondsIter::next()
Expand All @@ -1208,7 +1208,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 @@ -1352,7 +1375,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