Skip to content

Commit b89561d

Browse files
authored
commented cutting label logic
1 parent c797ef3 commit b89561d

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

rmgpy/molecule/fragment.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -955,19 +955,38 @@ def sliceitup_arom(self, molecule, size_threshold=5):
955955
frag1_L = frag1.count("K")
956956
frag2_R = frag2.count("Na")
957957
frag2_L = frag2.count("K")
958-
958+
959+
# if frag 2 has the least Rs and frag 1 has the
960+
# same or fewer Ls than frag 2 -->
961+
# assign R to frag 2 and L to frag 1
959962
if frag1_R > frag2_R and frag1_L <= frag2_L:
960963
frag1_smi = frag1.replace("*", "L")
961964
frag2_smi = frag2.replace("*", "R")
965+
966+
# if frag 2 has the least Ls and frag 1 has the
967+
# same or fewer Rs than frag 2 -->
968+
# assign R to frag 1 and L to frag 2
962969
elif frag1_L > frag2_L and frag1_R <= frag2_R:
963970
frag1_smi = frag1.replace("*", "R")
964971
frag2_smi = frag2.replace("*", "L")
972+
973+
# if frag 1 has the least Ls and frag 2 has the
974+
# same or fewer Rs than frag 1 -->
975+
# assign R to frag 2 and L to frag 1
965976
elif frag2_L > frag1_L and frag2_R <= frag1_R:
966977
frag1_smi = frag1.replace("*", "L")
967978
frag2_smi = frag2.replace("*", "R")
979+
980+
# if frag 1 has the least Rs and frag 2 has the
981+
# same or fewer Ls than frag 1 -->
982+
# assign R to frag 1 and L to frag 2
968983
elif frag2_R > frag1_R and frag2_L <= frag1_L:
969984
frag1_smi = frag1.replace("*", "R")
970985
frag2_smi = frag2.replace("*", "L")
986+
987+
# else if frag 1 and frag 2 have equal number
988+
# of Rs and Ls or one frag has more Rs and
989+
# more Ls than the other, choose randomly
971990
elif randint(0,1)==1:
972991
frag1_smi = frag1.replace("*", "L")
973992
frag2_smi = frag2.replace("*", "R")

0 commit comments

Comments
 (0)