Skip to content
This repository was archived by the owner on Jul 10, 2024. It is now read-only.

Commit ff94462

Browse files
committed
fix charge balance for Br, Bl, and I
1 parent 13223ba commit ff94462

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

build.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
this version date should be updated only when the underlying
3838
hash will change!
3939
-->
40-
<property name="version" value="20160823"/>
40+
<property name="version" value="20170222"/>
4141
<echo file="src/lychi/Version.java">package lychi;
4242
public final class Version {
4343
public static final String VERSION = "${version}";

src/lychi/LyChIStandardizer.java

+13-3
Original file line numberDiff line numberDiff line change
@@ -2557,16 +2557,26 @@ int chargeBalance (Molecule mol) {
25572557
for (int i = 0; i < atoms.length; ++i) {
25582558
int ch = atoms[i].getCharge();
25592559
int hc = atoms[i].getImplicitHcount();
2560-
if (atoms[i].getAtno() == 8 && hc > 0 && ch == 0) {
2561-
cand.add(i);
2560+
switch (atoms[i].getAtno()) {
2561+
case 8: // O
2562+
case 17: // Cl
2563+
case 35: // Br
2564+
case 53: // I
2565+
if (hc > 0 && ch == 0) {
2566+
cand.add(i);
2567+
}
2568+
break;
25622569
}
25632570
}
25642571

25652572
while (net > 0 && !cand.isEmpty()) {
25662573
int minrank = Integer.MAX_VALUE;
25672574
Integer atom = null;
25682575
for (Integer a : cand) {
2569-
if (rank[a] < minrank) {
2576+
if (rank[a] < minrank
2577+
|| (rank[a] == minrank
2578+
&& atoms[a].getAtno()
2579+
< atoms[atom].getAtno())) {
25702580
minrank = rank[a];
25712581
atom = a;
25722582
}

0 commit comments

Comments
 (0)