try:
            rec_restraints = receptor_restraints['active'] + receptor_restraints['passive']
        except:
            pass

        lig_restraints = None
        try:
            lig_restraints = ligand_restraints['active'] + ligand_restraints['passive']
        except:
            pass

        # Calculate surface points (swarm centers) over receptor structure
        starting_points_files = calculate_starting_positions(receptor, ligand, 
                                                             args.swarms, args.glowworms, 
                                                             args.starting_points_seed,
                                                             rec_restraints, lig_restraints,
                                                             rec_translation, lig_translation,
                                                             args.ftdock_file, args.use_anm, args.anm_seed,
                                                             args.anm_rec, args.anm_lig, args.membrane)
        if len(starting_points_files) != args.swarms:
            args.swarms = len(starting_points_files)
            log.info('Number of swarms is %d after applying restraints' % args.swarms)

        # Create simulation folders
        prepare_results_environment(args.swarms)

        # Dump to a setup file the actual configuration
        create_setup_file(args)

        log.info("LightDock setup OK")
            rec_restraints = receptor_restraints[
                'active'] + receptor_restraints['passive']
        except:
            pass

        lig_restraints = None
        try:
            lig_restraints = ligand_restraints['active'] + ligand_restraints[
                'passive']
        except:
            pass

        # Calculate surface points (swarm centers) over receptor structure
        starting_points_files = calculate_starting_positions(
            receptor, ligand, args.swarms, args.glowworms,
            args.starting_points_seed, rec_restraints, lig_restraints,
            rec_translation, lig_translation, args.ftdock_file, args.use_anm,
            args.anm_seed, args.anm_rec, args.anm_lig, args.membrane)
        if len(starting_points_files) != args.swarms:
            args.swarms = len(starting_points_files)
            log.info('Number of swarms is %d after applying restraints' %
                     args.swarms)

        # Create simulation folders
        prepare_results_environment(args.swarms)

        # Dump to a setup file the actual configuration
        create_setup_file(args)

        log.info("LightDock setup OK")
            )
            log.info(
                f"Number of ligand restraints is: {num_lig_active} (active), {num_lig_passive} (passive)"
            )

        try:
            lig_restraints = ligand_restraints['active'] + ligand_restraints[
                'passive']
        except (KeyError, TypeError):
            lig_restraints = None

        # Calculate surface points (swarm centers) over receptor structure
        starting_points_files = calculate_starting_positions(
            receptor, ligand, args.swarms, args.glowworms,
            args.starting_points_seed, receptor_restraints, lig_restraints,
            rec_translation, lig_translation, args.surface_density,
            args.use_anm, args.anm_seed, args.anm_rec, args.anm_lig,
            args.membrane, args.transmembrane, args.write_starting_positions,
            args.swarm_radius)
        if len(starting_points_files) != args.swarms:
            args.swarms = len(starting_points_files)
            log.info(f"Number of calculated swarms is {args.swarms}")

        # Create simulation folders
        prepare_results_environment(args.swarms)

        # Dump to a setup file the actual configuration
        create_setup_file(args)

        log.info("LightDock setup OK")