Exemplo n.º 1
0
def fitpred_new(pop, Optimizer):
    """Predator function to identify similar structures based on energy and replace one with new structure.
    """
    fitlist = [one.fitness for one in pop]
    nfitlist, nindices = remove_duplicates(fitlist, Optimizer.demin)
    STR = ''
    newpop = []
    if len(nfitlist) != len(fitlist):
        STR += 'Predator: Removed total of ' + repr(
            len(fitlist) - len(nfitlist)) + ' from population\n'
    otherlist = []
    for i in range(len(pop)):
        if i not in nindices:
            STR += 'Predator: Removed ' + repr(pop[i].history_index) + '\n'
            otherlist.append(pop[i])
        else:
            newpop.append(pop[i])
    while len(newpop) < Optimizer.nindiv:
        if Optimizer.structure == 'Defect' or Optimizer.structure == 'Cluster':
            ind = gen_pop_box(Optimizer.atomlist, Optimizer.size)
        elif Optimizer.structure == 'Crystal':
            outts = gen_pop_box(Optimizer.atomlist, Optimizer.size,
                                Optimizer.cell_shape_options)
            ind = outts[0]
        elif Optimizer.structure == 'Surface':
            mutopto = Optimizer.mutation_options
            Optimizer.mutation_options = ['Lattice_Alteration_rdrd']
            topind = random.choice(pop)[0].copy()
            ind, scheme = moves_switch(topind, Optimizer)
            Optimizer.mutation_options = mutopto
        individ = Individual(ind)
        #CHECK THIS LATER!! MAY NEED TO ADD MORE PROPERTIES!!
        individ.energy = 1000
        individ.fitness = 1000
        newpop.append(individ)
        STR += 'Predator: Adding mutated duplicates to new pop history=' + individ.history_index + '\n'
        nindices.append(individ.index)
    nindices.sort()
    if Optimizer.natural_selection_scheme == 'fussf':
        for ind in newpop:
            if ind.fingerprint == 0:
                ind.fingerprint = get_fingerprint(Optimizer, ind,
                                                  Optimizer.fpbin,
                                                  Optimizer.fpcutoff)
    if 'lambda,mu' in Optimizer.algorithm_type:
        try:
            mark = [
                index for index, n in enumerate(nindices)
                if n > Optimizer.nindiv - 1
            ][0]
        except:
            mark = Optimizer.nindiv
        Optimizer.mark = mark
        pop, str1 = lambdacommamu.lambdacommamu(newpop, Optimizer)
        STR += str1
    else:
        pop = selection_switch(newpop, Optimizer.nindiv,
                               Optimizer.natural_selection_scheme, Optimizer)
    pop = get_best(pop, len(pop))
    return pop, STR
Exemplo n.º 2
0
def fitpred_bests(pop,Optimizer):
    """Predator function to identify similar structures based on energy and replace one 
    with structure from BESTS List.
    """
    fitlist = [one.fitness for one in pop]
    nfitlist, nindices = remove_duplicates(fitlist, Optimizer.demin)
    STR = ''
    newpop = []
    if len(nfitlist) != len(fitlist):
        STR+='Predator: Removed total of '+repr(len(fitlist)-len(nfitlist))+' from population\n'
    otherlist = []
    for i in range(len(pop)):
        if i not in nindices:
            STR+='Predator: Removed '+repr(pop[i].history_index)+'\n'
            otherlist.append(pop[i])
        else:
            newpop.append(pop[i])
    count = 0
    while len(newpop) < Optimizer.nindiv:
        try:
            Optimizer.BESTS
        except:
            Optimizer.BESTS=[]
        if len(Optimizer.BESTS) > 0:
            idx = random.choice(range(len(Optimizer.BESTS)))
            newpop.append(Optimizer.BESTS[idx])
            STR+='Predator: Adding in structure from Best List from position = {0} with fitness = {1}\n'.format(idx,Optimizer.BESTS[idx].fitness)
            newindices.append(len(pop)+count)
            count+=1
        else:
            indiv = random.choice(otherlist).duplicate()
            indiv, scheme = moves_switch(indiv,Optimizer)
            indiv.energy = 1000
            indiv.fitness = 1000
            newpop.append(indiv)
            STR+='Predator: Adding mutated duplicates to new pop history='+indiv.history_index+'\n'
            nindices.append(indiv.index)
    nindices.sort()
    if Optimizer.natural_selection_scheme=='fussf':
        for ind in newpop:
            if ind.fingerprint == 0:
                ind.fingerprint = get_fingerprint(Optimizer,ind,Optimizer.fpbin,Optimizer.fpcutoff)
    if 'lambda,mu' in Optimizer.algorithm_type:
        try:
            mark = [ index for index,n in enumerate(nindices) if n > Optimizer.nindiv-1][0]
        except:
            mark = Optimizer.nindiv
        Optimizer.mark = mark
        pop, str1 = lambdacommamu.lambdacommamu(newpop, Optimizer)
        STR+=str1
    else:
        pop = selection_switch(newpop, Optimizer.nindiv, Optimizer.natural_selection_scheme, Optimizer)
    pop = get_best(pop,len(pop))
    return pop, STR
