<commit_before>#
# <NAME> 2008-09-02
#   get the system and assign bond orders 
#

import BALL

system = getSystems()[0]
abop = BALL.AssignBondOrderProcessor()
abop.options.setBool(BALL.AssignBondOrderProcessor.Option.KEKULIZE_RINGS, True) 
abop.options.setBool(BALL.AssignBondOrderProcessor.Option.OVERWRITE_SINGLE_BOND_ORDERS, True)
abop.options.setBool(BALL.AssignBondOrderProcessor.Option.OVERWRITE_DOUBLE_BOND_ORDERS, True)
abop.options.setBool(BALL.AssignBondOrderProcessor.Option.OVERWRITE_TRIPLE_BOND_ORDERS, True)
abop.options.set(BALL.AssignBondOrderProcessor.Option.ALGORITHM, BALL.AssignBondOrderProcessor.Algorithm.A_STAR)
abop.options.setReal(BALL.AssignBondOrderProcessor.Option.BOND_LENGTH_WEIGHTING,0)
abop.options.setInteger(BALL.AssignBondOrderProcessor.Option.MAX_NUMBER_OF_SOLUTIONS,10)
abop.options.setBool(BALL.AssignBondOrderProcessor.Option.COMPUTE_ALSO_NON_OPTIMAL_SOLUTIONS, True)
abop.options.setBool(BALL.AssignBondOrderProcessor.Option.ADD_HYDROGENS, True)

print "Current penalty: " , abop.evaluatePenalty(system)

# apply the processor
system.apply(abop)

# print all solutions penalty
for i in range(abop.getNumberOfComputedSolutions()):
  print "solution ", str(i) , ": penalty ", str(abop.getTotalPenalty(i)), ", charge ", abop.getTotalCharge(i), " , ", abop.getNumberOfAddedHydrogens(i) , " added hydrogens."

# apply the last solution
abop.apply(abop.getNumberOfComputedSolutions()-1)

getMainControl().update(system)

<commit_msg>improved the example<commit_after>#
# <NAME> 2009-02-02
#   get the system and assign bond orders 
#

import BALL

# for use in BALLView
#system = getSystems()[0]

# for use without BALLView
system = BALL.System()
file = BALL.MOL2File("../../TEST/data/AssignBondOrderProcessor_test_CITSED10_sol_2.mol2")
file.read(system)

abop = BALL.AssignBondOrderProcessor()
abop.options.setBool(BALL.AssignBondOrderProcessor.Option.KEKULIZE_RINGS, True) 
abop.options.setBool(BALL.AssignBondOrderProcessor.Option.OVERWRITE_SINGLE_BOND_ORDERS, True)
abop.options.setBool(BALL.AssignBondOrderProcessor.Option.OVERWRITE_DOUBLE_BOND_ORDERS, True)
abop.options.setBool(BALL.AssignBondOrderProcessor.Option.OVERWRITE_TRIPLE_BOND_ORDERS, True)
abop.options.set(BALL.AssignBondOrderProcessor.Option.ALGORITHM, BALL.AssignBondOrderProcessor.Algorithm.A_STAR)
abop.options.setReal(BALL.AssignBondOrderProcessor.Option.BOND_LENGTH_WEIGHTING,0)
abop.options.setInteger(BALL.AssignBondOrderProcessor.Option.MAX_NUMBER_OF_SOLUTIONS,10)
abop.options.setBool(BALL.AssignBondOrderProcessor.Option.COMPUTE_ALSO_NON_OPTIMAL_SOLUTIONS, True)
abop.options.setBool(BALL.AssignBondOrderProcessor.Option.ADD_HYDROGENS, True)

print "Current penalty: " , abop.evaluatePenalty(system)

# apply the processor
system.apply(abop)

# print all solutions penalty
for i in range(abop.getNumberOfComputedSolutions()):
  print "solution ", str(i) , ": penalty ", str(abop.getTotalPenalty(i)), " , ", abop.getNumberOfAddedHydrogens(i) , " added hydrogens."

# apply the last solution
abop.apply(abop.getNumberOfComputedSolutions()-1)


# for use in BALLView
#getMainControl().update(system)


{'fraction_non_alphanumeric': 0.10954063604240283, 'fraction_numerical': 0.009958239640218438, 'mean_word_length': 7.722689075630252, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5819998', 'n_tokens_mistral': 1166, 'n_tokens_neox': 1110, 'n_words': 145}