@@ -606,6 +606,12 @@ namespace SireRDKit
606
606
SireMaths::Vector *coords_data = coords.data ();
607
607
bool has_coords = false ;
608
608
609
+ bool force_stereo_inference = false ;
610
+ if (map.specified (" force_stereo_inference" ))
611
+ {
612
+ force_stereo_inference = map[" force_stereo_inference" ].value ().asABoolean ();
613
+ }
614
+
609
615
for (int i = 0 ; i < atoms.count (); ++i)
610
616
{
611
617
const auto atom = atoms (i);
@@ -640,6 +646,9 @@ namespace SireRDKit
640
646
641
647
a->setAtomicNum (element.nProtons ());
642
648
649
+ // don't automatically add hydrogens
650
+ a->setNoImplicit (true );
651
+
643
652
elements.append (element);
644
653
645
654
try
@@ -776,9 +785,11 @@ namespace SireRDKit
776
785
molecule.commitBatchEdit ();
777
786
molecule.updatePropertyCache (false );
778
787
779
- if (atoms.count () > 1 and (not has_bond_info))
788
+ if (atoms.count () > 1 and (not has_bond_info or force_stereo_inference))
789
+ {
780
790
// we need to infer the bond information
781
791
infer_bond_info (molecule);
792
+ }
782
793
783
794
// try each sanitisation step in turn, skipping failed
784
795
try
@@ -855,7 +866,7 @@ namespace SireRDKit
855
866
856
867
// try assigning stereochemistry from 3D coordinates as it is the most
857
868
// reliable way to do it
858
- if (has_coords)
869
+ if (has_coords and not force_stereo_inference )
859
870
{
860
871
try
861
872
{
0 commit comments