for j in range(workingdir, workingdir+n_per_species):
	    satP = setup.pSat(logger, species[i], T)
        istm = setup.isothermcalculator(logger, satP, iso_length, minrelpress, maxrelpress)
        setup.PressureFileWriter(logger, species[i], T, satP, istm, '{0}{1:02d}/'.format(targetdir, j)) #goes in the directory above your individual one, gets symbolic linked later
    workingdir += n_per_species

##### Now to make some control files for you
workingdir = 1
for i in range(1, n_species+1):
	for directory in range(workingdir, workingdir+n_per_species):
        setup.GcmcControlChanger(logger, species[i], sorb_el_list, T, n, framework, '{0}{1:02d}/'.format(targetdir, directory), n_iterations, restart, ctrl_file_name, pressure)
        for j, value in enumerate(istm): #now I make the extra .ctr files to give you final .xyz files for each simulaiton
            setup.GcmcControlChanger(logger, species[i], sorb_el_list, T, '1', framework, '{0}{1:02d}/'.format(targetdir, directory), '1', 'RESTARTFILE {0}.{1}.res.{2}'.format(framework, species[-1], j+1), '{0}kpa_restart.ctr'.format(value), value) #makes your control files for all of your pressure points
        setup.PostControlChanger(logger, species[i], T, n, framework, '{0}{1:02d}/'.format(targetdir, directory), '0')
        setup.PostControlChanger(logger, species[i], T, n, framework, '{0}{1:02d}/'.format(targetdir, directory), '60')
        setup.GcmcRunWriter(logger, species[i], T, framework, parentdir, '{0}{1:02d}/'.format(targetdir, directory), istm, '')#the last variable is the relative location of your interactions files
        setup.AtmAtmMover(logger, sorb_el_list, forcefield, coultype, hicut, frameowrk, '{0}{1:02d}/'.format(targetdir, directory))
        setup.SorbSorbWriter(logger, species[i], sorb_el_list,framework,'{0}{1:02d}/'.format(targetdir, directory), pmap, emap)
        setup.IntraWriter(logger, species[i], sorb_el_list, framework, '{0}{1:02d}/'.format(targetdir, directory))

setup.TaskfarmRunWriter(logger, 'multiple', T, framework, parentdir, targetdir, Taskfarm_total)


logger.info('''
##################################################################
So I've done the following:
Created the directory {0} and {1} subdirectories for taskfarming.
Calculated and written isotherms for all {2} species you've got, {3} times over each.
Created a gcmc.ctr file, 2 post control files, and a run.gcmc file for each subdirectory.
Created a taskfarm document and a backup, and finally run.taskfarmer in {0}. It might complain about not having a python script, but don't worry about that.
Finally I wrote an atom_atom_file, sorb_sorb_file, and intramolecular_file into each subdirectory.
        print(i)
        setup.GcmcControlChanger(
            logger, species[-1], sorb_el_list, T, '1', framework,
            '{0}/{1:02d}/'.format(targetdir, directory), n_iterations,
            'RESTARTFILE {0}.{1}.res.{2}'.format(framework, species[-1], i),
            '{0}kpa_restart.ctr'.format(value), value,
            i)  #makes your control files for all of your pressure points
    setup.PostControlChanger(logger, species[-1], iso_length, framework,
                             '{0}/{1:02d}/'.format(targetdir,
                                                   directory), directory, '0')
    setup.PostControlChanger(logger, species[-1], iso_length, framework,
                             '{0}/{1:02d}/'.format(targetdir,
                                                   directory), directory, '60')
    setup.GcmcRunWriter(
        logger, species[-1], T, framework, parentdir,
        '{0}/{1:02d}/'.format(targetdir, directory), istm, directory,
        Intfilelocation, atomfilelocation, molfilelocation, mapfilelocation
    )  #the last variable is the relative location of your interactions files
#setup.IsothermExtractMover(logger, species[-1], T, framework, targetdir, iso_length)
setup.TaskfarmRunWriter(logger, species[-1], T, framework, parentdir,
                        targetdir)
#setup.AtmAtmMover(logger, sorb_el_list, forcefield, coultype, hicut, framework, targetdir)
#setup.SorbSorbWriter(logger, species[-1], sorb_el_list,framework,targetdir, pmap, emap)
#setup.IntraWriter(logger, species[-1], sorb_el_list, framework, targetdir)

logger.info('''
##################################################################
So I've done the following:
Created the directory {0} and 16 subdirectories for taskfarming.
Calculated and written an isotherm between {1} and {2} kPa, then placed in it in {0}.
Created a gcmc.ctr file, 2 post control files, and a run.gcmc file for each subdirectory.
import argparse

import musicpy.setup as setup
import musicpy.Antoine as Antoine
import musicpy.Forcefield as Forcefield
now = datetime.datetime.now()
#################
####This section sorts out your messages from this script to the console and a log file
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
handler = logging.FileHandler('{0}/sorb_sorb_maker.log'.format('.'))
handler.setLevel(logging.DEBUG)
handler2 = logging.StreamHandler()
handler2.setLevel(logging.INFO)
logger.addHandler(handler)
logger.addHandler(handler2)
logger.debug('-----------------------------------')
logger.debug('Generating new files on {0}-{1}-{2} at {3}:{4}'.format(
    now.year, now.month, now.day, now.hour, now.minute))
logger.debug('-----------------------------------')
##################
species = ['XXXX']
T = 298
framework = 'YYYY'
istm = ['''### your pressure points here###''']
parentdir = Path('/home/r/jrhm21/scratch/03_music_chloroform_forcefield/')
targetdir = Path('./experiments/{0}/{1}/'.format(species[-1], T))
####################
setup.GcmcRunWriter(logger, species[-1], T, framework, parentdir, targetdir,
                    istm)