@@ -127,9 +127,10 @@ public class MDLV2000Reader extends DefaultChemObjectReader {
127127 BufferedReader input = null ;
128128 private static ILoggingTool logger = LoggingToolFactory .createLoggingTool (MDLV2000Reader .class );
129129
130- private BooleanIOSetting forceReadAs3DCoords ;
131- private BooleanIOSetting interpretHydrogenIsotopes ;
132- private BooleanIOSetting addStereoElements ;
130+ private BooleanIOSetting optForce3d ;
131+ private BooleanIOSetting optHydIso ;
132+ private BooleanIOSetting optStereoPerc ;
133+ private BooleanIOSetting optStereo0d ;
133134
134135 // Pattern to remove trailing space (String.trim() will remove leading space, which we don't want)
135136 private static final Pattern TRAILING_SPACE = Pattern .compile ("\\ s+$" );
@@ -412,7 +413,7 @@ private IAtomContainer readAtomContainer(IAtomContainer molecule) throws CDKExce
412413 // 0123456789012345678901
413414 if (is3Dfile (program )) {
414415 hasZ = true ;
415- } else if (!forceReadAs3DCoords .isSet ()) {
416+ } else if (!optForce3d .isSet ()) {
416417 for (IAtom atomToUpdate : atoms ) {
417418 Point3d p3d = atomToUpdate .getPoint3d ();
418419 if (p3d != null ) {
@@ -455,7 +456,7 @@ private IAtomContainer readAtomContainer(IAtomContainer molecule) throws CDKExce
455456 }
456457
457458 // create 0D stereochemistry
458- if (addStereoElements .isSet ()) {
459+ if (optStereoPerc . isSet () && optStereo0d .isSet ()) {
459460 Parities :
460461 for (Map .Entry <IAtom , Integer > e : parities .entrySet ()) {
461462 int parity = e .getValue ();
@@ -516,7 +517,7 @@ private IAtomContainer readAtomContainer(IAtomContainer molecule) throws CDKExce
516517 // don't have a hydrogen count for atoms and stereo perception isn't
517518 // currently possible
518519 if (!(outputContainer instanceof IQueryAtomContainer ) && !isQuery &&
519- addStereoElements .isSet () && hasX && hasY ) {
520+ optStereoPerc .isSet () && hasX && hasY ) {
520521 //ALS property could have changed an atom into a QueryAtom
521522 for (IAtom atom : outputContainer .atoms ()){
522523 if (AtomRef .deref (atom ) instanceof QueryAtom ) {
@@ -528,7 +529,7 @@ private IAtomContainer readAtomContainer(IAtomContainer molecule) throws CDKExce
528529 if (hasZ ) { // has 3D coordinates
529530 outputContainer .setStereoElements (StereoElementFactory .using3DCoordinates (outputContainer )
530531 .createAll ());
531- } else if (!forceReadAs3DCoords .isSet ()) { // has 2D coordinates (set as 2D coordinates)
532+ } else if (!optForce3d .isSet ()) { // has 2D coordinates (set as 2D coordinates)
532533 outputContainer .setStereoElements (StereoElementFactory .using2DCoordinates (outputContainer )
533534 .createAll ());
534535 }
@@ -625,12 +626,14 @@ public void close() throws IOException {
625626 }
626627
627628 private void initIOSettings () {
628- forceReadAs3DCoords = addSetting (new BooleanIOSetting ("ForceReadAs3DCoordinates" , IOSetting .Importance .LOW ,
629+ optForce3d = addSetting (new BooleanIOSetting ("ForceReadAs3DCoordinates" , IOSetting .Importance .LOW ,
629630 "Should coordinates always be read as 3D?" , "false" ));
630- interpretHydrogenIsotopes = addSetting (new BooleanIOSetting ("InterpretHydrogenIsotopes" ,
631+ optHydIso = addSetting (new BooleanIOSetting ("InterpretHydrogenIsotopes" ,
631632 IOSetting .Importance .LOW , "Should D and T be interpreted as hydrogen isotopes?" , "true" ));
632- addStereoElements = addSetting (new BooleanIOSetting ("AddStereoElements" , IOSetting .Importance .LOW ,
633+ optStereoPerc = addSetting (new BooleanIOSetting ("AddStereoElements" , IOSetting .Importance .LOW ,
633634 "Detect and create IStereoElements for the input." , "true" ));
635+ optStereo0d = addSetting (new BooleanIOSetting ("AddStereo0d" , IOSetting .Importance .LOW ,
636+ "Allow stereo created from parity value when no coordinates" , "true" ));
634637 }
635638
636639 public void customizeJob () {
@@ -1520,13 +1523,13 @@ private IAtom createAtom(String symbol, IChemObjectBuilder builder, int lineNum)
15201523 atom .setAtomicNumber (elem .number ());
15211524 return atom ;
15221525 }
1523- if (symbol .equals ("D" ) && interpretHydrogenIsotopes .isSet ()) {
1526+ if (symbol .equals ("D" ) && optHydIso .isSet ()) {
15241527 handleError ("invalid symbol: " + symbol , lineNum , 31 , 33 );
15251528 IAtom atom = builder .newInstance (IAtom .class , "H" );
15261529 atom .setMassNumber (2 );
15271530 return atom ;
15281531 }
1529- if (symbol .equals ("T" ) && interpretHydrogenIsotopes .isSet ()) {
1532+ if (symbol .equals ("T" ) && optHydIso .isSet ()) {
15301533 handleError ("invalid symbol: " + symbol , lineNum , 31 , 33 );
15311534 IAtom atom = builder .newInstance (IAtom .class , "H" );
15321535 atom .setMassNumber (3 );
0 commit comments