File driver.py
has 3977 lines of code (exceeds 250 allowed). Consider refactoring. Open
# coding=utf-8
"""
Drivers for Monte Carlo sampling of chemical states, such as tautomers and protomers.
"""
import copy
Function _update_forces
has a Cognitive Complexity of 129 (exceeds 5 allowed). Consider refactoring. Open
def _update_forces(
self,
titration_group_index,
final_titration_state_index,
initial_titration_state_index=None,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _add_xml_titration_groups
has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring. Open
def _add_xml_titration_groups(
self,
topology: app.Topology,
system: mm.System,
forcefield: app.ForceField,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _cache_force
has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring. Open
def _cache_force(self, titration_group_index, titration_state_index):
"""
Cache the force parameters for a single tautomer state.
Parameters
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function from_serialized_xml
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
def from_serialized_xml(cls, state_element):
"""
Deserialize a _TitrationState from a previously serialized xml tree
Parameters
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
NCMCProtonDrive
has 43 functions (exceeds 20 allowed). Consider refactoring. Open
class NCMCProtonDrive(_BaseDrive):
"""
The NCMCProtonDrive is a base class Monte Carlo driver for protonation state changes and tautomerism in OpenMM.
Protonation state changes, and additionally, tautomers are treated using the constant-pH dynamics method of Mongan, Case and McCammon [Mongan2004]_, or Stern [Stern2007]_ and NCMC methods from Nilmeier [Nilmeier2011]_.
Function _add_xml_titration_groups
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
def _add_xml_titration_groups(
self, topology, forcefield, ffxml_residues, selected_residue_indices
):
"""
Create tautomer groups for the selected residues in the topology, using ffxml information gathered earlier.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _cache_force
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def _cache_force(self, titration_group_index, titration_state_index):
"""
Cache the force parameters for a single titration state.
Parameters
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _perform_attempt
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def _perform_attempt(
self, attempt_data: _TitrationAttemptData, reject_on_nan: bool = False
):
"""
Attempt a single Monte Carlo protonation state change.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function update
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def update(
self,
proposal: _StateProposal,
residue_pool: Optional[str] = None,
nattempts: int = 1,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function __init__
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def __init__(
self,
temperature,
topology,
system,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function serialize
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def serialize(self, index=None):
"""Serialize a state into xml etree.
Returns
-------
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function __init__
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def __init__(
self,
temperature,
topology,
system,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _update_forces
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def _update_forces(
self,
titration_group_index,
final_titration_state_index,
initial_titration_state_index=None,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function __eq__
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def __eq__(self, other):
"""Compare the equality of two _TitrationState objects."""
if not isinstance(other, _TitrationState):
return False
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
_TitrationAttemptData
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class _TitrationAttemptData(object):
"""Private class for bookkeeping information regarding a single titration state update."""
def __init__(self):
"""Set up all internal variables for tracking."""
Function _perform_ncmc_protocol
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def _perform_ncmc_protocol(
self,
titration_group_indices: List[int],
initial_titration_states: List[int],
final_titration_states: List[int],
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _parse_fortran_namelist
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def _parse_fortran_namelist(filename, namelist_name):
"""
Parse a fortran namelist generated by AMBER 11 constant-pH python scripts.
Parameters
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function get_populations
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def get_populations(self, pH, temperature=None, ionic_strength=None, strict=True):
"""Return the state populations for a given pH.
Parameters
----------
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
_TitratableResidue
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class _TitratableResidue:
"""Representation of a single residue with multiple titration states."""
def __init__(self):
"""
Function import_gk_values
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def import_gk_values(self, gk_dict: Dict[str, np.ndarray], strict=False):
"""Import precalibrated gk values. Only use this if your simulation settings are exactly the same.
If you changed any details, rerun calibrate instead!
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _get14exceptions
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def _get14exceptions(self, system, particle_indices):
"""
Return a list of all 1,4 exceptions involving the specified particles that are not exclusions.
Parameters
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function from_xml
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def from_xml(cls, root: etree.Element):
"""Instantiate this object from xml."""
if not root.tag == "SAMSState":
raise ValueError(
"Wrong XML element provided. Expected 'SAMSState', got '{}'".format(
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function __eq__
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def __eq__(self, other):
for own_state, other_state in zip(
self.titration_states, other.titration_states
):
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function __init__
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __init__(
self,
temperature: unit.Quantity,
topology: app.Topology,
system: mm.System,
Function __init__
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function __init__
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function _parse_ffxml_files
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _parse_ffxml_files(self, ffxml_files):
"""
Read an ffxml file, or a list of ffxml files, and extract the residues that have Protons information.
Parameters
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function to_xml
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def to_xml(self) -> str:
"""Serialize this object to xml."""
root = etree.Element("SAMSState")
# Store the integer value of the SAMS approach
root.set("approach", str(self.approach.value))
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function __init__
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def __init__(
self,
state_counts: List[int],
approach: SAMSApproach,
group_index: Optional[int] = None,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _parse_ffxml_files
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _parse_ffxml_files(self, ffxml_files):
"""
Read an ffxml file, or a list of ffxml files, and extract the residues that have Protons information.
Parameters
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function __init__
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function _set14exceptions
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _set14exceptions(self, system):
"""
Collect all the NonbondedForce exceptions that pertain to 1-4 interactions.
Parameters
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function enable_neutralizing_ions
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def enable_neutralizing_ions(
self,
swapper: Swapper,
proposal: SaltSwapProposal = None,
neutral_charge_rule: NeutralChargeRule = NeutralChargeRule.REPLACEMENT_IONS,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function __init__
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def __init__(
self,
temperature: unit.Quantity,
topology: app.Topology,
system: mm.System,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function enable_calibration
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def enable_calibration(
self,
approach: SAMSApproach,
group_index: Optional[int] = None,
update_rule: UpdateRule = UpdateRule.BINARY,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function from_serialized_xml
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def from_serialized_xml(cls, xmltree):
"""Create a titratable residue from a serialized titratable residue.
Parameters
----------
Function enable_calibration
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def enable_calibration(
Function __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function from_lists
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def from_lists(
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function _set_state_reject_attempt
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def _set_state_reject_attempt(
Function _add_titration_state
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def _add_titration_state(
Avoid deeply nested control flow statements. Open
for parameter_name in ["length", "k"]:
# generate new, interpolated parameters
bond[parameter_name] = (1.0 - scale) * float(
bond_initial[parameter_name]
) + scale * float(bond_final[parameter_name])
Avoid deeply nested control flow statements. Open
for parameter_name in ["chargeProd", "sigma", "epsilon"]:
exc[parameter_name] = (
(1.0 - fractional_titration_state)
* exc_initial[parameter_name]
+ fractional_titration_state * exc_final[parameter_name]
Avoid deeply nested control flow statements. Open
for parameter_name in ["angle", "k"]:
angle[parameter_name] = (1.0 - scale) * float(
angle_initial[parameter_name]
) + scale * float(angle_final[parameter_name])
else:
Function from_lists
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def from_lists(
Avoid deeply nested control flow statements. Open
for parameter_name in ["sigma", "epsilon", "charge"]:
atom[parameter_name] = atom_initial[parameter_name]
Avoid deeply nested control flow statements. Open
if fractional_titration_state <= 0.5:
scaling = 1.0 - (2 * fractional_titration_state)
else:
scaling = 0.0
new_k = scaling * float(
Avoid deeply nested control flow statements. Open
if param_value is not None:
atom_dict[key] = np.float64(param_value)
force_dict["atoms"].append(atom_dict)
Avoid deeply nested control flow statements. Open
for i, atom in enumerate(movable_atoms):
new_vel = np.random.normal(size=3) * unit.sqrt(variances[i])
vel[i, :] = new_vel[:]
self.context.setVelocities(vel)
Avoid deeply nested control flow statements. Open
for k in cooh_names:
if k not in cooh_indices:
not_found.append(k)
raise KeyError(
Avoid deeply nested control flow statements. Open
if fractional_titration_state <= 0.5:
scaling = 0.0
else:
scaling = 2 * (fractional_titration_state - 0.5)
new_k = scaling * float(
Avoid deeply nested control flow statements. Open
for parameter_name in ["charge"]:
# if charges are decresed they should decrease faster to avoid unshielded charges
scale = fractional_titration_state
if float(atom_final["charge"]) < float(
atom_initial["charge"]
Avoid deeply nested control flow statements. Open
for parameter_name in ["length", "k"]:
# use old parameters
bond[parameter_name] = bond_initial[parameter_name]
# set new parameters using atom indices
Function set_titration_state
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def set_titration_state(
self,
titration_group_index: int,
titration_state_index: int,
updateContextParameters: bool = True,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid deeply nested control flow statements. Open
for parameter_name in ["sigma", "epsilon"]:
scale = fractional_titration_state
# if charges increase epsilon and sigma have to increase faster to shield charges
if float(atom_final["charge"]) > float(
atom_initial["charge"]
Avoid deeply nested control flow statements. Open
for parameter_name in ["angle", "k"]:
# use old parameters
angle[parameter_name] = float(angle_initial[parameter_name])
Function __init__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __init__(
self,
temperature: unit.Quantity,
topology: app.Topology,
system: mm.System,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _update_forces
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _update_forces(
Function _add_xml_titration_groups
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _add_xml_titration_groups(
Function _add_titration_state
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _add_titration_state(
Function _add_titratable_group
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _add_titratable_group(
Function define_pools
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def define_pools(self, dict_of_pools):
"""
Specify named residue_pools/subgroups of residues that can be sampled from separately.
For instance, it might be useful to separate the protein from the ligand so you can sample the
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _set_state_accept_attempt
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _set_state_accept_attempt(
self,
initial_titration_states,
final_titration_states,
titration_group_indices,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _set_state_reject_attempt
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _set_state_reject_attempt(
self,
initial_titration_states: List[int],
final_titration_states: List[int],
titration_group_indices: List[int],
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this function. Open
return False
Avoid too many return
statements within this function. Open
return False
Avoid too many return
statements within this function. Open
return False
Avoid too many return
statements within this function. Open
return True
Avoid too many return
statements within this function. Open
return False
Avoid too many return
statements within this function. Open
return True
Avoid too many return
statements within this function. Open
return False
Avoid too many return
statements within this function. Open
return False
Avoid too many return
statements within this function. Open
return False
Function observed
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def observed(self, titration_states: List[int]) -> np.float64:
"""Return the histogram count for the supplied state."""
# In case of the one site sams approach, the sams weight is the total weight of every titration state
counts = None
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function free_energy
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def free_energy(self, titration_states: List[int]) -> float:
"""Return the sams free energy value for the provided titration state.
Parameters
----------
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function from_lists
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def from_lists(
cls,
g_k,
parameters,
proton_count,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _propose_random_change
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _propose_random_change(
self, proposal: _StateProposal, residue_pool: Optional[str] = None
) -> _TitrationAttemptData:
"""Use a given proposal mechanism to propose a titration state update for a given group of residues."""
# Select which titratible residues to update.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function from_lists
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def from_lists(
cls,
g_k: float,
charges: List[float],
proton_count: int,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function from_serialized_xml
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def from_serialized_xml(cls, xmltree):
"""Create a titratable residue from a serialized titratable residue.
Parameters
----------
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function target
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def target(self, titration_states: List[int]) -> np.float64:
"""Return the target weight for the supplied state."""
# In case of the one site sams approach, the sams weight is the total weight of every titration state
weight = None
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"