INNER CODE UNIT · Python
switchstate
Electrostatics/pdb2pqr · pdb2pqr/hydrogens/__init__.py:106
def switchstate(self, states, amb, state_id):
"""Switch a residue to a new state by first removing all hydrogens.
:param states: the list of states
:type states: list
:param amb: the amibiguity to switch
:type amb: tup
:param state_id: the state id to switch to
:type state_id: int
"""
if states == "pKa":
return self.pka_switchstate(amb, state_id)
if state_id > len(states):
raise IndexError("Invalid State ID!")
# First Remove all Hs
residue = amb.residue