Esempio n. 1
0
#################
###########################
##### Initial housekeeping - make the directory your experiment will be in, and subdirectories for each replicate:

setup.directorymaker(logger, targetdir)
setup.directorymaker(logger, '{0}{1}/'.format(targetdir, 'fullpostfiles'))
setup.directorymaker(logger, '{0}{1}/'.format(targetdir, 'truncpostfiles'))

#####First we'll calculate your isotherm and write a pressure.dat file in your target directory
satP = setup.pSat(logger, species[-1], T)
istm = setup.isothermcalculator(logger, satP, iso_length, minrelpress, maxrelpress)
setup.PressureFileWriter(logger, species[-1], T, satP, istm, targetdir) #goes in the directory above your individual one, gets symbolic linked later

##### Now to make some control files for you
setup.GcmcControlChanger(logger, species[-1], sorb_el_list, T, n, framework, '{0}'.format(targetdir), n_iterations, restart, ctrl_file_name, pressure)
for i, value in enumerate(istm): #now I make the extra .ctr files to give you final .xyz files for each simulaiton
    setup.GcmcControlChanger(logger, species[-1], sorb_el_list, T, '1', framework, '{0}'.format(targetdir), '1', 'RESTARTFILE {0}.{1}.res.{2}'.format(framework, species[-1], i+1), '{0}kpa_restart.ctr'.format(value), value) #makes your control files for all of your pressure points
setup.PostControlChanger(logger, species[-1], T, n, framework, '{0}'.format(targetdir), '0')
setup.PostControlChanger(logger, species[-1], T, n, framework, '{0}'.format(targetdir), '60')
setup.GcmcRunWriter(logger, species[-1], T, framework, parentdir, '{0}'.format(targetdir), istm, '')#the last variable is the relative location of your interactions files
setup.AtmAtmMover(logger, sorb_el_list, forcefield, coultype, hicut, frameowrk, 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} which will run your simulation.
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 in {0}.
Esempio n. 2
0
            f, '{0}/{1:02d}/archive/{2}'.format(targetdir, directory,
                                                f.split('/')[-1]))
    for f in glob.glob(r'{0}/{1:02d}/*.xyz'.format(targetdir, directory)):
        print(f)
        os.rename(
            f, '{0}/{1:02d}/archive/{2}'.format(targetdir, directory,
                                                f.split('/')[-1]))

    #setup.GcmcControlChanger(logger, species[-1], sorb_el_list, T, iso_length, framework, '{0}/{1:02d}/'.format(targetdir, directory), n_iterations, restart, ctrl_file_name, pressure)
    for i, value in enumerate(
            istm, 1
    ):  #now I make the extra .ctr files to give you final .xyz files for each simulaiton
        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,
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 = ['DMFYang']
sorb_el_list = ['AldH_s', 'O_s', 'Carb_s', 'C_s', 'N_s', 'H_s']
framework = 'IRMOF1'
T = 298
n = 9
targetdir = Path('{0}/{1:02d}/'.format(xptpath, directory))
##################
setup.GcmcControlChanger(
    logger, species[-1], sorb_el_list, T, n, framework, targetdir, '1000000'
)  #, 'RESTARTFILE {0}.{1}.res.{2}'.format(framework, species[-1], 20)) #for production runs, these 3 optional extra arguments are for running restarts.
#for i, value in enumerate(istm): #now i make the extra .ctr files for yoru subdirectories
#    setup.GcmcControlChanger(logger, species[-1], sorb_el_list, T, 1, framework, targetdir, '1', 'RESTARTFILE {0}.{1}.res.{2}'.format(framework, species[-1], i+1), '{0}kpa_restart.ctr'.format(value), value) #makes your control files for all of your pressure points