def mod_udf(self, uin, pre, direction, lamd):
		time_1_step = round(self.resol/self.time_div/self.rate, -2)
		time_total = round(time_1_step*(lamd - 1)/self.resol, -2)
		#
		udf = UDFManager(uin)
		udf.jump(-1)
		# Dynamics_Conditions
		p = 'Simulation_Conditions.Dynamics_Conditions.'
		udf.put(time_total,		p + 'Time.Total_Steps')
		udf.put(time_1_step,	p + 'Time.Output_Interval_Steps')

		if direction == 'backward':
			# Deformation
			p = "Simulation_Conditions.Dynamics_Conditions.Deformation."
			srate = udf.get(p + 'Cell_Deformation.Simple_Elongation.Deformation_Speed.Speed')
			udf.put(-1*srate,	 p + 'Cell_Deformation.Simple_Elongation.Deformation_Speed.Speed')
		# Generate_Method
		p = 'Initial_Structure.Generate_Method.'
		udf.put('Restart', 			p + 'Method')
		udf.put([pre, -1, 1, 0], 	p + 'Restart')
		#--- Write UDF ---
		udf.write(uin)
		return
	def mod_udf(self, udf_in, rate):
		if self.def_mode == 'elong':
			time_1_step = int(self.res/self.time_div/rate)
			time_total = time_1_step*(self.deform_max - 1)/self.res
		elif self.def_mode == 'shear':
			deform_time = self.deform_max/rate
			time_total = round(deform_time/self.time_div)
			time_1_step = int(self.res/self.time_div/rate)
		#
		u = UDFManager(udf_in)
		# goto global data
		u.jump(-1)

		# Dynamics_Conditions
		p = 'Simulation_Conditions.Dynamics_Conditions.'
		u.put(100000.,			p + 'Max_Force')
		u.put(self.time_div,	p + 'Time.delta_T')
		u.put(time_total,		p + 'Time.Total_Steps')
		u.put(time_1_step,		p + 'Time.Output_Interval_Steps')
		u.put(1.0,				p + 'Temperature.Temperature')
		u.put(0, 				p + 'Temperature.Interval_of_Scale_Temp')
		u.put(0,				p + 'Pressure_Stress.Pressure')

		# Deformation
		if self.def_mode == 'elong':
			p = "Simulation_Conditions.Dynamics_Conditions.Deformation."
			u.put('Cell_Deformation', 		p + 'Method')
			u.put('Simple_Elongation', 		p + 'Cell_Deformation.Method')
			u.put('Initial_Strain_Rate', 	p + 'Cell_Deformation.Simple_Elongation.Input_Method')
			u.put(rate,	 		p + 'Cell_Deformation.Simple_Elongation.Initial_Strain_Rate.Rate')
			u.put(0.5, 						p + 'Cell_Deformation.Simple_Elongation.Poisson_Ratio')
			u.put('z', 						p + 'Cell_Deformation.Simple_Elongation.Axis')
			u.put(1, 						p + 'Cell_Deformation.Interval_of_Deform')
			u.put(0, 						p + 'Cell_Deformation.Deform_Atom')
		elif self.def_mode == 'shear':
			p = "Simulation_Conditions.Dynamics_Conditions.Deformation."
			u.put('Lees_Edwards', 		p + 'Method')
			u.put('Steady', 		p + 'Lees_Edwards.Method')
			u.put(rate, 	p + 'Lees_Edwards.Steady.Shear_Rate')
		
		# Output_Flags
		u.put([1, 1, 1], 'Simulation_Conditions.Output_Flags.Structure')

		# Read_Set_of_Molecules
		p = 'Initial_Structure.Read_Set_of_Molecules'
		u.put(['', -1], p)

		# Generate_Method
		p = 'Initial_Structure.Generate_Method.'
		u.put('Restart', 		p + 'Method')
		u.put(['', -1, 1, 1], 	p + 'Restart')

		# Relaxation
		p = 'Initial_Structure.Relaxation.'
		u.put(0, p + 'Relaxation')
		#--- Write UDF ---
		u.write(udf_in)
		return
