Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
d6dc293
Added unit test prototype for testing OutputINCHI_StereoLayer
cm-beilstein Dec 19, 2025
e5f4403
Added new unit-tests
cm-beilstein Dec 19, 2025
4b8e52b
Merge branch 'refactor_main' into enh_stereo
cm-beilstein Dec 22, 2025
3cff56f
Changed gtest test_suite names
cm-beilstein Dec 22, 2025
321856d
Merge branch 'refactor_main' into enh_stereo
cm-beilstein Dec 22, 2025
bc49dca
New units for enh stereochemistry
cm-beilstein Dec 22, 2025
0cf17b9
Added/corrected unit tests for enh stereo
cm-beilstein Dec 23, 2025
e0b38cb
Added unit tests for stereo-layer tags
cm-beilstein Dec 30, 2025
2e9f95c
Added unit tests for m-layer
cm-beilstein Jan 5, 2026
01ca153
Added doxygen comments
cm-beilstein Jan 7, 2026
ddd3c7a
Added unit tests and initial modification for enh stereo
cm-beilstein Jan 8, 2026
892521a
Added functions for changing parities based on abs, rel, rac
cm-beilstein Jan 9, 2026
65e5eb5
prototypes and unit-test for t and m-layer changes
cm-beilstein Jan 12, 2026
0555b4f
added code for parity change (t+m-layer)
cm-beilstein Jan 21, 2026
7988584
added unit test and param for enh stereochem
cm-beilstein Jan 22, 2026
2d12b3b
fixed parity change bug for enhanced stereochemistry
cm-beilstein Jan 23, 2026
0784a98
Removed inchi warning about enh stereo and added test for multiple fr…
cm-beilstein Jan 23, 2026
9dacaa2
fixed s-layer duplication and unknown canonical atom mapping
cm-beilstein Jan 26, 2026
7c62770
Fixed enh stereochem, added more unit-tests and modified CMakeLists f…
cm-beilstein Jan 27, 2026
5766fec
Adjusted assert to account for missing enh stereo chem message
cm-beilstein Jan 27, 2026
4ddd959
added fix if no collection available, standard functionality will be …
cm-beilstein Jan 28, 2026
7e2da23
added m-layer change to 0 if no abs center present
cm-beilstein Jan 29, 2026
37ad158
changed m layer based on feedback (no abs)
cm-beilstein Jan 30, 2026
e6fb59c
Bugfix for mol v2 files
cm-beilstein Jan 30, 2026
99628bc
changed InChI-Prefix to InChI=1B (beta)
cm-beilstein Jan 30, 2026
2ca5281
added unit tests and doxygen for functions used in enhanced stereoche…
cm-beilstein Feb 2, 2026
5886446
added unit test fix for log message in MakeINCHIFromMolfileText
cm-beilstein Feb 2, 2026
556adde
bug when switching from debug and release...
cm-beilstein Feb 2, 2026
7d1fde3
Fixed unit test for testing batch test_file_1 (sdf)
cm-beilstein Feb 3, 2026
6f16320
changed directory
cm-beilstein Feb 3, 2026
5cd2aa7
added another unit test for testing enh stereo grps stretching over 2…
cm-beilstein Feb 4, 2026
8b07bff
added atropisomer test for enh stereo
cm-beilstein Feb 5, 2026
04a1c5b
added flags for gcov: needs to be run with cmake -DCOVERAGE=ON -B CMa…
cm-beilstein Feb 5, 2026
cf6d7ce
fixed unit test for atropisomer in enh stereo
cm-beilstein Feb 5, 2026
3fad65a
added 2 unit tests with faulty molblocks
cm-beilstein Feb 6, 2026
b4446a0
added code for handling empty data
cm-beilstein Feb 6, 2026
0ecfdf3
changed comments
cm-beilstein Feb 9, 2026
578ab2d
Merge branch 'dev' into enh_stereo
cm-beilstein Feb 9, 2026
39f053b
Merge branch 'refactor_main' into enh_stereo
cm-beilstein Feb 9, 2026
d2fd2be
clean up unit test code
cm-beilstein Feb 9, 2026
abb99e9
Merge branch 'dev' into enh_stereo
cm-beilstein Feb 12, 2026
114bd64
Merge branch 'dev' into enh_stereo
cm-beilstein Feb 16, 2026
9d4f720
removed sorting of stereo groups by index
cm-beilstein Feb 18, 2026
5e193b4
Release v1.07.5
JanCBrammer Oct 20, 2025
fdb33c4
changed sorting of stereo groups to first canonical atom number in st…
cm-beilstein Feb 18, 2026
8e02c7d
Merge branch 'dev' into enh_stereo
cm-beilstein Feb 19, 2026
5c55589
Added comments and minor clean up
cm-beilstein Feb 19, 2026
801a93f
Merge branch 'dev' into enh_stereo
cm-beilstein Feb 19, 2026
d0e2798
Added unit test for same molecules with different AND group numbering
cm-beilstein Feb 19, 2026
bad9cf6
Fix for Release #68 test run (github action workflow)
cm-beilstein Feb 19, 2026
f63ffb0
Fix for Release [#68](https://github.com/IUPAC-InChI/InChI/issues/68)…
cm-beilstein Feb 19, 2026
faa56a8
Fix for Release [(https://github.com/IUPAC-InChI/InChI/issues/68)] te…
cm-beilstein Feb 19, 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
25 changes: 12 additions & 13 deletions INCHI-1-SRC/INCHI_BASE/src/ichimake.c
Original file line number Diff line number Diff line change
Expand Up @@ -608,22 +608,21 @@ int GetSp3RelRacAbs(const INChI* pINChI, INChI_Stereo* Stereo)
nRet = SP3_REL;
#endif
}
else
if (pINChI->nFlags & INCHI_FLAG_RAC_STEREO)
{
else if (pINChI->nFlags & INCHI_FLAG_RAC_STEREO)
{
#if ( REL_RAC_STEREO_IGN_1_SC == 1 )
if (1 < Stereo->nNumberOfStereoCenters)
{
nRet = SP3_REL;
}
#else
nRet = SP3_RAC;
#endif
}
else
if (1 < Stereo->nNumberOfStereoCenters)
{
nRet = SP3_ABS;
nRet = SP3_REL;
}
#else
nRet = SP3_RAC;
#endif
}
else
{
nRet = SP3_ABS;
}
}
else
#if ( REL_RAC_STEREO_IGN_1_SC == 1 )
Expand Down
58 changes: 31 additions & 27 deletions INCHI-1-SRC/INCHI_BASE/src/ichiprt1.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,11 @@ static int OutputINCHI_PolymerLayer( CANON_GLOBALS *pCG, INCHI_IOSTREAM *out_fil
INCHI_OUT_CTL *io, char *pLF, char *pTAB );
static int OutputINCHI_PolymerLayer_SingleUnit( OAD_PolymerUnit *u,
int bPolymers,
int total_star_atoms,
int total_star_atoms,
int *n_used_stars,
OAD_AtProps *aprops,
OAD_AtProps *aprops,
int *cano_nums,
ORIG_ATOM_DATA *orig_inp_data,
ORIG_ATOM_DATA *orig_inp_data,
ORIG_STRUCT *pOrigStruct,
INCHI_IOS_STRING *strbuf );
static int OutputAUXINFO_HeaderAndNormalization_type( CANON_GLOBALS *pCG,
Expand Down Expand Up @@ -1160,7 +1160,7 @@ int OutputINChI1( CANON_GLOBALS *pCG,
io.n_pzz = orig_inp_data->polymer->n_pzz;
}
}


io.bPolymers = ip->bPolymers;

Expand Down Expand Up @@ -2640,7 +2640,7 @@ int WriteOrigBonds( CANON_GLOBALS *pCG,
num_trans = 0; /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
nNeighOrder[0] = 0;
}
for (kk = 0; kk < at[j].valence; kk++)
for (kk = 0; kk < at[j].valence; kk++)
{
k = nNeighOrder[kk];
j2 = at[j].neighbor[k];
Expand Down Expand Up @@ -3121,7 +3121,7 @@ void set_line_separators( int bINChIOutputOptions, char **pLF, char **pTAB )
int bPlainTabbedOutput = 0 != ( bINChIOutputOptions & INCHI_OUT_TABBED_OUTPUT ) &&
bPlainText && !bPlainTextCommnts;

*pTAB = bPlainTabbedOutput ? "\t" : "\n";
*pTAB = bPlainTabbedOutput ? (char*)"\t" : (char*)"\n";
}
#else
*pTAB = "\n";
Expand Down Expand Up @@ -3359,11 +3359,9 @@ int OutputINCHI_StereoLayer( CANON_GLOBALS *pCG,
char *pTAB )
{

{
int i;
i = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_t_SATOMS] ); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
/* djb-rwth: removing redundant code */
}
// int i;
// i = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_t_SATOMS] ); /* djb-rwth: ignoring LLVM warning: variable used to store function return value */
// /* djb-rwth: removing redundant code */

