#3604 Add api methods to interact with atoms and bonds in s-groups - #3625
Merged
Conversation
AlexanderSavelyev
requested changes
May 8, 2026
AlexanderSavelyev
requested changes
May 8, 2026
AlexanderSavelyev
requested changes
May 12, 2026
|
|
||
| if ((sg_child.parent_group != 0) && (sg_child.parent_group == sgroup.original_group)) | ||
| _addSgroupElement(sg, mol, sg_child); | ||
| if (child_entry.write_parent == write_index) |
Collaborator
There was a problem hiding this comment.
what does this mean?
AlexanderSavelyev
requested changes
May 25, 2026
| { | ||
| DataSGroup& group = (DataSGroup&)sg; | ||
| if (!group.relative) | ||
| if (!group.relative && group.display_pos.hasValue()) |
Collaborator
There was a problem hiding this comment.
it should be just write
| } | ||
|
|
||
| operator const T&() const | ||
| T& get() |
Collaborator
There was a problem hiding this comment.
make verification on value
| TextItem& index = _data.textitems[tiIndex]; | ||
| index.fontsize = FONT_SIZE_ATTR; | ||
| bprintf(index.text, "%d", group.multiplier); | ||
| bprintf(index.text, "%d", group.multiplier.get()); |
Collaborator
There was a problem hiding this comment.
need to add check
| { | ||
| const Superatom& group = (Superatom&)sgroup; | ||
| Vec3f displayPosition = group.display_position; | ||
| Vec3f displayPosition = group.display_position.get(); |
Collaborator
There was a problem hiding this comment.
need to add check
AlexanderSavelyev
requested changes
May 25, 2026
| { | ||
| DataSGroup& group = (DataSGroup&)sg; | ||
| if (!group.relative) | ||
| if (!group.relative && group.display_pos.hasValue()) |
Collaborator
There was a problem hiding this comment.
it is write, should not check for value
| @@ -340,7 +340,7 @@ void CmfSaver::_encodeExtSection(Molecule& mol, const Mapping& mapping) | |||
| _encodeString(sd.data); | |||
| // Pack detached, relative, display_units, and sd.dasp_pos into one byte | |||
| if (sd.dasp_pos < 0 || sd.dasp_pos > 9) | |||
| _encodeUIntArray(sm.parent_atoms, *mapping.atom_mapping); | ||
| if (sm.multiplier < 0) | ||
| throw Error("internal error: SGroup multiplier is negative: %d", sm.multiplier); | ||
| throw Error("internal error: SGroup multiplier is negative: %d", sm.multiplier.get()); |
| { | ||
| for (i = _mol->sgroups.begin(); i != _mol->sgroups.end(); i = _mol->sgroups.next(i)) | ||
| auto entries = getOrderedSGroups(_mol->sgroups); | ||
| for (auto& entry : entries) |
Collaborator
There was a problem hiding this comment.
rename to sgroupEntry
| std::vector<int> sgs_mapping(pool_end, 0); | ||
|
|
||
| // Roots first (parent_group == 0 or not set) | ||
| int iw = 1; |
| { | ||
| SGroup& sg = sgroups.getSGroup(i); | ||
| int pg = sg.parent_group.hasValue() ? sg.parent_group.get() : 0; | ||
| if (pg == 0) |
| std::set<int> added_indices; | ||
|
|
||
| // Add roots first | ||
| for (auto& e : all_entries) |
| struct SGroupWriteEntry | ||
| { | ||
| int pool_idx; // original pool index in mol.sgroups | ||
| int write_index; // sequential 1,2,3... for CTFile output |
Collaborator
There was a problem hiding this comment.
rename write_index to index
| @@ -565,7 +565,7 @@ void MoleculeRenderInternal::_initSGroups(Tree& sgroups, Rect2f parent) | |||
| TextItem& ti = _data.textitems[tii]; | |||
| if (group.tag != ' ') | |||
| { | |||
AlexanderSavelyev
requested changes
May 25, 2026
| for (int i : pool_indices) | ||
| { | ||
| SGroup& sg = sgroups.getSGroup(i); | ||
| int key = (sg.index != 0) ? sg.index : sgs_mapping[i]; |
Collaborator
There was a problem hiding this comment.
potential problem
even1024
force-pushed
the
3604-sgroups-api
branch
from
June 9, 2026 01:44
6061569 to
32b9cac
Compare
AlexanderSavelyev
approved these changes
Jun 9, 2026
even1024
force-pushed
the
3604-sgroups-api
branch
from
June 9, 2026 14:04
3bb039d to
e84faa7
Compare
even1024
force-pushed
the
3604-sgroups-api
branch
from
June 9, 2026 20:35
e84faa7 to
852d265
Compare
AlexanderSavelyev
approved these changes
Jun 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Generic request
#1234 – issue name