Exemplo n.º 3
0
def fitpred_new(pop,Optimizer):
    """Predator function to identify similar structures based on energy and replace one with new structure.
    """
    fitlist = [one.fitness for one in pop]
    nfitlist, nindices = remove_duplicates(fitlist, Optimizer.demin)
    STR = ''
    newpop = []
    if len(nfitlist) != len(fitlist):
        STR+='Predator: Removed total of '+repr(len(fitlist)-len(nfitlist))+' from population\n'
    otherlist = []
    for i in range(len(pop)):
        if i not in nindices:
            STR+='Predator: Removed '+repr(pop[i].history_index)+'\n'
            otherlist.append(pop[i])
        else:
            newpop.append(pop[i])
    while len(newpop) < Optimizer.nindiv:
        if Optimizer.structure=='Defect' or Optimizer.structure=='Cluster':
            ind=gen_pop_box(Optimizer.atomlist,Optimizer.size)
        elif Optimizer.structure=='Crystal':
            outts=gen_pop_box(Optimizer.atomlist,Optimizer.size,Optimizer.cell_shape_options)
            ind=outts[0]
        elif Optimizer.structure=='Surface':
            mutopto=Optimizer.mutation_options
            Optimizer.mutation_options=['Lattice_Alteration_rdrd']
            topind=random.choice(pop)[0].copy()
            ind, scheme = moves_switch(topind,Optimizer)
            Optimizer.mutation_options=mutopto
        individ=Individual(ind)
        #CHECK THIS LATER!! MAY NEED TO ADD MORE PROPERTIES!!
        individ.energy=1000
        individ.fitness=1000
        newpop.append(individ)
        STR+='Predator: Adding mutated duplicates to new pop history='+individ.history_index+'\n'
        nindices.append(individ.index)
    nindices.sort()
    if Optimizer.natural_selection_scheme=='fussf':
        for ind in newpop:
            if ind.fingerprint == 0:
                ind.fingerprint = get_fingerprint(Optimizer,ind,Optimizer.fpbin,Optimizer.fpcutoff)
    if 'lambda,mu' in Optimizer.algorithm_type:
        try:
            mark = [ index for index,n in enumerate(nindices) if n > Optimizer.nindiv-1][0]
        except:
            mark = Optimizer.nindiv
        Optimizer.mark = mark
        pop, str1 = lambdacommamu.lambdacommamu(newpop, Optimizer)
        STR+=str1
    else:
        pop = selection_switch(newpop, Optimizer.nindiv, Optimizer.natural_selection_scheme, Optimizer)
    pop = get_best(pop,len(pop))
    return pop, STR
