2020logger = logging .getLogger (__name__ )
2121
2222
23+ # Strategy used when create_alchemical_states gets no strategy_name
24+ DEFAULT_STRATEGY = "openff"
25+
26+
2327class FES :
2428 """
2529 A class to perform free energy calculations.
@@ -99,7 +103,7 @@ def __init__(
99103 self ._lambda_schedule : Dict [str , List [Union [float , None ]]] = None
100104 self ._alchemical_atoms : List [int ] = None
101105 self ._modifications_kwargs : Optional [Dict [str , Dict [str , Any ]]] = None
102- self ._strategy_name : str = "sire"
106+ self ._strategy_name : str = DEFAULT_STRATEGY
103107 self ._create_alchemical_states_args : Optional [Tuple [Any , ...]] = None
104108 self ._create_alchemical_states_kwargs : Optional [Dict [str , Any ]] = None
105109
@@ -339,7 +343,7 @@ def create_alchemical_states(
339343 lambda_schedule : Dict [str , List [Union [float , None ]]],
340344 alchemical_atoms : Optional [Union [List [int ], Dict [str , List [int ]]]] = None ,
341345 modifications_kwargs : Optional [Dict [str , Dict [str , Any ]]] = None ,
342- strategy_name : str = "sire" ,
346+ strategy_name : Optional [ str ] = None ,
343347 * args ,
344348 ** kwargs ,
345349 ) -> List [AlchemicalState ]:
@@ -364,9 +368,9 @@ def create_alchemical_states(
364368 },
365369 ...
366370 }
367- strategy_name : str, optional, default='sire '
368- The name of the strategy to create the alchemical state.
369- Available strategies are: "sire".
371+ strategy_name : str, optional, default='openff '
372+ The name of the strategy that builds the System: "openff" (SMILES or SDF input)
373+ or "sire" (Amber topology and coordinates in ``top_file`` and ``crd_file``) .
370374
371375 Returns
372376 -------
@@ -387,6 +391,15 @@ def create_alchemical_states(
387391 emle = kwargs .pop ("emle_kwargs" ) or {}
388392 modifications_kwargs ["EMLEPotential" ] = {** emle , ** modifications_kwargs .get ("EMLEPotential" , {})}
389393
394+ if strategy_name is None :
395+ sire_inputs = sorted (key for key in ("top_file" , "crd_file" ) if key in kwargs )
396+ if sire_inputs :
397+ # The default was "sire" before 0.3.0: do not send Amber files to OpenFF
398+ raise ValueError (
399+ f"{ sire_inputs } are inputs of the Sire strategy, and the default strategy is 'openff'. Pass strategy_name='sire'."
400+ )
401+ strategy_name = DEFAULT_STRATEGY
402+
390403 kwargs = dict (kwargs )
391404 shared_context = bool (kwargs .pop ("shared_context" , False ))
392405
0 commit comments