def set_up_neb_folders(self, image_structures): """Set up NEB folders. Args: image_structures <list of Structure>: List of image structures """ imct = 0 myname = self.keywords['name'] if 'mast_coordinates' in self.keywords['program_keys'].keys(): coordstrucs = self.get_coordinates_only_structure_from_input() newstrucs = list() sidx = 0 #ex. coordstrucs 0, 1, 2 for 3 images while sidx < self.keywords['program_keys']['mast_neb_settings'][ 'images']: sxtend = StructureExtensions( struc_work1=image_structures[sidx + 1].copy(), name=self.keywords['name']) newstrucs.append( sxtend.graft_coordinates_onto_structure(coordstrucs[sidx])) sidx = sidx + 1 while imct < len(image_structures): imposcar = Poscar(image_structures[imct]) num_str = str(imct).zfill(2) impath = os.path.join(myname, num_str) impospath = os.path.join(myname, "POSCAR_" + num_str) if 'mast_coordinates' in self.keywords['program_keys'].keys(): if imct == 0: #skip endpoint pass elif imct == len(image_structures) - 1: #skip other endpt pass else: imposcar.structure = newstrucs[imct - 1].copy() dirutil.lock_directory(myname) self.write_poscar_with_zero_velocities(imposcar, impospath) dirutil.unlock_directory(myname) try: os.makedirs(impath) except OSError: self.logger.warning("Directory at %s already exists." % impath) return None dirutil.lock_directory(impath) self.write_poscar_with_zero_velocities( imposcar, os.path.join(impath, "POSCAR")) dirutil.unlock_directory(impath) imct = imct + 1 return
def set_up_neb_folders(self, image_structures): """Set up NEB folders. Args: image_structures <list of Structure>: List of image structures """ imct=0 myname = self.keywords['name'] if 'mast_coordinates' in self.keywords['program_keys'].keys(): coordstrucs=self.get_coordinates_only_structure_from_input() newstrucs=list() sidx = 0 #ex. coordstrucs 0, 1, 2 for 3 images while sidx < self.keywords['program_keys']['mast_neb_settings']['images']: sxtend = StructureExtensions(struc_work1=image_structures[sidx+1].copy(), name=self.keywords['name']) newstrucs.append(sxtend.graft_coordinates_onto_structure(coordstrucs[sidx])) sidx = sidx + 1 while imct < len(image_structures): imposcar = Poscar(image_structures[imct]) num_str = str(imct).zfill(2) impath = os.path.join(myname, num_str) impospath = os.path.join(myname, "POSCAR_" + num_str) if 'mast_coordinates' in self.keywords['program_keys'].keys(): if imct == 0: #skip endpoint pass elif imct == len(image_structures)-1: #skip other endpt pass else: imposcar.structure=newstrucs[imct-1].copy() dirutil.lock_directory(myname) self.write_poscar_with_zero_velocities(imposcar, impospath) dirutil.unlock_directory(myname) try: os.makedirs(impath) except OSError: self.logger.warning("Directory at %s already exists." % impath) return None dirutil.lock_directory(impath) self.write_poscar_with_zero_velocities(imposcar, os.path.join(impath, "POSCAR")) dirutil.unlock_directory(impath) imct = imct + 1 return