Exemplo n.º 4
0
def mutation_dups_adapt_stem(pop, Optimizer):
    """Predator function that removes individuals based on fitness and mutates replacements
    """
    fitlist = [one.fitness for one in pop]
    nfitlist, nindices = remove_duplicates(fitlist, Optimizer.demin)
    STR = ''
    newpop = []
    if len(nfitlist) != len(fitlist):
        STR+='Predator: Removed total of '+repr(len(fitlist)-len(nfitlist))+' from population\n'
    otherlist = []
    for i in range(len(pop)):
        if i not in nindices:
            STR+='Predator: Removed '+repr(pop[i].history_index)+'\n'
            otherlist.append(pop[i])
        else:
            newpop.append(pop[i])
    while len(newpop) < Optimizer.nindiv:
        indiv = random.choice(otherlist).duplicate()
        indiv, scheme = moves_switch(indiv,Optimizer)
        indiv.energy = 1000
        indiv.fitness = 1000
        newpop.append(indiv)
        STR+='Predator: Adding mutated duplicates to new pop history='+indiv.history_index+'\n'
        nindices.append(indiv.index)
    nindices.sort()
    if Optimizer.natural_selection_scheme=='fussf':
        for ind in newpop:
            if ind.fingerprint == 0:
                ind.fingerprint = get_fingerprint(Optimizer,ind,Optimizer.fpbin,Optimizer.fpcutoff)
    if 'lambda,mu' in Optimizer.algorithm_type:
        try:
            mark = [ index for index,n in enumerate(nindices) if n > Optimizer.nindiv-1][0]
        except:
            mark = Optimizer.nindiv
        Optimizer.mark = mark
        pop, str1 = lambdacommamu.lambdacommamu(newpop, Optimizer)
        STR+=str1
    else:
        pop = selection_switch(newpop, Optimizer.nindiv, Optimizer.natural_selection_scheme, Optimizer)
    pop = get_best(pop,len(pop))
    indiv = pop[0]
    if (indiv.fitness/indiv.energy <2.0):
        from MAST.structopt.tools.StemCalc import find_stem_coeff
        outs = find_stem_coeff(Optimizer,indiv)
        ind = outs[1]
        Optimizer.stem_coeff = outs[0]
        STR+='Readjusting STEM Coeff = {0}'.format(Optimizer.stem_coeff))
    return pop, STR
Exemplo n.º 5
0
def adapting(pop, Optimizer):
    """Function to provide an adapting fitness function for GA evaluation
    Input:
        pop = population consisting of list of Individual Class objects to be evaluated
        Optimizer = Optimizer class object with fitness parameters
    Output:
        pop = new population updated based on fitness evaluation
    *** needs work ***
    """
    fitlist = [one.fitness for one in pop]
    nfitlist, nindices = remove_duplicates(fitlist, Optimizer.demin)
    STR = ''
    newpop = []
    if len(nfitlist) != len(fitlist):
        STR += 'Predator: Removed total of ' + repr(
            len(fitlist) - len(nfitlist)) + ' from population\n'
    otherlist = []
    for i in range(len(pop)):
        if i not in nindices:
            STR += 'Predator: Removed ' + repr(pop[i].history_index) + '\n'
            otherlist.append(pop[i])
        else:
            newpop.append(pop[i])
    while len(newpop) < Optimizer.nindiv:
        Optimizer.output.write('Predator: Adding duplicates back')
        indiv = random.choice(otherlist)
        newpop.append(indiv)
        STR += 'Predator: Adding mutated duplicates to new pop history=' + indiv.history_index + '\n'
    if Optimizer.natural_selection_scheme == 'fussf':
        for ind in newpop:
            if ind.fingerprint == 0:
                ind.fingerprint = get_fingerprint(Optimizer, ind,
                                                  Optimizer.fpbin,
                                                  Optimizer.fpcutoff)
    if genrep >= Optimizer.reqrep * Optimizer.adaptbegin:
        ofusslim = Optimizer.fusslimit
        nfusslim = ofusslim * math.exp(-Optimizer.adaptmultiplier * float(
            Optimizer.genrep) / float(Optimizer.reqrep))
        Optimizer.fusslimit = nfusslim
    else:
        ofusslim = Optimizer.fusslimit
    pop = selection_switch(newpop, Optimizer.nindiv,
                           Optimizer.natural_selection_scheme, Optimizer)
    pop = get_best(pop, len(pop))
    Optimizer.fusslimit = ofusslim
    return pop, STR