Esempio n. 3
0
	def eq_udf(self, template, read_udf, present_udf, time_temp):
		u = UDFManager(os.path.join(self.calc_dir, template))
		u.jump(-1)

		#--- Simulation_Conditions ---
		# Dynamics_Conditions
		p = 'Simulation_Conditions.Dynamics_Conditions.'
		u.put(time_temp[0], p+'Time.delta_T')
		u.put(time_temp[1], p+'Time.Total_Steps')
		u.put(time_temp[2], p+'Time.Output_Interval_Steps')
		u.put(time_temp[4], p + 'Temperature.Interval_of_Scale_Temp')

		# Deformation
		p = "Simulation_Conditions.Dynamics_Conditions.Deformation."
		u.put('None',	p + 'Method')

		#--- Initial_Structure ---
		p = 'Initial_Structure.Read_Set_of_Molecules'
		u.put([self.base_udf, -1], p)
		p = 'Initial_Structure.Generate_Method.'
		u.put('Restart', 			p+'Method')
		u.put([read_udf, -1, 1, 1], p+'Restart')

		#--- Write UDF ---
		u.write(os.path.join(self.calc_dir, present_udf))
		return
Esempio n. 4
0
	def step_elong(self, base, udf_in, time_temp):
		u = UDFManager(base)
		u.jump(-1)

		# Dynamics_Conditions
		p = 'Simulation_Conditions.Dynamics_Conditions.'
		u.put(100000.,		p + 'Max_Force')
		u.put(time_temp[0],	p + 'Time.delta_T')
		u.put(time_temp[1],	p + 'Time.Total_Steps')
		u.put(time_temp[2],	p + 'Time.Output_Interval_Steps')
		#
		u.put(1.0,			p + 'Temperature.Temperature')
		u.put(time_temp[4], p + 'Temperature.Interval_of_Scale_Temp')
		#
		u.put(0,			p + 'Pressure_Stress.Pressure')

		# Deformation
		p = "Simulation_Conditions.Dynamics_Conditions.Deformation."
		u.put('Cell_Deformation', 		p + 'Method')
		u.put('Simple_Elongation', 		p + 'Cell_Deformation.Method')
		u.put('Initial_Strain_Rate', 	p + 'Cell_Deformation.Simple_Elongation.Input_Method')
		u.put(self.step_rate,	 		p + 'Cell_Deformation.Simple_Elongation.Initial_Strain_Rate.Rate')
		u.put(0.5, 						p + 'Cell_Deformation.Simple_Elongation.Poisson_Ratio')
		u.put('z', 						p + 'Cell_Deformation.Simple_Elongation.Axis')
		u.put(1, 						p + 'Cell_Deformation.Interval_of_Deform')
		u.put(0, 						p + 'Cell_Deformation.Deform_Atom')

		# Read_Set_of_Molecules
		p = 'Initial_Structure.Read_Set_of_Molecules'
		u.put([self.base_udf, -1], p)

		# Generate_Method
		p = 'Initial_Structure.Generate_Method.'
		u.put('Restart', 					p + 'Method')
		u.put([self.base_udf, -1, 1, 1], 	p + 'Restart')

		# Relaxation
		p = 'Initial_Structure.Relaxation.'
		u.put(0, p + 'Relaxation')

		#--- Write UDF ---
		u.write(os.path.join(self.calc_dir, udf_in))
		return
	def mod_udf(self, udf_in, rate):
		time_1_step = int(self.res/self.time_div/rate)
		time_total = time_1_step*(self.Lamd_max - 1)/self.res
		#
		u = UDFManager(udf_in)
		# goto global data
		u.jump(-1)

		# Dynamics_Conditions
		p = 'Simulation_Conditions.Dynamics_Conditions.'
		u.put(100000.,			p + 'Max_Force')
		u.put(self.time_div,	p + 'Time.delta_T')
		u.put(time_total,		p + 'Time.Total_Steps')
		u.put(time_1_step,		p + 'Time.Output_Interval_Steps')
		u.put(1.0,				p + 'Temperature.Temperature')
		u.put(0, 				p + 'Temperature.Interval_of_Scale_Temp')
		u.put(0,				p + 'Pressure_Stress.Pressure')

		# Deformation
		p = "Simulation_Conditions.Dynamics_Conditions.Deformation."
		u.put('Cell_Deformation', 		p + 'Method')
		u.put('Simple_Elongation', 		p + 'Cell_Deformation.Method')
		u.put('Initial_Strain_Rate', 	p + 'Cell_Deformation.Simple_Elongation.Input_Method')
		u.put(rate,	 					p + 'Cell_Deformation.Simple_Elongation.Initial_Strain_Rate.Rate')
		u.put(0.5, 						p + 'Cell_Deformation.Simple_Elongation.Poisson_Ratio')
		u.put('z', 						p + 'Cell_Deformation.Simple_Elongation.Axis')
		u.put(1, 						p + 'Cell_Deformation.Interval_of_Deform')
		u.put(0, 						p + 'Cell_Deformation.Deform_Atom')

		# Read_Set_of_Molecules
		p = 'Initial_Structure.Read_Set_of_Molecules'
		u.put([self.base_udf, -1], p)

		# Generate_Method
		p = 'Initial_Structure.Generate_Method.'
		u.put('Restart', 					p + 'Method')
		u.put([self.base_udf, -1, 1, 0], 	p + 'Restart')

		# Relaxation
		p = 'Initial_Structure.Relaxation.'
		u.put(0, p + 'Relaxation')

		#--- Write UDF ---
		u.write(udf_in)
		return
    def step_deform(self, base, axis, udf_in, time_temp, target_dir):
        u = UDFManager(base)
        u.jump(-1)

        # Dynamics_Conditions
        p = 'Simulation_Conditions.Dynamics_Conditions.'
        u.put(100000., p + 'Max_Force')
        u.put(time_temp[0], p + 'Time.delta_T')
        u.put(time_temp[1], p + 'Time.Total_Steps')
        u.put(time_temp[2], p + 'Time.Output_Interval_Steps')
        #
        u.put(1.0, p + 'Temperature.Temperature')
        u.put(time_temp[4], p + 'Temperature.Interval_of_Scale_Temp')
        #
        u.put(0, p + 'Pressure_Stress.Pressure')

        # Deformation
        if self.mode == 'elong':
            p = "Simulation_Conditions.Dynamics_Conditions.Deformation."
            u.put('Cell_Deformation', p + 'Method')
            u.put('Simple_Elongation', p + 'Cell_Deformation.Method')
            u.put('Initial_Strain_Rate',
                  p + 'Cell_Deformation.Simple_Elongation.Input_Method')
            u.put(
                self.step_rate, p +
                'Cell_Deformation.Simple_Elongation.Initial_Strain_Rate.Rate')
            u.put(0.5, p + 'Cell_Deformation.Simple_Elongation.Poisson_Ratio')
            u.put('z', p + 'Cell_Deformation.Simple_Elongation.Axis')
            u.put(1, p + 'Cell_Deformation.Interval_of_Deform')
            u.put(0, p + 'Cell_Deformation.Deform_Atom')
        elif self.mode == 'shear':
            p = "Simulation_Conditions.Dynamics_Conditions.Deformation."
            u.put('Lees_Edwards', p + 'Method')
            u.put('Steady', p + 'Lees_Edwards.Method')
            u.put(self.step_rate, p + 'Lees_Edwards.Steady.Shear_Rate')

        # Output_Flags
        u.put([1, 1, 1], 'Simulation_Conditions.Output_Flags.Structure')

        # Read_Set_of_Molecules
        p = 'Initial_Structure.Read_Set_of_Molecules'
        u.put(['', -1], p)

        # Generate_Method
        p = 'Initial_Structure.Generate_Method.'
        u.put('Restart', p + 'Method')
        u.put(['', -1, 1, 1], p + 'Restart')

        # Relaxation
        p = 'Initial_Structure.Relaxation.'
        u.put(0, p + 'Relaxation')

        # Rotate system
        self.rotate_position(u, axis)

        #--- Write UDF ---
        u.write(os.path.join(target_dir, udf_in))
        return