def __init__(self, eigen_pair_instance, amplitude=0.0):

        basic_validators.validate_real_number(amplitude)

        self.eigen_pair = eigen_pair_instance

        self.amplitude = amplitude
Exemplo n.º 2
0
    def __setitem__(self, index, value):
        basic_validators.validate_real_number(value)

        basic_validators.validate_sequence_index(index,
                                                 len(self.displacement_vector))

        self.displacement_vector[index] = value
Exemplo n.º 3
0
    def validate_real_number_or_distribution(distribution_or_real_number):
        """
		Raises an exception if distribution_or_real_number is neither a distribution nor a real number.
		"""

        try:
            basic_validators.validate_real_number(distribution_or_real_number)
        except:
            Distribution.validate_distribution(distribution_or_real_number)
Exemplo n.º 4
0
    def __setitem__(self, index, value):
        list_representation = self.get_list_representation()

        basic_validators.validate_real_number(value)

        basic_validators.validate_sequence_index(index,
                                                 len(list_representation))

        if index <= 5:
            self.voigt_strains_list[index] = value
        else:
            self.eigen_components_list[index - 6].amplitude = value
Exemplo n.º 5
0
    def __imul__(self, scalar):
        if isinstance(scalar, complex):
            basic_validators.validate_complex_number(scalar)
        else:
            basic_validators.validate_real_number(scalar)

        multiplied_displacement_vector = copy.deepcopy(self)

        for i in range(len(multiplied_displacement_vector)):
            multiplied_displacement_vector[i] *= scalar

        return multiplied_displacement_vector
Exemplo n.º 6
0
    def __init__(self, normal_mode_instance, lambda_index, coefficient,
                 phonon_super_displacement_vector_instance):
        """
		"""

        basic_validators.validate_real_number(coefficient)

        if lambda_index not in [1, 2]:
            raise Exception(
                "Lambda index must either be one (for real complex normal coordinate component) or two (for imaginary):",
                lambda_index)

        self.coefficient = coefficient
        self.lambda_index = lambda_index
        self.normal_mode = normal_mode_instance
        self.normal_mode_displacement_vector = phonon_super_displacement_vector_instance
Exemplo n.º 7
0
	def __init__(self, path, initial_structures_list, reference_structure, vasp_relaxation_inputs_dictionary, reference_lattice_constant, misfit_strains_list, supercell_dimensions_list, calculate_polarizations=False):
		"""
		path should be the main path of the calculation set

		initial_structures_list should be the set of structures that are relaxed at each misfit strain

		reference structure can have any lattice but its atom positions must be in direct coords as the positions to compare polarizations to (choose a centrosymmetric structure if possible)

		vasp_relaxation_inputs_dictionary 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]
			#any other incar parameters with value as a list
		}

		reference_lattice_constant should be the lattice constant a0 which, when multiplied by the list of misfit strains, generates the new in-plane lattice constant at those strains.

		For each lattice constant and each structure, a relaxation is performed. Then, the lowest energy structures at each misfit strain can be determined, and a convex hull results.
		"""

		for structure in initial_structures_list:
			Structure.validate(structure)

		basic_validators.validate_real_number(reference_lattice_constant)

		for misfit_strain in misfit_strains_list:
			basic_validators.validate_real_number(misfit_strain)


		self.path = path
		self.initial_structures_list = initial_structures_list
		self.reference_structure = reference_structure
		self.vasp_relaxation_inputs_dictionary = vasp_relaxation_inputs_dictionary
		self.reference_lattice_constant = reference_lattice_constant
		self.misfit_strains_list = misfit_strains_list
		self.supercell_dimensions_list = supercell_dimensions_list
		self.calculate_polarizations = calculate_polarizations

		Path.make(path)

		self.initialize_vasp_relaxations()
    def __init__(self, eigenvalue, eigenvector):
        """
		eigenvalue - float
		eigenvector - list of floats
		"""

        basic_validators.validate_real_number(eigenvalue)

        if len(eigenvector) < 3:
            raise Exception(
                "Eigenvector list of values must have at least three components:",
                eigenvector)

        basic_validators.validate_sequence_of_real_numbers(eigenvector)

        self.eigenvalue = eigenvalue
        self.eigenvector = np.asarray(eigenvector)