Exemplo n.º 6
0
def mutation_dups_zp(pop, Optimizer):
    """Predator function that selects individuals that are too similar based fitness and
    replaces them with a zero point rotation of the structure
    """
    fitlist = [one.fitness for one in pop]
    nfitlist, nindices = remove_duplicates(fitlist, Optimizer.demin)
    STR = ''
    newpop = []
    if len(nfitlist) != len(fitlist):
        STR+='Predator: Removed total of '+repr(len(fitlist)-len(nfitlist))+' from population\n'
    otherlist = []
    for i in range(len(pop)):
        if i not in nindices:
            STR+='Predator: Removed '+repr(pop[i].history_index)+'\n'
            otherlist.append(pop[i])
        else:
            newpop.append(pop[i])
    while len(newpop) < Optimizer.nindiv:
        indiv = random.choice(otherlist).duplicate()
        mutopts = Optimizer.mutation_options
        Optimizer.mutation_options = ['ZP_Rotation']
        indiv = moves_switch(indiv, Optimizer)
        Optimizer.mutation_options = mutopts
        newpop.append(indiv)
        nindices.append(indiv.index)
        STR+='Predator: Adding mutated duplicates to new pop history='+indiv.history_index+'\n'
    nindices.sort()
    if Optimizer.natural_selection_scheme=='FUSSF':
        for ind in newpop:
            if ind.fingerprint == 0:
                ind.fingerprint = get_fingerprint(Optimizer,ind,Optimizer.fpbin,Optimizer.fpcutoff)
    if 'lambda,mu' in Optimizer.algorithm_type:
        try:
            mark = [ index for index,n in enumerate(nindices) if n > Optimizer.nindiv-1][0]
        except:
            mark = Optimizer.nindiv
        Optimizer.mark = mark
        pop, str1 = lambdacommamu.lambdacommamu(newpop, Optimizer)
        STR+=str1
    else:
        pop = selection_switch(newpop, Optimizer.nindiv, Optimizer.natural_selection_scheme, Optimizer)
    pop = get_best(pop,len(pop))
    return pop, STR
Exemplo n.º 7
0
def mutation_dups_energy(pop, Optimizer):
    """Predator function that removes duplicates based on energy and replaces with mutations
    """
    fitlist = [one.energy for one in pop]
    nfitlist, nindices = remove_duplicates(fitlist, Optimizer.demin)
    STR = ''
    newpop = []
    if len(nfitlist) != len(fitlist):
        STR+='Predator: Removed total of '+repr(len(fitlist)-len(nfitlist))+' from population\n'
    otherlist = []
    for i in range(len(pop)):
        if i not in nindices:
            STR+='Predator: Removed '+repr(pop[i].history_index)+'\n'
            otherlist.append(pop[i])
        else:
            newpop.append(pop[i])
    while len(newpop) < Optimizer.nindiv:
        indiv = random.choice(otherlist).duplicate()
        indiv, scheme = moves_switch(indiv,Optimizer)
        indiv.energy = 1000
        indiv.fitness = 1000
        newpop.append(indiv)
        STR+='Predator: Adding mutated duplicates to new pop history='+indiv.history_index+'\n'
        nindices.append(indiv.index)
    nindices.sort()
    if Optimizer.natural_selection_scheme=='fussf':
        for ind in newpop:
            if ind.fingerprint == 0:
                ind.fingerprint = get_fingerprint(Optimizer,ind,Optimizer.fpbin,Optimizer.fpcutoff)
    if 'lambda,mu' in Optimizer.algorithm_type:
        try:
            mark = [ index for index,n in enumerate(nindices) if n > Optimizer.nindiv-1][0]
        except:
            mark = Optimizer.nindiv
        Optimizer.mark = mark
        pop, str1 = lambdacommamu.lambdacommamu(newpop, Optimizer)
        STR+=str1
    else:
        pop = selection_switch(newpop, Optimizer.nindiv, Optimizer.natural_selection_scheme, Optimizer)
    pop = get_best(pop,len(pop))
    return pop, STR