if (INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_b_SBONDS] ) ||
INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_t_SATOMS] ) ||
Expand Down Expand Up @@ -3432,7 +3430,10 @@ int OutputINCHI_StereoLayer( CANON_GLOBALS *pCG,
}
else
{
if (io->bPlainTextTags == 1) inchi_ios_print_nodisplay( out_file, "/" ); /* sp3 */
if (io->bPlainTextTags == 1)
{
inchi_ios_print_nodisplay( out_file, "/" ); /* sp3 */
}
}

/* bStereoAbsInverted[io->iCurTautMode] */
Expand Down Expand Up @@ -3490,7 +3491,10 @@ int OutputINCHI_StereoLayer( CANON_GLOBALS *pCG,
}
else
{
if (io->bPlainTextTags == 1) inchi_ios_print_nodisplay( out_file, "////" ); /* sp3, sp2, abs-inv, stereo.type */
if (io->bPlainTextTags == 1)
{
inchi_ios_print_nodisplay( out_file, "////" ); /* sp2, sp3, abs-inv, stereo.type */
}
}

return 0;
Expand Down Expand Up @@ -3908,7 +3912,7 @@ static int OutputINCHI_PolymerLayer( CANON_GLOBALS *pCG,
nat = orig_inp_data->num_inp_atoms;
num_inp_bonds = orig_inp_data->num_inp_bonds;


if (pOrigStruct && !pOrigStruct->polymer)
{
return 0;
Expand Down Expand Up @@ -4145,7 +4149,7 @@ static int OutputINCHI_PolymerLayer_SingleUnit( OAD_PolymerUnit *u,
a2 = u->blist[1];
a3 = u->blist[2];
a4 = u->blist[3];

if (is_in_the_ilist( u->alist, a1, u->na ))
{
tmp = a2;
Expand All @@ -4172,7 +4176,7 @@ static int OutputINCHI_PolymerLayer_SingleUnit( OAD_PolymerUnit *u,
/* The first printed is the crossing bond pointing to more senior CRU end ("head") */
swap = (OAD_Polymer_IsFirstAtomRankLower(a2, a4, aprops) == 1);
}

if (swap)
{
inchi_strbuf_printf( strbuf, "(%-d-%-d,%-d-%-d)", a3, a4, a1, a2 );
Expand Down Expand Up @@ -4288,8 +4292,8 @@ static int OutputINCHI_PolymerLayer_SingleUnit( OAD_PolymerUnit *u,
here
at1, at2 is the most senior bond, and at1 is more senior than at2
all other pairs at3,at4, at5,at6, ... are sorted just in increasing
order of first number in pair, then second one, e.g.: at3<at4; at3<=at5
(and if at3==at5 then at4<at6)
order of first number in pair, then second one, e.g.: at3<at4; at3<=at5
(and if at3==at5 then at4<at6)
*/

if (p->frame_shift_scheme != FSS_NONE && u->nbkbonds >= 1 && u->cap1 >= 1 && u->cap2 >= 1)
Expand Down Expand Up @@ -5046,7 +5050,7 @@ void EditINCHI_HidePolymerZz(INCHI_IOSTREAM *out, int n_pzz, int n_zy)
eol_was_consumed = 0, pre_eol = 0,
nonprt_sym = 0, nonprt_prev = 0;

if (n_zy > 0)
if (n_zy > 0)
{
/* We have some placeholder pseudo atoms which should not be removed below (if anyway they are allowed) */
if (n_pzz == 0)
Expand Down Expand Up @@ -5131,7 +5135,7 @@ void EditINCHI_HidePolymerZz(INCHI_IOSTREAM *out, int n_pzz, int n_zy)
AT_NUMB ia = (AT_NUMB) inchi_strtol(p, &q, 10); /* make compiler happy: */ /* djb-rwth: removing redundant code; ignoring LLVM warning: variable used to store function return value */
if (*q != '-')
{
skip = 1;
skip = 1;
}
}
}
Expand Down Expand Up @@ -5283,16 +5287,16 @@ int CountPseudoElementInFormula( const char *pseudo, char *s ) /* djb-rwth: igno
char prev = '/';

/*
format is
format is
[sequence of] [.[int_mult[Zz[int_index]]]]
*/

if (!s)
{
return 0;
}
p = s;

p = s;
while (*p)
/*for (p = s ; *p; p++)*/
{
Expand All @@ -5317,7 +5321,7 @@ int CountPseudoElementInFormula( const char *pseudo, char *s ) /* djb-rwth: igno
{
mult = (int)inchi_strtol(p, &q, 10);
p = q;
prev = *q--;
prev = *q--;
continue;
}
else
Expand All @@ -5326,7 +5330,7 @@ int CountPseudoElementInFormula( const char *pseudo, char *s ) /* djb-rwth: igno
}
if (!mult)
{
break;
break;
}
}
else if (*p== pseudo[1] && prev== pseudo[0])
Expand Down Expand Up @@ -5446,7 +5450,7 @@ int MergeZzInHillFormula(INCHI_IOS_STRING *strbuf)
{
inchi_free(scopy); /* djb-rwth: avoiding memory leak */
return -1; /* failed */
}
}
memcpy(scopy, strbuf->pStr, strbuf->nAllocatedLength);
stmp = (char *)inchi_calloc((long long)strbuf->nAllocatedLength + 1, sizeof(char)); /* djb-rwth: cast operator added */
if (!stmp)
Expand All @@ -5458,7 +5462,7 @@ int MergeZzInHillFormula(INCHI_IOS_STRING *strbuf)
inchi_strbuf_reset(strbuf);
p0 = scopy;
p = p0;
do
do
{
/* djb-rwth: removing redundant code */
pend = strchr(p, '.');
Expand Down
1 change: 0 additions & 1 deletion INCHI-1-TEST/tests/test_unit/test_ichimain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ TEST(test_ichimain, test_CalcAndPrintINCHIAndINCHIKEY) {
PINChI_Aux2* pINChI_Aux[INCHI_NUM] = {};
ORIG_ATOM_DATA prep_inp_data = {};
INCHI_IOS_STRING *strbuf = new INCHI_IOS_STRING;
memset(strbuf, 0, sizeof(*strbuf));
inchi_strbuf_init(strbuf, INCHI_STRBUF_INITIAL_SIZE, INCHI_STRBUF_SIZE_INCREMENT);

unsigned long pulTotalProcessingTime = 0;
Expand Down
90 changes: 90 additions & 0 deletions INCHI-1-TEST/tests/test_unit/test_ichimake.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
#include <gtest/gtest.h>
#include <gmock/gmock.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fstream>
#include <filesystem>
#include <vector>

extern "C"
{
#include "../../../INCHI-1-SRC/INCHI_BASE/src/ichimake.c"
#include "../../../INCHI-1-SRC/INCHI_BASE/src/ichi_io.h"
}

TEST(test_ichimake, test_GetSp3RelRacAbs_none)
{

INChI inchi = {0};
INChI_Stereo stereo = {0};

stereo.nNumberOfStereoCenters = 0;

// pINChI->bDeleted
// Stereo->nCompInv2Abs
// 0: No inversion (structure unchanged by inversion)
// Positive integer (>0): Indicates inversion changes the structure (normal/absolute stereo)
// Negative integer (<0): Indicates inversion changes the structure (inverted/absolute stereo)

//int GetSp3RelRacAbs(const INChI* pINChI, INChI_Stereo* Stereo);

int result = GetSp3RelRacAbs(&inchi, &stereo);

EXPECT_EQ(result, SP3_NONE);

}

TEST(test_ichimake, test_GetSp3RelRacAbs_sp3)
{
INChI inchi = {0};
INChI_Stereo stereo = {0};

stereo.nNumberOfStereoCenters = 1;
stereo.nCompInv2Abs = 0;

int result = GetSp3RelRacAbs(&inchi, &stereo);

EXPECT_EQ(result, SP3_ONLY);
}

TEST(test_ichimake, test_GetSp3RelRacAbs_rel)
{
INChI inchi = {0};
INChI_Stereo stereo = {0};

inchi.nFlags = INCHI_FLAG_REL_STEREO;
stereo.nNumberOfStereoCenters = 1;
stereo.nCompInv2Abs = 1;

int result = GetSp3RelRacAbs(&inchi, &stereo);

EXPECT_EQ(result, SP3_REL);
}

TEST(test_ichimake, test_GetSp3RelRacAbs_rac)
{
INChI inchi = {0};
INChI_Stereo stereo = {0};

inchi.nFlags = INCHI_FLAG_RAC_STEREO;
stereo.nNumberOfStereoCenters = 1;
stereo.nCompInv2Abs = 1;

int result = GetSp3RelRacAbs(&inchi, &stereo);

EXPECT_EQ(result, SP3_RAC);
}

TEST(test_ichimake, test_GetSp3RelRacAbs_abs)
{
INChI inchi = {0};
INChI_Stereo stereo = {0};

inchi.nFlags = 0x0111;
stereo.nNumberOfStereoCenters = 1;
stereo.nCompInv2Abs = 1;

int result = GetSp3RelRacAbs(&inchi, &stereo);

EXPECT_EQ(result, SP3_ABS);
}
Loading