@@ -138,23 +138,16 @@ def _execute(self, ctx, *, protocol, state_a, state_b, mapping, **inputs):
138138 )
139139 from feflow .utils .hybrid_topology import HybridTopologyFactory
140140 from feflow .utils .charge import get_alchemical_charge_difference
141- from feflow .utils .misc import (
142- get_typed_components ,
143- register_ff_parameters_template ,
144- )
141+ from feflow .utils .misc import register_ff_parameters_template
145142
146143 # Check compatibility between states (same receptor and solvent)
147144 self ._check_states_compatibility (state_a , state_b )
148145
149146 # Get receptor components from systems if found (None otherwise)
150- solvent_comps = get_typed_components (
151- state_a , SolventComponent
152- ) # this returns a set
153- solvent_comp_a = (
154- solvent_comps .pop () if solvent_comps else None
155- ) # Get the first component if exists
156- protein_comps_a = get_typed_components (state_a , ProteinComponent )
157- small_mols_a = get_typed_components (state_a , SmallMoleculeComponent )
147+ solvent_comps = state_a .get_components_of_type (SolventComponent )
148+ solvent_comp_a = solvent_comps .pop () if solvent_comps else None # there must be at most one solvent comp
149+ protein_comps_a = state_a .get_components_of_type (ProteinComponent )
150+ small_mols_a = state_a .get_components_of_type (SmallMoleculeComponent )
158151
159152 # Get alchemical components
160153 alchemical_comps = get_alchemical_components (state_a , state_b )
@@ -187,10 +180,9 @@ def _execute(self, ctx, *, protocol, state_a, state_b, mapping, **inputs):
187180 # Parameterizing small molecules
188181 self .logger .info ("Parameterizing molecules" )
189182 # Get small molecules from states
190- # TODO: Refactor if/when gufe provides the functionality https://github.com/OpenFreeEnergy/gufe/issues/251
191- state_a_small_mols = get_typed_components (state_a , SmallMoleculeComponent )
192- state_b_small_mols = get_typed_components (state_b , SmallMoleculeComponent )
193- all_small_mols = state_a_small_mols | state_b_small_mols
183+ state_a_small_mols = state_a .get_components_of_type (SmallMoleculeComponent )
184+ state_b_small_mols = state_b .get_components_of_type (SmallMoleculeComponent )
185+ all_small_mols = set (state_a_small_mols ) | set (state_b_small_mols )
194186
195187 # Generate and register FF parameters in the system generator template
196188 all_openff_mols = [comp .to_openff () for comp in all_small_mols ]
0 commit comments