Exemplo n.º 8
0
def adapting(pop, Optimizer):
    """Function to provide an adapting fitness function for GA evaluation
    Input:
        pop = population consisting of list of Individual Class objects to be evaluated
        Optimizer = Optimizer class object with fitness parameters
    Output:
        pop = new population updated based on fitness evaluation
    *** needs work ***
    """
    fitlist = [one.fitness for one in pop]
    nfitlist, nindices = remove_duplicates(fitlist, Optimizer.demin)
    STR = ''
    newpop = []
    if len(nfitlist) != len(fitlist):
        STR+='Predator: Removed total of '+repr(len(fitlist)-len(nfitlist))+' from population\n'
    otherlist = []
    for i in range(len(pop)):
        if i not in nindices:
            STR+='Predator: Removed '+repr(pop[i].history_index)+'\n'
            otherlist.append(pop[i])
        else:
            newpop.append(pop[i])
    while len(newpop) < Optimizer.nindiv:
        Optimizer.output.write('Predator: Adding duplicates back')
        indiv = random.choice(otherlist)
        newpop.append(indiv)
        STR+='Predator: Adding mutated duplicates to new pop history='+indiv.history_index+'\n'
    if Optimizer.natural_selection_scheme=='fussf':
        for ind in newpop:
            if ind.fingerprint == 0:
                ind.fingerprint = get_fingerprint(Optimizer,ind,Optimizer.fpbin,Optimizer.fpcutoff)
    if genrep >= Optimizer.reqrep*Optimizer.adaptbegin:
        ofusslim = Optimizer.fusslimit
        nfusslim = ofusslim*math.exp(-Optimizer.adaptmultiplier*float(Optimizer.genrep)/float(Optimizer.reqrep))
        Optimizer.fusslimit = nfusslim
    else:
        ofusslim = Optimizer.fusslimit
    pop = selection_switch(newpop, Optimizer.nindiv,Optimizer.natural_selection_scheme,Optimizer)
    pop = get_best(pop,len(pop))
    Optimizer.fusslimit=ofusslim
    return pop, STR
Exemplo n.º 9
0
    passflag = True
 except NameError, e:
     logger.warning('Specified predator not one of the available options. Please check documentation and spelling! Predator : {0}. {1}'.format(scheme,e), exc_info=True)
     passflag = False
     STR+='Specified predator not one of the available options. Please check documentation and spelling! Predator : '+repr(scheme)
     STR+=repr(e)+'\n'
 except Exception, e:
     logger.error('ERROR: Issue in Predator Scheme. Predator = {0}. {1}'.format(scheme,e), exc_info=True)
     print 'ERROR: Issue in Predator Scheme. Predator = '+repr(scheme)
     print e
     passflag = False
     STR+=''
 if not passflag:
     logger.warning('Issue in predator. Attempting basic Fitpred')
     fitlist = [one.fitness for one in pop]
     nfitlist, nindices = remove_duplicates(fitlist, Optimizer.demin)
     STR += 'Issue in predator. Attempting basic Fitpred\n'
     newpop = []
     if len(nfitlist) != len(fitlist):
         STR+='Predator: Removed total of '+repr(len(fitlist)-len(nfitlist))+' from population\n'
     otherlist = []
     for i in range(len(pop)):
         if i not in nindices:
             STR+='Predator: Removed '+repr(pop[i].history_index)+'\n'
             otherlist.append(pop[i])
         else:
             newpop.append(pop[i])
     while len(newpop) < Optimizer.nindiv:
         STR+='Predator: Adding duplicates back\n'
         choice = random.choice(otherlist)
         if choice.index not in nindices:
Exemplo n.º 10
0
def mutation_dups_quench(pop, Optimizer):
    """Predator function that removes individuals based on fitness and mutates replacements
    Also quenches top individuals
    """
    fitlist = [one.fitness for one in pop]
    nfitlist, nindices = remove_duplicates(fitlist, Optimizer.demin)
    STR = ''
    newpop = []
    if len(nfitlist) != len(fitlist):
        STR+='Predator: Removed total of '+repr(len(fitlist)-len(nfitlist))+' from population\n'
    otherlist = []
    for i in range(len(pop)):
        if i not in nindices:
            STR+='Predator: Removed '+repr(pop[i].history_index)+'\n'
            otherlist.append(pop[i])
        else:
            newpop.append(pop[i])
    while len(newpop) < Optimizer.nindiv:
        indiv = random.choice(otherlist).duplicate()
        indiv, scheme = moves_switch(indiv,Optimizer)
        indiv.energy = 1000
        indiv.fitness = 1000
        newpop.append(indiv)
        STR+='Predator: Adding mutated duplicates to new pop history='+indiv.history_index+'\n'
        nindices.append(indiv.index)
    nindices.sort()
    if Optimizer.natural_selection_scheme=='fussf':
        for ind in newpop:
            if ind.fingerprint == 0:
                ind.fingerprint = get_fingerprint(Optimizer,ind,Optimizer.fpbin,Optimizer.fpcutoff)
    if 'lambda,mu' in Optimizer.algorithm_type:
        try:
            mark = [ index for index,n in enumerate(nindices) if n > Optimizer.nindiv-1][0]
        except:
            mark = Optimizer.nindiv
        Optimizer.mark = mark
        pop, str1 = lambdacommamu.lambdacommamu(newpop, Optimizer)
        STR+=str1
    else:
        pop = selection_switch(newpop, Optimizer.nindiv, Optimizer.natural_selection_scheme, Optimizer)
    pop = get_best(pop,len(pop))
    
    if Optimizer.genrep >10:
        from MAST.structopt.moves.quench import quench
        import os
        olammpsvar = os.environ['LAMMPS_COMMAND']
        try:
            from mpi4py import MPI
            if '-n' in olammpsvar:
                lcommand = olammpsvar.split('-n')
                lcommand[1]=lcommand[1].split()
                nproc = MPI.COMM_WORLD.Get_size()
                os.environ['LAMMPS_COMMAND'] = '{0}-n {1} {2}'.format(lcommand[0],nproc,lcommand[1][1])
        except:
            pass
        oqns2 = Optimizer.quench_n_steps_2
        Optimizer.quench_n_steps_2 = 100000
        opar = Optimizer.parallel
        Optimizer.parallel = False
        for i in range(3):
            pop[i] = quench(pop[i],Optimizer)
        Optimizer.quench_n_steps_2 = oqns2
        os.environ['LAMMPS_COMMAND'] = olammpsvar
        Optimizer.parallel = opar
    return pop, STR
Exemplo n.º 11
0
def mutation_dups_quench(pop, Optimizer):
    """Predator function that removes individuals based on fitness and mutates replacements
    Also quenches top individuals
    """
    fitlist = [one.fitness for one in pop]
    nfitlist, nindices = remove_duplicates(fitlist, Optimizer.demin)
    STR = ''
    newpop = []
    if len(nfitlist) != len(fitlist):
        STR += 'Predator: Removed total of ' + repr(
            len(fitlist) - len(nfitlist)) + ' from population\n'
    otherlist = []
    for i in range(len(pop)):
        if i not in nindices:
            STR += 'Predator: Removed ' + repr(pop[i].history_index) + '\n'
            otherlist.append(pop[i])
        else:
            newpop.append(pop[i])
    while len(newpop) < Optimizer.nindiv:
        indiv = random.choice(otherlist).duplicate()
        indiv, scheme = moves_switch(indiv, Optimizer)
        indiv.energy = 1000
        indiv.fitness = 1000
        newpop.append(indiv)
        STR += 'Predator: Adding mutated duplicates to new pop history=' + indiv.history_index + '\n'
        nindices.append(indiv.index)
    nindices.sort()
    if Optimizer.natural_selection_scheme == 'fussf':
        for ind in newpop:
            if ind.fingerprint == 0:
                ind.fingerprint = get_fingerprint(Optimizer, ind,
                                                  Optimizer.fpbin,
                                                  Optimizer.fpcutoff)
    if 'lambda,mu' in Optimizer.algorithm_type:
        try:
            mark = [
                index for index, n in enumerate(nindices)
                if n > Optimizer.nindiv - 1
            ][0]
        except:
            mark = Optimizer.nindiv
        Optimizer.mark = mark
        pop, str1 = lambdacommamu.lambdacommamu(newpop, Optimizer)
        STR += str1
    else:
        pop = selection_switch(newpop, Optimizer.nindiv,
                               Optimizer.natural_selection_scheme, Optimizer)
    pop = get_best(pop, len(pop))

    if Optimizer.genrep > 10:
        from MAST.structopt.moves.quench import quench
        import os
        olammpsvar = os.environ['LAMMPS_COMMAND']
        try:
            from mpi4py import MPI
            if '-n' in olammpsvar:
                lcommand = olammpsvar.split('-n')
                lcommand[1] = lcommand[1].split()
                nproc = MPI.COMM_WORLD.Get_size()
                os.environ['LAMMPS_COMMAND'] = '{0}-n {1} {2}'.format(
                    lcommand[0], nproc, lcommand[1][1])
        except:
            pass
        oqns2 = Optimizer.quench_n_steps_2
        Optimizer.quench_n_steps_2 = 100000
        opar = Optimizer.parallel
        Optimizer.parallel = False
        for i in range(3):
            pop[i] = quench(pop[i], Optimizer)
        Optimizer.quench_n_steps_2 = oqns2
        os.environ['LAMMPS_COMMAND'] = olammpsvar
        Optimizer.parallel = opar
    return pop, STR