An interaction_partner in Octopus is anything, which can have an interaction with any other system.
For instance electrons and ions are interaction partners, but also the photonic system described by the Maxwell system, or external potentials.
Therefore, it is the base class of all possible systems and multisystems.
Definition of interaction_partner_t
type,abstract::interaction_partner_tprivate
type(namespace_t),public::namespacetype(clock_t),public::clocktype(space_t),public::spacetype(integer_list_t),public::supported_interactions_as_partnertype(quantity_t),public::quantities(MAX_QUANTITIES)!< Array of all possible quantities.
!< The elements of the array are accessed using the
!< quantity`s identifiers.
contains
procedure(interaction_partner_update_exposed_quantities),deferred::update_exposed_quantitiesprocedure(interaction_partner_update_exposed_quantity),deferred::update_exposed_quantityprocedure(interaction_partner_init_interaction_as_partner),deferred::init_interaction_as_partnerprocedure(interaction_partner_copy_quantities_to_interaction),deferred::copy_quantities_to_interactionend type interaction_partner_t
Each interaction_partner is associated with a namespace, owns a clock, as well as a list of interactions in which it can be a partner, and a list of physical quantities, which can be exposed to other systems (through the interactions). See here for the list of possible quantities.
It also provides the basic functions to update exposed quantities, and copy them to the interaction. More details about this mechanism are described in the section on
interactions.
system_t
The system_t type is the abstract type for all systems.
As all possible systems are potential partners of some interaction, the system_t type itself extends the abstract interaction_partner_t type.
Definition of system_t
type,extends(interaction_partner_t),abstract::system_tprivate
class(propagator_t),pointer,public::prop=>null()integer::accumulated_loop_ticksinteger,public::interaction_timing!< parameter to determine if interactions
!< should use the quantities at the exact time or if retardation is allowed
type(integer_list_t),public::supported_interactionstype(interaction_list_t),public::interactions!< List with all the interactions of this system
type(mpi_grp_t),public::grp!< mpi group for this system
contains
procedure::dt_operation=>system_dt_operationprocedure::reset_clocks=>system_reset_clocksprocedure::update_exposed_quantities=>system_update_exposed_quantitiesprocedure::init_propagator=>system_init_propagatorprocedure::init_all_interactions=>system_init_all_interactionsprocedure::init_parallelization=>system_init_parallelizationprocedure::update_interactions=>system_update_interactionsprocedure::update_interactions_start=>system_update_interactions_startprocedure::update_interactions_finish=>system_update_interactions_finishprocedure::propagation_start=>system_propagation_startprocedure::propagation_finish=>system_propagation_finishprocedure::has_reached_final_propagation_time=>system_has_reached_final_propagation_timeprocedure::output_start=>system_output_startprocedure::output_write=>system_output_writeprocedure::output_finish=>system_output_finishprocedure::process_is_slave=>system_process_is_slaveprocedure::exec_end_of_timestep_tasks=>system_exec_end_of_timestep_tasksprocedure(system_init_interaction),deferred::init_interactionprocedure(system_initial_conditions),deferred::initial_conditionsprocedure(system_do_td_op),deferred::do_td_operationprocedure(system_iteration_info),deferred::iteration_infoprocedure(system_is_tolerance_reached),deferred::is_tolerance_reachedprocedure(system_update_quantity),deferred::update_quantityend type system_t
The system_t class adds information about the physical space in which the system exists, the propagator, and the list of interactions, which are owned by the system. (Check the section interactions for details on who owns an interaction.)
multisystem_t
The multisystem_t, finally adds a list of systems to the type definietion.
Definition of multisystem_t
type,extends(system_t),abstract::multisystem_ttype(system_list_t)::listcontains
procedure::dt_operation=>multisystem_dt_operationprocedure::init_parallelization=>multisystem_init_parallelizationprocedure::smallest_algo_dt=>multisystem_smallest_algo_dtprocedure::reset_clocks=>multisystem_reset_clocksprocedure::init_propagator=>multisystem_init_propagatorprocedure::propagation_start=>multisystem_propagation_startprocedure::propagation_finish=>multisystem_propagation_finishprocedure::has_reached_final_propagation_time=>multisystem_has_reached_final_propagation_timeprocedure::init_all_interactions=>multisystem_init_all_interactionsprocedure::init_interaction=>multisystem_init_interactionprocedure::write_interaction_graph=>multisystem_write_interaction_graphprocedure::initial_conditions=>multisystem_initial_conditionsprocedure::do_td_operation=>multisystem_do_td_operationprocedure::iteration_info=>multisystem_iteration_infoprocedure::is_tolerance_reached=>multisystem_is_tolerance_reachedprocedure::update_quantity=>multisystem_update_quantityprocedure::update_exposed_quantity=>multisystem_update_exposed_quantityprocedure::init_interaction_as_partner=>multisystem_init_interaction_as_partnerprocedure::copy_quantities_to_interaction=>multisystem_copy_quantities_to_interactionprocedure::process_is_slave=>multisystem_process_is_slaveend type multisystem_t
multisystem_t is an abstract class and cannot be used as such to describe a set of systems in the code.
The type to be used for combined systems is multisystem_basic_t, which extends multisystem_t.
Specific classes
multisystem_basic_t
Definition of multisystem_basic_t
type,extends(multisystem_t)::multisystem_basic_tcontains
final::multisystem_basic_finalizerend type multisystem_basic_t
multisystem_basic_t is a specific (i.e. non-abstract) container type, which can host other systems. Its propagator
Definition of classical_particles_t
type,extends(system_t),abstract::classical_particles_tprivate
integer,public::np!< Number of particles in the system
FLOAT,allocatable,public::mass(:)!< Mass of the particles
FLOAT,allocatable,public::pos(:,:)!< Position of the particles
FLOAT,allocatable,public::vel(:,:)!< Velocity of the particles
FLOAT,allocatable,public::tot_force(:,:)!< Total force acting on each particle
logical,allocatable,public::fixed(:)!< True if a giving particle is to be kept fixed during a propagation. The default is to let the particles move.
!> The following variables are work arrays used by the different propagators:
FLOAT,allocatable::acc(:,:)!< Acceleration of the particles
FLOAT,allocatable::prev_acc(:,:,:)!< A storage of the prior times.
FLOAT,allocatable::save_pos(:,:)!< A storage for the SCF loops
FLOAT,allocatable::save_vel(:,:)!< A storage for the SCF loops
FLOAT,allocatable::prev_tot_force(:,:)!< Used for the SCF convergence criterium
FLOAT,allocatable::prev_pos(:,:,:)!< Used for extrapolation
FLOAT,allocatable::prev_vel(:,:,:)!< Used for extrapolation
FLOAT,allocatable::hamiltonian_elements(:,:)contains
procedure::do_td_operation=>classical_particles_do_tdprocedure::is_tolerance_reached=>classical_particles_is_tolerance_reachedprocedure::copy_quantities_to_interaction=>classical_particles_copy_quantities_to_interactionprocedure::update_interactions_start=>classical_particles_update_interactions_startprocedure::update_interactions_finish=>classical_particles_update_interactions_finishend type classical_particles_t
Definition of electrons_t
type,extends(system_t)::electrons_t! Components are public by default
type(ions_t),pointer::ions=>NULL()type(grid_t)::gr!< the mesh
type(states_elec_t)::st!< the states
type(v_ks_t)::ks!< the Kohn-Sham potentials
type(output_t)::outp!< the output
type(multicomm_t)::mc!< index and domain communicators
type(hamiltonian_elec_t)::hmtype(td_t)::tdtype(kpoints_t)::kpoints!< the k-points
logical::generate_epottype(states_elec_t)::st_copy!< copy of the states
contains
procedure::init_interaction=>electrons_init_interactionprocedure::init_parallelization=>electrons_init_parallelizationprocedure::initial_conditions=>electrons_initial_conditionsprocedure::do_td_operation=>electrons_do_td_operationprocedure::is_tolerance_reached=>electrons_is_tolerance_reachedprocedure::iteration_info=>electrons_iteration_infoprocedure::update_quantity=>electrons_update_quantityprocedure::update_exposed_quantity=>electrons_update_exposed_quantityprocedure::init_interaction_as_partner=>electrons_init_interaction_as_partnerprocedure::copy_quantities_to_interaction=>electrons_copy_quantities_to_interactionprocedure::output_start=>electrons_output_startprocedure::output_write=>electrons_output_writeprocedure::output_finish=>electrons_output_finishprocedure::process_is_slave=>electrons_process_is_slaveprocedure::exec_end_of_timestep_tasks=>electrons_exec_end_of_timestep_tasksfinal::electrons_finalizeend type electrons_t
Class hierarchy
The following diagram represents the family tree of the system classes. Rounded boxes denote abstract classes, while rectangular boxes are normal classes, which can be instantiated.
System factory
Instances of system_t or derived types are generated using a so-called “factory”.
Definition of system_factory_abst_t
type,abstract::system_factory_abst_tcontains
procedure(system_factory_abst_create),deferred::createprocedure(system_factory_abst_block_name),deferred::block_nameend type system_factory_abst_t
Definition of system_factory_t
type,extends(system_factory_abst_t)::system_factory_tcontains
procedure::create=>system_factory_createprocedure::block_name=>system_factory_block_nameend type system_factory_t
The system_factory_create() function calls the constructor of the requested type and returns a pointer to the created instance.
Definition of systems_factory_create()
recursive function system_factory_create(this,namespace,name,type)result(system)class(system_factory_t),intent(in)::thistype(namespace_t),intent(in)::namespacecharacter(len=*),intent(in)::nameinteger,intent(in)::type
class(system_t),pointer::system
PUSH_SUB(system_factory_create)!%Variable Systems
!%Type block
!%Section System
!%Description
!% List of systems that will be treated in the calculation.
!% The first column should be a string containing the system name.
!% The second column should be the system type. See below for a list of
!% available system types.
!%Option electronic 1
!% An electronic system. (not fully implemented yet)
!%Option maxwell 2
!% A maxwell system.
!%Option classical_particle 3
!% A classical particle. Used for testing purposes only.
!%Option charged_particle 4
!% A charged classical particle.
!%Option dftbplus 5
!% A DFTB+ system
!%Option linear_medium 6
!% A linear medium for classical electrodynamics.
!%Option multisystem 7
!% A system containing other systems.
!%End
select case(type)case(SYSTEM_MULTISYSTEM)system=>multisystem_basic_t(namespace_t(name,parent=namespace),this)case(SYSTEM_ELECTRONIC)system=>electrons_t(namespace_t(name,parent=namespace))case(SYSTEM_MAXWELL)system=>system_mxll_t(namespace_t(name,parent=namespace))case(SYSTEM_CLASSICAL_PARTICLE)system=>classical_particle_t(namespace_t(name,parent=namespace))case(SYSTEM_CHARGED_PARTICLE)system=>charged_particle_t(namespace_t(name,parent=namespace))case(SYSTEM_DFTBPLUS)system=>system_dftb_t(namespace_t(name,parent=namespace))case(SYSTEM_LINEAR_MEDIUM)system=>linear_medium_t(namespace_t(name,parent=namespace))case defaultsystem=>null()end select
POP_SUB(system_factory_create)end function system_factory_create
Currently, the following system types are defined: