# Path: perses/dispersed/feptasks.py
# class Particle():
#     def __init__(self,
#                  thermodynamic_state,
#                  sampler_state,
#                  nsteps,
#                  direction,
#                  splitting = 'V R O R V',
#                  temperature = 300*unit.kelvin,
#                  collision_rate = np.inf/unit.picoseconds,
#                  timestep = 1.0*unit.femtosecond,
#                  work_save_interval = None,
#                  top = None,
#                  subset_atoms = None,
#                  save_configuration = False,
#                  lambda_protocol = 'default',
#                  measure_shadow_work = False,
#                  label = None,
#                  trajectory_filename  = None):
#     def anneal(self, new, num_integration_steps = 1):
#     def attempt_termination(self):
#     def compute_incremental_work(self, _lambda):
#     def save_configuration(self, iteration):
#     def launch_particle(task):
#     def distribute_anneal(task, new, num_integration_steps = 1):
#     def update_incremental_work(task, index):
#     def pull_sampler_state(task):
#     def pull_cumulative_work(task):
#     def pull_cumulative_work_profile(task):
#     def pull_work_increments(task):
#     def pull_current_lambda(task):
#     def pull_shadow_work(task):
#     def pull_timers(task):
#     def pull_success(task):
#     def pull_labels(task):
#     def pull_last_label(task):
#     def push_resamples(task, sampler_state, label, work):
#     def push_cumulative_work(task, work):
#     def check_NonequilibriumFEPTask(task):
#     def write_nonequilibrium_trajectory(nonequilibrium_trajectory, trajectory_filename):
# def check_EquilibriumFEPTask(task):
# def minimize(thermodynamic_state: states.ThermodynamicState, sampler_state: states.SamplerState,
#              max_iterations: int=100) -> states.SamplerState:
# def compute_reduced_potential(thermodynamic_state: states.ThermodynamicState, sampler_state: states.SamplerState) -> float:
# def write_nonequilibrium_trajectory(nonequilibrium_trajectory, trajectory_filename) -> float:
# def write_equilibrium_trajectory(trajectory: md.Trajectory, trajectory_filename: str) -> float:
# def compute_nonalchemical_perturbation(alchemical_thermodynamic_state: states.ThermodynamicState,  growth_thermodynamic_state: states.ThermodynamicState, hybrid_sampler_state: states.SamplerState, hybrid_factory: HybridTopologyFactory, nonalchemical_thermodynamic_state: states.ThermodynamicState, lambda_state: int) -> tuple:
# def compute_timeseries(reduced_potentials: np.array) -> list:
# def run_equilibrium(task):
# 
# Path: perses/app/setup_relative_calculation.py
# class TimeFilter(logging.Filter):
#     def filter(self, record):
# def getSetupOptions(filename):
# def get_openmm_platform(platform_name=None):
# def run_setup(setup_options, serialize_systems=True, build_samplers=True):
# def run(yaml_filename=None):
# def _resume_run(setup_options):
# LOGLEVEL = os.environ.get("LOGLEVEL", "INFO").upper()
# ENERGY_THRESHOLD = 1e-4
#                 LSF = setup_options['LSF']


import os
import mdtraj as md
            import traceback
            import warnings
            import traceback
            import warnings
from pkg_resources import resource_filename
from simtk import unit
from perses.dispersed import feptasks
from perses.app import setup_relative_calculation
from openmmtools import states, alchemy, testsystems, cache
from unittest import skipIf
    from perses.tests.utils import enter_temp_directory
        from perses.app.setup_relative_calculation import getSetupOptions
    from perses.tests.utils import enter_temp_directory
        from perses.app.setup_relative_calculation import getSetupOptions
    from perses.app.relative_setup import RelativeFEPSetup

        # Setup directory
        setup_directory = resource_filename("perses", "data/bace-example")
        print(f'Setup directory : {setup_directory}')

        # Get options
        yaml_filename = os.path.join(setup_directory, "bace_setup.yaml")
        setup_options = getSetupOptions(yaml_filename)

        # DEBUG: Print traceback for any UserWarnings
        show_warning_stacktraces = False
        if show_warning_stacktraces:
            _old_warn = warnings.warn
            def warn(*args, **kwargs):
                tb = traceback.extract_stack()
                _old_warn(*args, **kwargs)
                print("".join(traceback.format_list(tb)[:-1]))
            warnings.warn = warn

        setup_options['scheduler_address'] = None
        for parameter in ['protein_pdb', 'ligand_file']:
            setup_options[parameter] = os.path.join(setup_directory, setup_options[parameter])
            # only one spectator
            setup_options['spectators'] = [ os.path.join(setup_directory, setup_options['spectators'][0])]
        for parameter in ['trajectory_directory', 'trajectory_prefix', 'save_setup_pickle_as']:
            setup_options[parameter] = os.path.join(tmpdirname, setup_options[parameter])


        # Run setup
        n_iterations = 2

