qcscine / sparrow

https://scine.ethz.ch
BSD 3-Clause "New" or "Revised" License
78 stars 15 forks source link

Verbosity setting when running in python #19

Closed shihchengli closed 1 year ago

shihchengli commented 1 year ago

Thanks for developing such a powerful software, which really benefit the computational chemistry community. I was wondering if it is possible to set logger depending on desired verbosity. To be more specific, is there a way to suppress the output lines when running calculator.calculate().

steinmig commented 1 year ago

Thank you for giving it a try!

Yes, this can also be done in Python:

import scine_utilities as su

# construct structure and calculator
elements = [su.ElementType.H, su.ElementType.H]
positions = [[0.0, 0.0, 0.0], [1.0, 0.0, 0.0]]
atoms = su.AtomCollection(elements, positions)
calc = su.core.get_calculator("pm6")
calc.structure = atoms
# calculation with output
calc.calculate()
# construct alternative logger
# info see help(su.core.Log)
log = su.core.Log()
log.output.remove("cout")
calc.log = log 
# calculation without output
calc.calculate()
shihchengli commented 1 year ago

@steinmig It works, thanks a lot!