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])
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])
#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]) if __name__ == '__main__': #SET UP DATASTRUCTURES #Generate an array of atom objects sysInfo = SysInfo(raw_input("Filename of Tinker XYZ coordinate file: ")) atoms = TTFiles.get_xyz(sysInfo.startFile) #Evaluate energy of starting structure to obtain a reference point sysInfo.startEnergy = TTEnergy.get_single_point_energy(sysInfo.startFile) #Generate an array of torsion objects torsions = assign_torsions(atoms) #Populate system info & list of possible torsion angles sysInfo.nTors = len(torsions) while (not sysInfo.deltaPhiStatus): sysInfo.deltaPhi = float(raw_input("Delta Phi - Angle step size: ")) sysInfo.deltaPhiStatus = check_deltaPhi(sysInfo.deltaPhi) if not sysInfo.deltaPhiStatus: print "\n------------------------------------------" print "Delta phi does not divide evenly into 360." print "Please provide another value for Delta Phi" print "------------------------------------------" sysInfo.deltaPhiStatus, sysInfo.numberOfConformers = \
#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]) if __name__ == '__main__': #SET UP DATASTRUCTURES #Generate an array of atom objects sysInfo = SysInfo(raw_input("Filename of Tinker XYZ coordinate file: ")) atoms = TTFiles.get_xyz(sysInfo.startFile) #Evaluate energy of starting structure to obtain a reference point sysInfo.startEnergy = TTEnergy.get_single_point_energy(sysInfo.startFile) #Generate an array of torsion objects torsions = assign_torsions(atoms) #Populate system info & list of possible torsion angles sysInfo.nTors = len(torsions) while (not sysInfo.deltaPhiStatus): sysInfo.deltaPhi = float(raw_input("Delta Phi - Angle step size: ")) sysInfo.deltaPhiStatus = check_deltaPhi(sysInfo.deltaPhi) if not sysInfo.deltaPhiStatus: print "\n------------------------------------------" print "Delta phi does not divide evenly into 360." print "Please provide another value for Delta Phi" print "------------------------------------------" sysInfo.deltaPhiStatus, sysInfo.numberOfConformers = \