def __init__(self,
                 path=None,
                 calculation_set=None,
                 structure_creation_id_string=None,
                 parent_structures_list=None,
                 parent_paths_list=None):

        if not calculation_set:
            if not path:
                raise Exception(
                    "Path must be given if no calculation set is provided.")

            self.path = Path.expand(path)
            self.load()
        else:
            self.path = calculation_set.path
            self.calculation_set = calculation_set

            self.structure_creation_id_string = structure_creation_id_string if structure_creation_id_string else self.get_structure_creation_id_string(
            )
            self.parent_structures_list = parent_structures_list if parent_structures_list else self.get_parent_structures_list(
            )
            self.parent_paths_list = parent_paths_list if parent_paths_list else self.get_parent_paths_list(
            )

            self.write_structure_creation_id_string_to_file(
            )  #store how this individual was made
            self.write_parent_structures_to_poscar_files()
            self.write_parent_paths_to_file()

            self.save()
	def __init__(self, path, initial_structure=None, input_dictionary=None):
		"""
		Input dicitonary should look something like:
		{
			'external_relaxation_count': 4,
			'kpoint_schemes_list': ['Gamma'],
			'kpoint_subdivisions_lists': [[1, 1, 1], [1, 1, 2], [2, 2, 4]],
			'submission_script_modification_keys_list': ['100', 'standard', 'standard_gamma'], #optional - will default to whatever queue adapter gives
			'submission_node_count_list': [1, 2],
			'ediff': [0.001, 0.00001, 0.0000001],
			'encut': [200, 400, 600, 800],
			'isif' : [5, 2, 3],
			'calculation_type': 'gga' #not needed - defaults to 'lda',
			'static_lwave': True #if set, lwave is left on for static run
			#any other incar parameters with value as a list
		}

		If no input_dictionary is provided, this class will attempt to load a saved pickled instance.
		"""

		self.path = Path.expand(path)

		if not input_dictionary:
			self.load()
		else:
			self.vasp_run_list = []
			self.input_initial_structure = initial_structure

			Path.make(self.path)

			self.unpack_input_dictionary_into_self(input_dictionary)
			self.save()

		self.initialize_run_list()
Example #3
0
    def __init__(self, path, directory_to_individual_conversion_method=None):
        """
		directory_to_individual_conversion_method can be left as None - then individuals will load in pickled saved version of instances.
		"""

        self.path = Path.expand(path)
        self.directory_to_individual_conversion_method = directory_to_individual_conversion_method
        self.initialize_paths()
Example #4
0
    def __init__(self,
                 path,
                 initial_structure=None,
                 relaxation_input_dictionary=None,
                 extra_dos_inputs=None):
        """
		Input dicitonary should look something like:
		{
			'external_relaxation_count': 4,
			'kpoint_schemes_list': ['Gamma'],
			'kpoint_subdivisions_lists': [[1, 1, 1], [1, 1, 2], [2, 2, 4]],
			'submission_script_modification_keys_list': ['100', 'standard', 'standard_gamma'], #optional - will default to whatever queue adapter gives
			'submission_node_count_list': [1, 2],
			'ediff': [0.001, 0.00001, 0.0000001],
			'encut': [200, 400, 600, 800],
			'isif' : [5, 2, 3],
			'calculation_type': 'gga' #must be gga in this case
			#any other incar parameters with value as a list
		}

		extra_dos_inputs is optional and should look like:
		{
			HFSCREEN = 0.2 # sets the type of hybid - can give params for pbe0 here too
			NEDOS = 4001
			'kpoint_schemes_list': ['Gamma'],
			'kpoint_subdivisions_lists': [[2, 2, 4]], #for enhanced kpoints - can be up to three for each stage of the dos
			any other incar params for just dos part
		}

		If no relaxation_input_dictionary is provided, this class will attempt to load a saved pickled instance.
		"""

        self.path = Path.expand(path)
        self.relaxation_path = self.get_extended_path('relaxation')
        self.dos_path = self.get_extended_path('dos')
        self.extra_dos_inputs = extra_dos_inputs
        self.dos_runs_list = []

        if 'calculation_type' not in relaxation_input_dictionary or relaxation_input_dictionary[
                'calculation_type'] != 'gga':
            raise Exception(
                "Calculation type must be gga for hybrid calculations")

        if not relaxation_input_dictionary:
            self.load()
        else:

            Path.make(self.path)

            relaxation_input_dictionary['static_lwave'] = True
            self.relaxation = VaspRelaxation(
                path=self.relaxation_path,
                initial_structure=initial_structure,
                input_dictionary=relaxation_input_dictionary)
            self.save()
Example #5
0
    def from_poscar_file_path(self, file_path):

        Path.validate(path=file_path, allow_none=False)
        Path.expand(file_path)

        poscar = Poscar(file_path)
        self.lattice = Lattice(poscar.lattice)
        self.sites = SiteCollection()

        poscar_coordinate_mode = poscar.coordinate_mode
        poscar_coordinates_list = poscar.coordinates

        species_index = 0
        for i, specie in enumerate(poscar.species_list):
            for j in range(poscar.species_count_list[i]):
                new_site = Site()
                new_site['coordinate_mode'] = poscar_coordinate_mode
                new_site['position'] = poscar_coordinates_list[species_index]
                new_site['type'] = specie

                self.sites.append(new_site)

                species_index += 1
    def __init__(self,
                 path,
                 reference_structure=None,
                 distorted_structure=None,
                 vasp_run_inputs_dictionary=None):
        """
		reference_structure should be a Structure instance with the same lattice as distorted structure. Usually this reference is chosen to be centrosymmetry (like ideal perovskite) so that 
		absolute polarizations of the distorted structure can be caluclated.

		distorted_structure should be a Structure instance with the same lattice as the reference structure, but some of the atoms shifted to cause a change in polarization.

		vasp_run_inputs_dictionary should look like:

		vasp_run_inputs_dictionary = {
			'kpoint_scheme': 'Monkhorst',
			'kpoint_subdivisions_list': [4, 4, 4],
			'encut': 800,
		}

		"""

        self.path = Path.expand(path)

        if (reference_structure
                == None) or (distorted_structure
                             == None) or (vasp_run_inputs_dictionary == None):
            self.load()
        else:

            Structure.validate(reference_structure)
            Structure.validate(distorted_structure)

            if not reference_structure.lattice.equals(
                    distorted_structure.lattice):
                raise Exception(
                    "Warning: It's very difficult to interpret polarization results when the lattices of the reference and distorted structures are not equal. This is likely an error.",
                    reference_structure.lattice, distorted_structure.lattice)

            self.reference_structure = reference_structure
            self.distorted_structure = distorted_structure
            self.vasp_run_inputs = copy.deepcopy(vasp_run_inputs_dictionary)
            self.vasp_run_list = []

            self.save()

        Path.make(path)

        self.initialize_vasp_runs()
Example #7
0
    def __init__(self, path):
        self.path = Path.expand(path)

        self.load()