def define_information_flow(self): # Data flow g = self.graph gp = Pointer(self.graph) ip = Pointer(self.input) g.calc_static.input.ref_job_full_path = ip.ref_job_full_path g.calc_static.input.structure = ip.structure g.calc_static.input.positions = gp.gradient_descent.output.positions[ -1] g.check_steps.input.target = gp.clock.output.n_counts[-1] g.check_steps.input.threshold = ip.n_steps g.force_norm.input.x = gp.calc_static.output.forces[-1] g.force_norm.input.ord = 2 g.force_norm.input.axis = -1 g.max_force.input.a = gp.force_norm.output.n[-1] g.check_force.input.target = gp.max_force.output.amax[-1] g.check_force.input.threshold = ip.f_tol g.gradient_descent.input.default.positions = ip.structure.positions g.gradient_descent.input.forces = gp.calc_static.output.forces[-1] g.gradient_descent.input.positions = gp.gradient_descent.output.positions[ -1] g.gradient_descent.input.masses = ip.structure.get_masses g.gradient_descent.input.gamma0 = ip.gamma0 g.gradient_descent.input.fix_com = ip.fix_com g.gradient_descent.input.use_adagrad = ip.use_adagrad self.set_graph_archive_clock(gp.clock.output.n_counts[-1])
def define_information_flow(self): # Data flow g = self.graph gp = Pointer(self.graph) ip = Pointer(self.input) # initialize_jobs g.initialize_jobs.input.n_images = ip.n_images g.initialize_jobs.input.ref_job_full_path = ip.ref_job_full_path g.initialize_jobs.input.structure = ip.structure_initial # interpolate_images g.interpolate_images.input.structure_initial = ip.structure_initial g.interpolate_images.input.structure_final = ip.structure_final g.interpolate_images.input.n_images = ip.n_images # check_steps g.check_steps.input.target = gp.clock.output.n_counts[-1] g.check_steps.input.threshold = ip.n_steps # calc_static g.calc_static.input.n_children = ip.n_images g.calc_static.direct.structure = ip.structure_initial g.calc_static.broadcast.project_path = gp.initialize_jobs.output.project_path[ -1] g.calc_static.broadcast.job_name = gp.initialize_jobs.output.job_names[ -1] g.calc_static.broadcast.default.positions = gp.interpolate_images.output.initial_positions[ -1] g.calc_static.broadcast.positions = gp.gradient_descent.output.positions[ -1] # neb_forces g.neb_forces.input.default.positions = gp.interpolate_images.output.initial_positions[ -1] g.neb_forces.input.positions = gp.gradient_descent.output.positions[-1] g.neb_forces.input.energies = gp.calc_static.output.energy_pot[-1] g.neb_forces.input.forces = gp.calc_static.output.forces[-1] g.neb_forces.input.structure = ip.structure_initial g.neb_forces.input.spring_constant = ip.spring_constant g.neb_forces.input.tangent_style = ip.tangent_style g.neb_forces.input.use_climbing_image = ip.use_climbing_image g.neb_forces.input.smoothing = ip.smoothing # gradient_descent g.gradient_descent.input.n_children = ip.n_images g.gradient_descent.broadcast.default.positions = gp.interpolate_images.output.initial_positions[ -1] g.gradient_descent.broadcast.positions = gp.gradient_descent.output.positions[ -1] g.gradient_descent.broadcast.forces = gp.neb_forces.output.forces[-1] g.gradient_descent.direct.masses = ip.structure_initial.get_masses g.gradient_descent.direct.gamma0 = ip.gamma0 g.gradient_descent.direct.fix_com = ip.fix_com g.gradient_descent.direct.use_adagrad = ip.use_adagrad self.set_graph_archive_clock(gp.clock.output.n_counts[-1])
def define_information_flow(self): # Data flow g = self.graph gp = Pointer(self.graph) ip = Pointer(self.input) # initial_velocities g.initial_velocities.input.temperature = ip.temperature g.initial_velocities.input.masses = ip.structure.get_masses g.initial_velocities.input.overheat_fraction = ip.overheat_fraction # initial_forces g.initial_forces.input.shape = ip.structure.positions.shape # initial_pressures g.initial_pressures.input.shape = ip.structure.cell.array.shape # check_steps g.check_steps.input.target = gp.clock.output.n_counts[-1] g.check_steps.input.threshold = ip.n_steps # verelt_positions g.verlet_positions.input.default.positions = ip.structure.positions g.verlet_positions.input.default.velocities = gp.initial_velocities.output.velocities[ -1] g.verlet_positions.input.default.forces = gp.initial_forces.output.zeros[ -1] g.verlet_positions.input.positions = gp.verlet_positions.output.positions[ -1] g.verlet_positions.input.velocities = gp.verlet_velocities.output.velocities[ -1] g.verlet_positions.input.forces = gp.calc_harmonic.output.forces[-1] g.verlet_positions.input.masses = ip.structure.get_masses g.verlet_positions.input.time_step = ip.time_step g.verlet_positions.input.temperature = ip.temperature g.verlet_positions.input.temperature_damping_timescale = ip.temperature_damping_timescale # calc_harmonic g.calc_harmonic.input.spring_constant = ip.spring_constant g.calc_harmonic.input.force_constants = ip.force_constants g.calc_harmonic.input.reference_positions = ip.structure.positions g.calc_harmonic.input.positions = gp.verlet_positions.output.positions[ -1] g.calc_harmonic.input.structure = ip.structure # verlet_velocities g.verlet_velocities.input.velocities = gp.verlet_positions.output.velocities[ -1] g.verlet_velocities.input.forces = gp.calc_harmonic.output.forces[-1] g.verlet_velocities.input.masses = ip.structure.get_masses g.verlet_velocities.input.time_step = ip.time_step g.verlet_velocities.input.temperature = ip.temperature g.verlet_velocities.input.temperature_damping_timescale = ip.temperature_damping_timescale self.set_graph_archive_clock(gp.clock.output.n_counts[-1])
def get_output(self): gp = Pointer(self.graph) return { 'energy_pot': ~gp.calc_static.output.energy_pot[-1], 'positions': ~gp.gradient_descent.output.positions[-1], 'forces': ~gp.neb_forces.output.forces[-1] }
def get_output(self): gp = Pointer(self.graph) return { 'energy_pot': ~gp.calc_static_centroids.output.energy_pot[-1], 'positions': ~gp.reparameterize.output.centroids_pos_list[-1], 'forces': ~gp.calc_static_centroids.output.forces[-1] }
def get_output(self): gp = Pointer(self.graph) return { 'energy_pot': ~gp.calc_static.output.energy_pot[-1], 'energy_kin': ~gp.verlet_velocities.output.energy_kin[-1], 'positions': ~gp.verlet_positions.output.positions[-1], 'velocities': ~gp.verlet_velocities.output.velocities[-1], 'forces': ~gp.calc_static.output.forces[-1] }
def get_output(self): gp = Pointer(self.graph) return { 'job_energy_pot': ~gp.calc_static.output.energy_pot[-1], 'harmonic_energy_pot': ~gp.harmonic.output.energy_pot[-1], 'energy_kin': ~gp.verlet_velocities.output.energy_kin[-1], 'positions': ~gp.reflect.output.positions[-1], 'velocities': ~gp.verlet_velocities.output.velocities[-1], 'forces': ~gp.mix.output.weighted_sum[-1], }
def get_output(self): o = Pointer(self.graph.run_lambda_points.output) return { 'job_energy_pot': ~o.job_energy_pot[-1], 'harmonic_energy_pot': ~o.harmonic_energy_pot[-1], 'energy_kin': ~o.energy_kin[-1], 'positions': ~o.positions[-1], 'velocities': ~o.velocities[-1], 'forces': ~o.forces[-1], }
def __init__(self, name=None): super(WelfordOnline, self).__init__(name=name) self.input.default.mean = None self.input.default.std = None self.input.default.n_samples = None op = Pointer(self.output) self.input.mean = op.mean[-1] self.input.std = op.std[-1] self.input.n_samples = op.n_samples[-1]
def get_output(self): gp = Pointer(self.graph) return { 'positions': ~gp.reflect_atoms.output.positions[-1], 'velocities': ~gp.verlet_velocities.output.velocities[-1], 'forces': ~gp.calc_static.output.forces[-1], 'running_average_positions': ~gp.running_average_pos.output.running_average_positions[-1], 'divisor': ~gp.running_average_pos.output.divisor[-1], 'total_steps': ~gp.running_average_pos.output.total_steps[-1], 'clock': ~gp.clock.output.n_counts[-1] }
def define_information_flow(self): # Data flow g = self.graph gp = Pointer(self.graph) ip = Pointer(self.input) g.initial_velocity.input.temperature = ip.temperature g.initial_velocity.input.masses = ip.structure.get_masses g.initial_velocity.input.overheat_fraction = ip.overheat_fraction g.initial_forces.input.shape = ip.structure.positions.shape g.verlet_positions.input.default.positions = ip.structure.positions g.verlet_positions.input.default.velocities = gp.initial_velocity.output.velocities[-1] g.verlet_positions.input.default.forces = gp.initial_forces.output.zeros[-1] g.verlet_positions.input.positions = gp.verlet_positions.output.positions[-1] g.verlet_positions.input.velocities = gp.verlet_velocities.output.velocities[-1] g.verlet_positions.input.forces = gp.calc_static.output.forces[-1] g.verlet_positions.input.masses = ip.structure.get_masses g.verlet_positions.input.time_step = ip.time_step g.verlet_positions.input.temperature = ip.temperature g.verlet_positions.input.temperature_damping_timescale = ip.temperature_damping_timescale g.calc_static.input.ref_job_full_path = ip.ref_job_full_path g.calc_static.input.structure = ip.structure g.calc_static.input.positions = gp.verlet_positions.output.positions[-1] g.verlet_velocities.input.velocities = gp.verlet_positions.output.velocities[-1] g.verlet_velocities.input.forces = gp.calc_static.output.forces[-1] g.verlet_velocities.input.masses = ip.structure.get_masses g.verlet_velocities.input.time_step = ip.time_step g.verlet_velocities.input.temperature = ip.temperature g.verlet_velocities.input.temperature_damping_timescale = ip.temperature_damping_timescale g.check_steps.input.target = gp.clock.output.n_counts[-1] g.check_steps.input.threshold = ip.n_steps self.set_graph_archive_clock(gp.clock.output.n_counts[-1])
def define_information_flow(self): # Data flow g = self.graph gp = Pointer(self.graph) ip = Pointer(self.input) g.build_lambdas.input.n_lambdas = ip.n_lambdas g.build_lambdas.input.custom_lambdas = ip.custom_lambdas g.run_lambda_points.input.n_children = ip.n_lambdas g.run_lambda_points.direct.n_steps = ip.n_steps g.run_lambda_points.direct.temperature = ip.temperature g.run_lambda_points.direct.masses = ip.structure.get_masses g.run_lambda_points.direct.overheat_fraction = ip.overheat_fraction g.run_lambda_points.direct.threshold = ip.n_steps g.run_lambda_points.direct.ref_job_full_path = ip.ref_job_full_path g.run_lambda_points.direct.structure = ip.structure g.run_lambda_points.direct.spring_constant = ip.spring_constant g.run_lambda_points.broadcast.coupling_weights = gp.build_lambdas.output.lambda_pairs[-1] g.run_lambda_points.direct.temperature_damping_timescale = ip.temperature_damping_timescale g.run_lambda_points.direct.time_step = ip.time_step g.run_lambda_points.direct.fix_com = ip.fix_com g.run_lambda_points.direct.use_reflection = ip.use_reflection
def _initialize(self, n_children): children = [ self.child_type(name="child_{}".format(n)) for n in range(n_children) ] # Locate children in graph for n, child in enumerate(children): child.graph_parent = self child.vertex_name = "child_{}".format(n) # Link input to input.direct for key in list(self.direct.keys()): for child in children: setattr(child.input, key, getattr(Pointer(self.direct), key)) # Link input.default to input.direct.default for key in list(self.direct.default.keys()): for child in children: setattr(child.input.default, key, getattr(Pointer(self.direct.default), key)) # Link input to input.broadcast for key in list(self.broadcast.keys()): for n, child in enumerate(children): setattr(child.input, key, getattr(Pointer(self.broadcast), key)[n]) # Link input.default to input.broadcast.default for key in list(self.broadcast.default.keys()): for n, child in enumerate(children): setattr(child.input.default, key, getattr(Pointer(self.broadcast.default), key)[n]) self.children = children self._initialized = True
def define_vertices(self): # Graph components g = self.graph ip = Pointer(self.input) g.create_centroids = CreateJob() g.initial_positions = InitialPositions() g.initial_forces = Zeros() g.initial_velocities = SerialList(RandomVelocity) g.cutoff = CutoffDistance() g.check_steps = IsGEq() g.remove_images = RemoveJob() g.create_images = CreateJob() g.constrained_evo = ParallelList(_ConstrainedMD, sleep_time=ip.sleep_time) g.check_thermalized = IsGEq() g.mix = CentroidsRunningAverageMix() g.smooth = CentroidsSmoothing() g.reparameterize = CentroidsReparameterization() g.calc_static_centroids = SerialList(ExternalHamiltonian) g.recenter = SerialList(StringRecenter) g.clock = Counter()
def get_output(self): gp = Pointer(self.graph) e_mm = ~gp.calc_static_mm.output.energy_pot[-1] e_qm = ~gp.calc_static_qm.output.energy_pot[-1] e_mm_small = ~gp.calc_static_small.output.energy_pot[-1] try: # If we terminate by step count, the QM force checker may never have gotten called max_force = max(~gp.max_force_mm.output.amax[-1], ~gp.max_force_qm.output.amax[-1]) except KeyError: max_force = ~gp.max_force_mm.output.amax[-1] try: # We might also be converged before ever running a step (e.g. for perfect bulk) positions = ~gp.update_core_mm.output.positions[-1] except KeyError: positions = self.input.structure.positions return { 'energy_mm': e_mm, 'energy_qm': e_qm, 'energy_mm_small': e_mm_small, 'energy_qmmm': e_mm + e_qm - e_mm_small, 'max_force': max_force, 'positions': positions }
def define_information_flow(self): # Data flow g = self.graph gp = Pointer(self.graph) ip = Pointer(self.input) g.delete_vacancy.input.structure = ip.structure g.delete_vacancy.input.id = ip.vacancy_id shared_ids = gp.delete_vacancy.output.mask[-1] g.build_lambdas.input.n_lambdas = ip.n_lambdas g.build_lambdas.input.custom_lambdas = ip.custom_lambdas # n_children = graph_pointer.build_lambdas.output.lambda_pairs[-1].__len__ # This doesn't yet work because utils can't import MethodWrapperType and use it at line 305 until I have py 3.7 g.random_velocity.input.n_children = ip.n_lambdas # n_children g.random_velocity.direct.temperature = ip.temperature g.random_velocity.direct.masses = ip.structure.get_masses g.random_velocity.direct.overheat_fraction = ip.overheat_fraction g.initial_forces.input.shape = ip.structure.positions.shape g.slice_structure.input.vector = ip.structure.positions g.slice_structure.input.mask = ip.vacancy_id g.slice_structure.input.ensure_iterable_mask = True # To keep positions (1,3) instead of (3,) g.check_steps.input.target = gp.clock.output.n_counts[-1] g.check_steps.input.threshold = ip.n_steps g.verlet_positions.input.n_children = ip.n_lambdas g.verlet_positions.direct.default.positions = ip.structure.positions g.verlet_positions.broadcast.default.velocities = gp.random_velocity.output.velocities[-1] g.verlet_positions.direct.default.forces = gp.initial_forces.output.zeros[-1] g.verlet_positions.broadcast.positions = gp.reflect.output.positions[-1] g.verlet_positions.broadcast.velocities = gp.verlet_velocities.output.velocities[-1] g.verlet_positions.broadcast.forces = gp.mix.output.weighted_sum[-1] g.verlet_positions.direct.masses = ip.structure.get_masses g.verlet_positions.direct.time_step = ip.time_step g.verlet_positions.direct.temperature = ip.temperature g.verlet_positions.direct.temperature_damping_timescale = ip.temperature_damping_timescale g.verlet_positions.direct.time_step = ip.time_step g.reflect.input.n_children = ip.n_lambdas g.reflect.direct.default.previous_positions = ip.structure.positions g.reflect.broadcast.default.previous_velocities = gp.random_velocity.output.velocities[-1] g.reflect.direct.reference_positions = ip.structure.positions g.reflect.direct.pbc = ip.structure.pbc g.reflect.direct.cell = ip.structure.cell g.reflect.broadcast.positions = gp.verlet_positions.output.positions[-1] g.reflect.broadcast.velocities = gp.verlet_positions.output.velocities[-1] g.reflect.broadcast.previous_positions = gp.reflect.output.positions[-1] g.reflect.broadcast.previous_velocities = gp.verlet_velocities.output.velocities[-1] g.calc_full.input.n_children = ip.n_lambdas # n_children g.calc_full.direct.ref_job_full_path = ip.ref_job_full_path g.calc_full.direct.structure = ip.structure g.calc_full.broadcast.positions = gp.reflect.output.positions[-1] g.slice_positions.input.n_children = ip.n_lambdas g.slice_positions.broadcast.vector = gp.reflect.output.positions[-1] g.slice_positions.direct.mask = shared_ids g.calc_vac.input.n_children = ip.n_lambdas # n_children g.calc_vac.direct.ref_job_full_path = ip.ref_job_full_path g.calc_vac.direct.structure = gp.delete_vacancy.output.structure[-1] g.calc_vac.broadcast.positions = gp.slice_positions.output.sliced[-1] g.slice_harmonic.input.n_children = ip.n_lambdas g.slice_harmonic.broadcast.vector = gp.reflect.output.positions[-1] g.slice_harmonic.direct.mask = ip.vacancy_id g.slice_harmonic.direct.ensure_iterable_mask = True g.harmonic.input.n_children = ip.n_lambdas g.harmonic.direct.spring_constant = ip.spring_constant g.harmonic.direct.home_positions = gp.slice_structure.output.sliced[-1] g.harmonic.broadcast.positions = gp.slice_harmonic.output.sliced[-1] g.harmonic.direct.cell = ip.structure.cell g.harmonic.direct.pbc = ip.structure.pbc g.write_vac_forces.input.n_children = ip.n_lambdas g.write_vac_forces.broadcast.target = gp.calc_full.output.forces[-1] g.write_vac_forces.direct.mask = shared_ids g.write_vac_forces.broadcast.new_values = gp.calc_vac.output.forces[-1] g.write_harmonic_forces.input.n_children = ip.n_lambdas g.write_harmonic_forces.broadcast.target = gp.write_vac_forces.output.overwritten[-1] g.write_harmonic_forces.direct.mask = ip.vacancy_id g.write_harmonic_forces.broadcast.new_values = gp.harmonic.output.forces[-1] g.transpose_lambda.input.matrix = [ gp.calc_full.output.forces[-1], gp.write_harmonic_forces.output.overwritten[-1] ] g.mix.input.n_children = ip.n_lambdas g.mix.broadcast.vectors = gp.transpose_lambda.output.matrix_transpose[-1] g.mix.broadcast.weights = gp.build_lambdas.output.lambda_pairs[-1] g.verlet_velocities.input.n_children = ip.n_lambdas g.verlet_velocities.broadcast.velocities = gp.reflect.output.velocities[-1] g.verlet_velocities.broadcast.forces = gp.mix.output.weighted_sum[-1] g.verlet_velocities.direct.masses = ip.structure.get_masses g.verlet_velocities.direct.time_step = ip.time_step g.verlet_velocities.direct.temperature = ip.temperature g.verlet_velocities.direct.temperature_damping_timescale = ip.temperature_damping_timescale g.check_thermalized.input.target = gp.clock.output.n_counts[-1] g.check_thermalized.input.threshold = ip.thermalization_steps g.check_sampling_period.input.target = gp.clock.output.n_counts[-1] g.check_sampling_period.input.default.mod = Pointer(self.archive.period) g.check_sampling_period.input.mod = ip.sampling_period g.transpose_energies.input.matrix = [ gp.calc_vac.output.energy_pot[-1], gp.harmonic.output.energy_pot[-1], gp.calc_full.output.energy_pot[-1] ] g.addition.input.n_children = ip.n_lambdas g.addition.broadcast.vectors = gp.transpose_energies.output.matrix_transpose[-1] g.addition.direct.weights = [1, 1, -1] g.average.input.n_children = ip.n_lambdas g.average.broadcast.sample = gp.addition.output.weighted_sum[-1] self.set_graph_archive_clock(gp.clock.output.n_counts[-1])
def define_information_flow(self): # Data flow g = self.graph gp = Pointer(self.graph) ip = Pointer(self.input) # create_centroids g.create_centroids.input.n_images = ip.n_images g.create_centroids.input.ref_job_full_path = ip.ref_job_full_path g.create_centroids.input.structure = ip.structure_initial # initial_positions g.initial_positions.input.structure_initial = ip.structure_initial g.initial_positions.input.structure_final = ip.structure_final g.initial_positions.input.initial_positions = ip.initial_positions g.initial_positions.input.n_images = ip.n_images # initial_forces g.initial_forces.input.shape = ip.structure_initial.positions.shape # initial_velocities g.initial_velocities.input.n_children = ip.n_images g.initial_velocities.direct.temperature = ip.temperature g.initial_velocities.direct.masses = ip.structure_initial.get_masses g.initial_velocities.direct.overheat_fraction = ip.overheat_fraction # cutoff g.cutoff.input.structure = ip.structure_initial g.cutoff.input.cutoff_factor = ip.cutoff_factor # check_steps g.check_steps.input.target = gp.clock.output.n_counts[-1] g.check_steps.input.threshold = ip.n_steps # remove_images g.remove_images.input.default.project_path = ip.project_path g.remove_images.input.default.job_names = ip.job_name g.remove_images.input.project_path = gp.create_images.output.project_path[-1][-1] g.remove_images.input.job_names = gp.create_images.output.job_names[-1] # create_images g.create_images.input.n_images = ip.n_images g.create_images.input.ref_job_full_path = ip.ref_job_full_path g.create_images.input.structure = ip.structure_initial # constrained_evolution - initiailze g.constrained_evo.input.n_children = ip.n_images # constrained_evolution - verlet_positions g.constrained_evo.direct.structure = ip.structure_initial g.constrained_evo.direct.time_step = ip.time_step g.constrained_evo.direct.temperature = ip.temperature g.constrained_evo.direct.temperature_damping_timescale = ip.temperature_damping_timescale g.constrained_evo.broadcast.default.positions = gp.initial_positions.output.initial_positions[-1] g.constrained_evo.broadcast.default.velocities = gp.initial_velocities.output.velocities[-1] g.constrained_evo.direct.default.forces = gp.initial_forces.output.zeros[-1] g.constrained_evo.broadcast.positions = gp.recenter.output.positions[-1] g.constrained_evo.broadcast.velocities = gp.constrained_evo.output.velocities[-1] g.constrained_evo.broadcast.forces = gp.recenter.output.forces[-1] # constrained_evolution - reflect_string g.constrained_evo.direct.default.all_centroid_positions = gp.initial_positions.output.initial_positions[-1] g.constrained_evo.broadcast.default.centroid_positions = gp.initial_positions.output.initial_positions[-1] g.constrained_evo.direct.all_centroid_positions = gp.reparameterize.output.centroids_pos_list[-1] g.constrained_evo.broadcast.centroid_positions = gp.reparameterize.output.centroids_pos_list[-1] # constrained_evolution - reflect_atoms g.constrained_evo.direct.default.total_steps = ip.total_steps g.constrained_evo.broadcast.total_steps = gp.constrained_evo.output.total_steps[-1] g.constrained_evo.direct.cutoff_distance = gp.cutoff.output.cutoff_distance[-1] # constrained_evolution - calc_static g.constrained_evo.broadcast.project_path = gp.create_images.output.project_path[-1] g.constrained_evo.broadcast.job_name = gp.create_images.output.job_names[-1] # constrained_evolution - verlet_velocities # takes inputs already specified in verlet_positions # constrained_evolution - running_average_positions g.constrained_evo.direct.default.thermalization_steps = ip.thermalization_steps g.constrained_evo.direct.default.divisor = ip.divisor g.constrained_evo.broadcast.default.running_average_positions = \ gp.initial_positions.output.initial_positions[-1] g.constrained_evo.broadcast.divisor = gp.constrained_evo.output.divisor[-1] g.constrained_evo.broadcast.running_average_positions = \ gp.constrained_evo.output.running_average_positions[-1] # constrained_evolution - clock g.constrained_evo.direct.n_steps = ip.sampling_period # clock g.clock.input.add_counts = ip.sampling_period # check_thermalized g.check_thermalized.input.target = gp.constrained_evo.output.total_steps[-1][-1] g.check_thermalized.input.threshold = ip.thermalization_steps # mix g.mix.input.default.centroids_pos_list = gp.initial_positions.output.initial_positions[-1] g.mix.input.centroids_pos_list = gp.reparameterize.output.centroids_pos_list[-1] g.mix.input.mixing_fraction = ip.mixing_fraction g.mix.input.relax_endpoints = ip.relax_endpoints g.mix.input.running_average_positions = gp.constrained_evo.output.running_average_positions[-1] g.mix.input.structure = ip.structure_initial # smooth g.smooth.input.kappa = ip.nominal_smoothing g.smooth.input.dtau = ip.mixing_fraction g.smooth.input.structure = ip.structure_initial g.smooth.input.smooth_style = ip.smooth_style g.smooth.input.centroids_pos_list = gp.mix.output.centroids_pos_list[-1] # reparameterize g.reparameterize.input.centroids_pos_list = gp.smooth.output.centroids_pos_list[-1] g.reparameterize.input.structure = ip.structure_initial # calc_static_centroids g.calc_static_centroids.input.n_children = ip.n_images g.calc_static_centroids.direct.structure = ip.structure_initial g.calc_static_centroids.broadcast.project_path = gp.create_centroids.output.project_path[-1] g.calc_static_centroids.broadcast.job_name = gp.create_centroids.output.job_names[-1] g.calc_static_centroids.broadcast.positions = gp.reparameterize.output.centroids_pos_list[-1] # recenter g.recenter.input.n_children = ip.n_images g.recenter.direct.default.all_centroid_positions = gp.initial_positions.output.initial_positions[-1] g.recenter.broadcast.default.centroid_positions = gp.initial_positions.output.initial_positions[-1] g.recenter.broadcast.default.centroid_forces = gp.initial_forces.output.zeros[-1] g.recenter.direct.all_centroid_positions = gp.reparameterize.output.centroids_pos_list[-1] g.recenter.broadcast.centroid_positions = gp.reparameterize.output.centroids_pos_list[-1] g.recenter.broadcast.centroid_forces = gp.calc_static_centroids.output.forces[-1] g.recenter.broadcast.positions = gp.constrained_evo.output.positions[-1] g.recenter.broadcast.forces = gp.constrained_evo.output.forces[-1] g.recenter.direct.structure = ip.structure_initial self.set_graph_archive_clock(gp.clock.output.n_counts[-1])
def define_information_flow(self): # Data flow g = self.graph gp = Pointer(self.graph) ip = Pointer(self.input) # check_steps g.check_steps.input.target = gp.clock.output.n_counts[-1] g.check_steps.input.threshold = ip.n_steps # verlet_positions g.verlet_positions.input.default.positions = ip.positions g.verlet_positions.input.default.velocities = ip.velocities g.verlet_positions.input.default.forces = ip.forces g.verlet_positions.input.positions = gp.reflect_atoms.output.positions[-1] g.verlet_positions.input.velocities = gp.verlet_velocities.output.velocities[-1] g.verlet_positions.input.forces = gp.calc_static.output.forces[-1] g.verlet_positions.input.masses = ip.structure.get_masses g.verlet_positions.input.time_step = ip.time_step g.verlet_positions.input.temperature = ip.temperature g.verlet_positions.input.temperature_damping_timescale = ip.temperature_damping_timescale # reflect_string g.reflect_string.input.default.previous_positions = ip.positions g.reflect_string.input.default.previous_velocities = ip.velocities g.reflect_string.input.all_centroid_positions = ip.all_centroid_positions g.reflect_string.input.centroid_positions = ip.centroid_positions g.reflect_string.input.positions = gp.verlet_positions.output.positions[-1] g.reflect_string.input.velocities = gp.verlet_positions.output.velocities[-1] g.reflect_string.input.previous_positions = gp.reflect_atoms.output.positions[-1] g.reflect_string.input.previous_velocities = gp.verlet_velocities.output.velocities[-1] g.reflect_string.input.pbc = ip.structure.pbc g.reflect_string.input.cell = ip.structure.cell.array # reflect_atoms g.reflect_atoms.input.default.previous_positions = ip.positions g.reflect_atoms.input.default.previous_velocities = ip.velocities g.reflect_atoms.input.default.total_steps = ip.total_steps g.reflect_atoms.input.reference_positions = ip.centroid_positions g.reflect_atoms.input.positions = gp.reflect_string.output.positions[-1] g.reflect_atoms.input.velocities = gp.reflect_string.output.velocities[-1] g.reflect_atoms.input.previous_positions = gp.reflect_atoms.output.positions[-1] g.reflect_atoms.input.previous_velocities = gp.verlet_velocities.output.velocities[-1] g.reflect_atoms.input.structure = ip.structure g.reflect_atoms.input.cutoff_distance = ip.cutoff_distance g.reflect_atoms.input.use_reflection = ip.use_reflection g.reflect_atoms.input.total_steps = gp.reflect_atoms.output.total_steps[-1] # calc_static g.calc_static.input.structure = ip.structure g.calc_static.input.project_path = ip.project_path g.calc_static.input.job_name = ip.job_name g.calc_static.input.positions = gp.reflect_atoms.output.positions[-1] # verlet_velocities g.verlet_velocities.input.velocities = gp.reflect_atoms.output.velocities[-1] g.verlet_velocities.input.forces = gp.calc_static.output.forces[-1] g.verlet_velocities.input.masses = ip.structure.get_masses g.verlet_velocities.input.time_step = ip.time_step g.verlet_velocities.input.temperature = ip.temperature g.verlet_velocities.input.temperature_damping_timescale = ip.temperature_damping_timescale # running_average_positions g.running_average_pos.input.default.thermalization_steps = ip.thermalization_steps g.running_average_pos.input.default.total_steps = ip.total_steps g.running_average_pos.input.default.divisor = ip.divisor g.running_average_pos.input.default.running_average_positions = ip.running_average_positions g.running_average_pos.input.total_steps = gp.running_average_pos.output.total_steps[-1] g.running_average_pos.input.divisor = gp.running_average_pos.output.divisor[-1] g.running_average_pos.input.running_average_positions = \ gp.running_average_pos.output.running_average_positions[-1] g.running_average_pos.input.positions = gp.reflect_atoms.output.positions[-1] g.running_average_pos.input.structure= ip.structure self.set_graph_archive_clock(gp.clock.output.n_counts[-1])
def define_information_flow(self): # Data flow g = self.graph gp = Pointer(self.graph) ip = Pointer(self.input) g.initial_velocity.input.temperature = ip.temperature g.initial_velocity.input.masses = ip.structure.get_masses g.initial_velocity.input.overheat_fraction = ip.overheat_fraction g.initial_forces.input.shape = ip.structure.positions.shape g.check_steps.input.target = gp.clock.output.n_counts[-1] g.check_steps.input.threshold = ip.n_steps g.verlet_positions.input.default.positions = ip.structure.positions g.verlet_positions.input.default.velocities = gp.initial_velocity.output.velocities[-1] g.verlet_positions.input.default.forces = gp.initial_forces.output.zeros[-1] g.verlet_positions.input.positions = gp.reflect.output.positions[-1] g.verlet_positions.input.velocities = gp.verlet_velocities.output.velocities[-1] g.verlet_positions.input.forces = gp.mix.output.weighted_sum[-1] g.verlet_positions.input.masses = ip.structure.get_masses g.verlet_positions.input.time_step = ip.time_step g.verlet_positions.input.temperature = ip.temperature g.verlet_positions.input.temperature_damping_timescale = ip.temperature_damping_timescale g.reflect.on = ip.use_reflection g.reflect.input.reference_positions = ip.structure.positions g.reflect.input.pbc = ip.structure.pbc g.reflect.input.cell = ip.structure.cell g.reflect.input.positions = gp.verlet_positions.output.positions[-1] g.reflect.input.velocities = gp.verlet_positions.output.velocities[-1] g.reflect.input.default.previous_positions = ip.structure.positions g.reflect.input.default.previous_velocities = gp.initial_velocity.output.velocities[-1] g.reflect.input.previous_positions = gp.reflect.output.positions[-1] g.reflect.input.previous_velocities = gp.reflect.output.velocities[-1] g.calc_static.input.ref_job_full_path = ip.ref_job_full_path g.calc_static.input.structure = ip.structure g.calc_static.input.default.positions = gp.verlet_positions.output.positions[-1] g.calc_static.input.positions = gp.reflect.output.positions[-1] g.harmonic.input.spring_constant = ip.spring_constant g.harmonic.input.home_positions = ip.structure.positions g.harmonic.input.default.positions = gp.verlet_positions.output.positions[-1] g.harmonic.input.positions = gp.reflect.output.positions[-1] g.harmonic.input.cell = ip.structure.cell g.harmonic.input.pbc = ip.structure.pbc g.mix.input.vectors = [ gp.calc_static.output.forces[-1], gp.harmonic.output.forces[-1] ] g.mix.input.weights = ip.coupling_weights g.verlet_velocities.input.default.velocities = gp.verlet_positions.output.velocities[-1] g.verlet_velocities.input.velocities = gp.reflect.output.velocities[-1] g.verlet_velocities.input.forces = gp.mix.output.weighted_sum[-1] g.verlet_velocities.input.masses = ip.structure.get_masses g.verlet_velocities.input.time_step = ip.time_step self.archive.clock = gp.clock.output.n_counts[-1] self.set_graph_archive_clock(gp.clock.output.n_counts[-1])
def define_information_flow(self): gp = Pointer(self.graph) ip = Pointer(self.input) g = self.graph g.partition.input.structure = ip.structure g.partition.input.domain_ids = ip.domain_ids g.partition.input.seed_ids = ip.seed_ids g.partition.input.shell_cutoff = ip.shell_cutoff g.partition.input.n_core_shells = ip.n_core_shells g.partition.input.n_buffer_shells = ip.n_buffer_shells g.partition.input.vacuum_width = ip.vacuum_width g.partition.input.filler_width = ip.filler_width g.partition.input.seed_species = ip.seed_species g.calc_static_mm.input.ref_job_full_path = ip.mm_ref_job_full_path g.calc_static_mm.input.structure = gp.partition.output.mm_full_structure[ -1] g.calc_static_mm.input.default.positions = gp.partition.output.mm_full_structure[ -1].positions g.calc_static_mm.input.positions = gp.update_core_mm.output.positions[ -1] g.calc_static_small.input.ref_job_full_path = ip.mm_ref_job_full_path g.calc_static_small.input.structure = gp.partition.output.mm_small_structure[ -1] g.calc_static_small.input.default.positions = gp.partition.output.mm_small_structure[ -1].positions g.calc_static_small.input.positions = gp.update_buffer_qm.output.positions[ -1] g.calc_static_qm.input.ref_job_full_path = ip.qm_ref_job_full_path g.calc_static_qm.input.structure = gp.partition.output.qm_structure[-1] g.calc_static_qm.input.default.positions = gp.partition.output.qm_structure[ -1].positions g.calc_static_qm.input.positions = gp.update_buffer_qm.output.positions[ -1] g.check_steps.input.target = gp.clock.output.n_counts[-1] g.check_steps.input.threshold = ip.n_steps g.force_norm_mm.input.x = gp.calc_static_mm.output.forces[-1][ gp.partition.output.domain_ids[-1]['except_core']] g.force_norm_mm.input.ord = 2 g.force_norm_mm.input.axis = -1 g.max_force_mm.input.a = gp.force_norm_mm.output.n[-1] g.check_force_mm.input.target = gp.max_force_mm.output.amax[-1] g.check_force_mm.input.threshold = ip.f_tol g.force_norm_qm.input.x = gp.calc_static_qm.output.forces[-1][ gp.partition.output.domain_ids_qm[-1]['only_core']] g.force_norm_qm.input.ord = 2 g.force_norm_qm.input.axis = -1 g.max_force_qm.input.a = gp.force_norm_qm.output.n[-1] g.check_force_qm.input.target = gp.max_force_qm.output.amax[-1] g.check_force_qm.input.threshold = ip.f_tol g.gradient_descent_mm.input.forces = gp.calc_static_mm.output.forces[ -1] g.gradient_descent_mm.input.default.positions = gp.partition.output.mm_full_structure[ -1].positions g.gradient_descent_mm.input.positions = gp.update_core_mm.output.positions[ -1] g.gradient_descent_mm.input.masses = gp.partition.output.mm_full_structure[ -1].get_masses g.gradient_descent_mm.input.mask = gp.partition.output.domain_ids[-1][ 'except_core'] g.gradient_descent_mm.input.gamma0 = ip.gamma0 g.gradient_descent_mm.input.fix_com = ip.fix_com g.gradient_descent_mm.input.use_adagrad = ip.use_adagrad g.gradient_descent_qm.input.forces = gp.calc_static_qm.output.forces[ -1] g.gradient_descent_qm.input.default.positions = gp.partition.output.qm_structure[ -1].positions g.gradient_descent_qm.input.positions = gp.update_buffer_qm.output.positions[ -1] g.gradient_descent_qm.input.masses = gp.partition.output.qm_structure[ -1].get_masses g.gradient_descent_qm.input.mask = gp.partition.output.domain_ids_qm[ -1]['only_core'] g.gradient_descent_qm.input.gamma0 = ip.gamma0 g.gradient_descent_qm.input.fix_com = ip.fix_com g.gradient_descent_qm.input.use_adagrad = ip.use_adagrad g.update_core_mm.input.default.target = gp.partition.output.mm_full_structure[ -1].positions g.update_core_mm.input.target = gp.gradient_descent_mm.output.positions[ -1] g.update_core_mm.input.target_mask = [ gp.partition.output.domain_ids[-1]['seed'], gp.partition.output.domain_ids[-1]['core'] ] g.update_core_mm.input.displacement = gp.gradient_descent_qm.output.displacements[ -1] g.update_core_mm.input.displacement_mask = [ gp.partition.output.domain_ids_qm[-1]['seed'], gp.partition.output.domain_ids_qm[-1]['core'] ] g.update_buffer_qm.input.default.target = gp.partition.output.qm_structure[ -1].positions g.update_buffer_qm.input.target = gp.gradient_descent_qm.output.positions[ -1] g.update_buffer_qm.input.target_mask = gp.partition.output.domain_ids_qm[ -1]['buffer'] g.update_buffer_qm.input.displacement = gp.gradient_descent_mm.output.displacements[ -1] g.update_buffer_qm.input.displacement_mask = gp.partition.output.domain_ids[ -1]['buffer'] self.set_graph_archive_clock(gp.clock.output.n_counts[-1])
def define_information_flow(self): # Data flow g = self.graph gp = Pointer(self.graph) ip = Pointer(self.input) # initial_velocities g.initial_velocities.input.temperature = ip.temperature g.initial_velocities.input.masses = ip.structure.get_masses g.initial_velocities.input.overheat_fraction = ip.overheat_fraction # initial_forces g.initial_forces.input.shape = ip.structure.positions.shape # initial_pressures g.initial_pressures.input.shape = ip.structure.cell.array.shape # cutoff g.cutoff.input.structure = ip.structure g.cutoff.input.cutoff_factor = ip.cutoff_factor # check_steps g.check_steps.input.target = gp.clock.output.n_counts[-1] g.check_steps.input.threshold = ip.n_steps # barostat g.barostat.input.default.box_pressure = gp.initial_pressures.output.zeros[ -1] g.barostat.input.default.structure = ip.structure g.barostat.input.default.energy_kin = ip.energy_kin g.barostat.input.default.previous_volume = ip.previous_volume g.barostat.input.default.positions = ip.structure.positions g.barostat.input.box_pressure = gp.calc_static.output.pressures[-1] g.barostat.input.structure = gp.barostat.output.structure[-1] g.barostat.input.energy_kin = gp.verlet_velocities.output.energy_kin[ -1] g.barostat.input.previous_volume = gp.calc_static.output.volume[-1] g.barostat.input.positions = gp.reflect_atoms.output.positions[-1] g.barostat.input.pressure = ip.pressure g.barostat.input.temperature = ip.temperature g.barostat.input.time_step = ip.time_step g.barostat.input.pressure_damping_timescale = ip.pressure_damping_timescale g.barostat.input.compressibility = ip.compressibility g.barostat.input.pressure_style = ip.pressure_style # verlet_positions g.verlet_positions.input.default.velocities = gp.initial_velocities.output.velocities[ -1] g.verlet_positions.input.default.forces = gp.initial_forces.output.zeros[ -1] g.verlet_positions.input.positions = gp.barostat.output.positions[-1] g.verlet_positions.input.velocities = gp.verlet_velocities.output.velocities[ -1] g.verlet_positions.input.forces = gp.calc_static.output.forces[-1] g.verlet_positions.input.masses = ip.structure.get_masses g.verlet_positions.input.time_step = ip.time_step g.verlet_positions.input.temperature = ip.temperature g.verlet_positions.input.temperature_damping_timescale = ip.temperature_damping_timescale # reflect individual atoms which stray too far g.reflect_atoms.input.default.previous_positions = ip.structure.positions g.reflect_atoms.input.default.previous_velocities = gp.initial_velocities.output.velocities[ -1] g.reflect_atoms.input.default.total_steps = ip.total_steps g.reflect_atoms.input.reference_positions = ip.structure.positions g.reflect_atoms.input.positions = gp.verlet_positions.output.positions[ -1] g.reflect_atoms.input.velocities = gp.verlet_positions.output.velocities[ -1] g.reflect_atoms.input.previous_positions = gp.barostat.output.positions[ -1] g.reflect_atoms.input.previous_velocities = gp.reflect_atoms.output.velocities[ -1] g.reflect_atoms.input.structure = ip.structure g.reflect_atoms.input.cutoff_distance = gp.cutoff.output.cutoff_distance[ -1] g.reflect_atoms.input.use_reflection = ip.use_reflection g.reflect_atoms.input.total_steps = gp.reflect_atoms.output.total_steps[ -1] # calc_static g.calc_static.input.ref_job_full_path = ip.ref_job_full_path g.calc_static.input.structure = gp.barostat.output.structure[-1] g.calc_static.input.cell = gp.barostat.output.structure[-1].cell.array g.calc_static.input.positions = gp.reflect_atoms.output.positions[-1] # verlet_velocities g.verlet_velocities.input.velocities = gp.reflect_atoms.output.velocities[ -1] g.verlet_velocities.input.forces = gp.calc_static.output.forces[-1] g.verlet_velocities.input.masses = ip.structure.get_masses g.verlet_velocities.input.time_step = ip.time_step g.verlet_velocities.input.temperature = ip.temperature g.verlet_velocities.input.temperature_damping_timescale = ip.temperature_damping_timescale self.set_graph_archive_clock(gp.clock.output.n_counts[-1])