def main_wrapper(torComb):
    """Given a conformer (torComb) the structure is rotated to the proper 
    angles, then written to a file where a single point energy is evaluated.
    If the energy is below a prescribed value (sysInfo.max_energy), then
    proceed to a full minimization, where the final structure is then renamed
    and the results written out to the terminal
    """
    #Set angle in torsions object
    for i in xrange(len(torsions)):
        torsions[i].newAngle = np.radians(torComb.combination[i])
        
    #Check which torsions need to be rotated
    for torsion in torsions:
        if torsion.newAngle != torsion.currentAngle():
        
            #Set atoms.rotate to false
            for atom in atoms:
                atom.rotate = False
            
            #Check which atoms need to be rotated & setting atom.rotate
            assign_rotating_atoms(torsion.tor_atoms[1],
                                  torsion.tor_atoms[2],
                                  atoms)
            #Rotate atoms
            rotate_atoms(torsion,atoms)
                
    #Check if atoms are too close together
    if check_close_contacts(atoms):
        return
        
    #Write file for energy evaluation
    torComb.filename = "new_octane"
    name = TTFiles.make_filename(torComb)
    TTFiles.write_xyz(atoms,torComb.filename)
    
    #Perform single point energy evaluation
    torComb.energy = TTEnergy.get_single_point_energy(torComb.filename)
    
    #Check to see if single point energy is above the threshold for minimization
    if torComb.energy > sysInfo.max_energy():
        subprocess.Popen(["rm",torComb.filename])
        return
        
    #Perform minimization
    torComb.min_energy = TTEnergy.get_minimum_energy(torComb.filename)
    print torComb.filename,torComb.min_energy
    
    #Clean up some files
    subprocess.Popen(["mv",torComb.filename+"_2",torComb.filename])
Exemple #2
0
def main_wrapper(torComb):
    """Given a conformer (torComb) the structure is rotated to the proper 
    angles, then written to a file where a single point energy is evaluated.
    If the energy is below a prescribed value (sysInfo.max_energy), then
    proceed to a full minimization, where the final structure is then renamed
    and the results written out to the terminal
    """
    #Set angle in torsions object
    for i in xrange(len(torsions)):
        torsions[i].newAngle = np.radians(torComb.combination[i])

    #Check which torsions need to be rotated
    for torsion in torsions:
        if torsion.newAngle != torsion.currentAngle():

            #Set atoms.rotate to false
            for atom in atoms:
                atom.rotate = False

            #Check which atoms need to be rotated & setting atom.rotate
            assign_rotating_atoms(torsion.tor_atoms[1], torsion.tor_atoms[2],
                                  atoms)
            #Rotate atoms
            rotate_atoms(torsion, atoms)

    #Check if atoms are too close together
    if check_close_contacts(atoms):
        return

    #Write file for energy evaluation
    torComb.filename = "new_octane"
    name = TTFiles.make_filename(torComb)
    TTFiles.write_xyz(atoms, torComb.filename)

    #Perform single point energy evaluation
    torComb.energy = TTEnergy.get_single_point_energy(torComb.filename)

    #Check to see if single point energy is above the threshold for minimization
    if torComb.energy > sysInfo.max_energy():
        subprocess.Popen(["rm", torComb.filename])
        return

    #Perform minimization
    torComb.min_energy = TTEnergy.get_minimum_energy(torComb.filename)
    print torComb.filename, torComb.min_energy

    #Clean up some files
    subprocess.Popen(["mv", torComb.filename + "_2", torComb.filename])