# Path: perses/dispersed/feptasks.py
# class Particle():
#     def __init__(self,
#                  thermodynamic_state,
#                  sampler_state,
#                  nsteps,
#                  direction,
#                  splitting = 'V R O R V',
#                  temperature = 300*unit.kelvin,
#                  collision_rate = np.inf/unit.picoseconds,
#                  timestep = 1.0*unit.femtosecond,
#                  work_save_interval = None,
#                  top = None,
#                  subset_atoms = None,
#                  save_configuration = False,
#                  lambda_protocol = 'default',
#                  measure_shadow_work = False,
#                  label = None,
#                  trajectory_filename  = None):
#     def anneal(self, new, num_integration_steps = 1):
#     def attempt_termination(self):
#     def compute_incremental_work(self, _lambda):
#     def save_configuration(self, iteration):
#     def launch_particle(task):
#     def distribute_anneal(task, new, num_integration_steps = 1):
#     def update_incremental_work(task, index):
#     def pull_sampler_state(task):
#     def pull_cumulative_work(task):
#     def pull_cumulative_work_profile(task):
#     def pull_work_increments(task):
#     def pull_current_lambda(task):
#     def pull_shadow_work(task):
#     def pull_timers(task):
#     def pull_success(task):
#     def pull_labels(task):
#     def pull_last_label(task):
#     def push_resamples(task, sampler_state, label, work):
#     def push_cumulative_work(task, work):
#     def check_NonequilibriumFEPTask(task):
#     def write_nonequilibrium_trajectory(nonequilibrium_trajectory, trajectory_filename):
# def check_EquilibriumFEPTask(task):
# def minimize(thermodynamic_state: states.ThermodynamicState, sampler_state: states.SamplerState,
#              max_iterations: int=100) -> states.SamplerState:
# def compute_reduced_potential(thermodynamic_state: states.ThermodynamicState, sampler_state: states.SamplerState) -> float:
# def write_nonequilibrium_trajectory(nonequilibrium_trajectory, trajectory_filename) -> float:
# def write_equilibrium_trajectory(trajectory: md.Trajectory, trajectory_filename: str) -> float:
# def compute_nonalchemical_perturbation(alchemical_thermodynamic_state: states.ThermodynamicState,  growth_thermodynamic_state: states.ThermodynamicState, hybrid_sampler_state: states.SamplerState, hybrid_factory: HybridTopologyFactory, nonalchemical_thermodynamic_state: states.ThermodynamicState, lambda_state: int) -> tuple:
# def compute_timeseries(reduced_potentials: np.array) -> list:
# def run_equilibrium(task):
# 
# Path: perses/app/setup_relative_calculation.py
# class TimeFilter(logging.Filter):
#     def filter(self, record):
# def getSetupOptions(filename):
# def get_openmm_platform(platform_name=None):
# def run_setup(setup_options, serialize_systems=True, build_samplers=True):
# def run(yaml_filename=None):
# def _resume_run(setup_options):
# LOGLEVEL = os.environ.get("LOGLEVEL", "INFO").upper()
# ENERGY_THRESHOLD = 1e-4
#                 LSF = setup_options['LSF']


# Path: perses/tests/test_relative_setup.py
import os
import mdtraj as md
            import traceback
            import warnings
            import traceback
            import warnings
from pkg_resources import resource_filename
from simtk import unit
from perses.dispersed import feptasks
from perses.app import setup_relative_calculation
from openmmtools import states, alchemy, testsystems, cache
from unittest import skipIf
    from perses.tests.utils import enter_temp_directory
        from perses.app.setup_relative_calculation import getSetupOptions
    from perses.tests.utils import enter_temp_directory
        from perses.app.setup_relative_calculation import getSetupOptions
    from perses.app.relative_setup import RelativeFEPSetup


        # Setup directory
        setup_directory = resource_filename("perses", "data/bace-example")
        print(f'Setup directory : {setup_directory}')

        # Get options
        yaml_filename = os.path.join(setup_directory, "bace_setup.yaml")
        setup_options = getSetupOptions(yaml_filename)

        # DEBUG: Print traceback for any UserWarnings
        show_warning_stacktraces = False
        if show_warning_stacktraces:
            _old_warn = warnings.warn
            def warn(*args, **kwargs):
                tb = traceback.extract_stack()
                _old_warn(*args, **kwargs)
                print("".join(traceback.format_list(tb)[:-1]))
            warnings.warn = warn

        setup_options['scheduler_address'] = None
        for parameter in ['protein_pdb', 'ligand_file']:
            setup_options[parameter] = os.path.join(setup_directory, setup_options[parameter])
            # only one spectator
            setup_options['spectators'] = [ os.path.join(setup_directory, setup_options['spectators'][0])]
        for parameter in ['trajectory_directory', 'trajectory_prefix', 'save_setup_pickle_as']:
            setup_options[parameter] = os.path.join(tmpdirname, setup_options[parameter])


        # Run setup
        n_iterations = 2

        setup_dict = setup_relative_calculation.run_setup(setup_options)