Output performed with loggers. Adds options --no-print. (#12)
Output performed with loggers. Adds --quiet and --verbose options.
This commit is contained in:
committed by
Matvey Adzhigirey
parent
ca6224433a
commit
5fbbdd4868
@@ -7,6 +7,7 @@ import math, time
|
||||
import propka.lib as lib
|
||||
from propka.determinant import Determinant
|
||||
import propka.calculations
|
||||
from propka.lib import info, warning, debug
|
||||
|
||||
# Some library functions for the interative pKa determinants
|
||||
|
||||
@@ -186,8 +187,8 @@ def addDeterminants(iterative_interactions, version, options=None):
|
||||
done_group.append(group)
|
||||
|
||||
# Initialize iterative scheme
|
||||
if options.verbose == True:
|
||||
print("\n --- pKa iterations (%d groups, %d interactions) ---" % ( len(iteratives), len(iterative_interactions) ))
|
||||
debug("\n --- pKa iterations (%d groups, %d interactions) ---" %
|
||||
(len(iteratives), len(iterative_interactions)))
|
||||
converged = False
|
||||
iteration = 0
|
||||
# set non-iterative pka values as first step
|
||||
@@ -246,30 +247,30 @@ def addDeterminants(iterative_interactions, version, options=None):
|
||||
itres.pKa_iter.append(itres.pKa_new)
|
||||
|
||||
if iteration == 10:
|
||||
print("did not converge in %d iterations" % (iteration))
|
||||
info("did not converge in %d iterations" % (iteration))
|
||||
break
|
||||
|
||||
# --- Iterations finished ---
|
||||
|
||||
# printing pKa iterations
|
||||
if options.verbose == True:
|
||||
str = "%12s" % (" ")
|
||||
for index in range(0, iteration+1 ):
|
||||
# formerly was conditioned on if options.verbosity >= 2 - now unnecessary
|
||||
str = "%12s" % (" ")
|
||||
for index in range(0, iteration+1 ):
|
||||
str += "%8d" % (index)
|
||||
print(str)
|
||||
for itres in iteratives:
|
||||
debug(str)
|
||||
for itres in iteratives:
|
||||
str = "%s " % (itres.label)
|
||||
for pKa in itres.pKa_iter:
|
||||
str += "%8.2lf" % (pKa)
|
||||
if itres.converged == False:
|
||||
str += " *"
|
||||
print(str)
|
||||
debug(str)
|
||||
|
||||
# creating real determinants and adding them to group object
|
||||
for itres in iteratives:
|
||||
for type in ['sidechain','backbone','coulomb']:
|
||||
for interaction in itres.determinants[type]:
|
||||
#print('done',itres.group.label,interaction[0],interaction[1])
|
||||
#info('done',itres.group.label,interaction[0],interaction[1])
|
||||
value = interaction[1]
|
||||
if value > 0.005 or value < -0.005:
|
||||
g = interaction[0]
|
||||
|
||||
Reference in New Issue
Block a user