recursive function system_factory_create(this, namespace, type, calc_mode_id) result(system)
class(system_factory_t), intent(in) :: this !< the system factory
type(namespace_t), intent(in) :: namespace !< namespace of the system
integer, intent(in) :: type !< type of the system to create
integer, intent(in) :: calc_mode_id !< ID of calculation mode
class(system_t), pointer :: system !< pointer to newly created system
integer :: n_replicas, first, last
character(len=128), allocatable :: names(:)
integer, allocatable :: types(:)
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 matter 7
!% A matter system containing electrons and classical ions.
!%Option dispersive_medium 8
!% (Experimental) A dispersive medium for classical electrodynamics.
!%Option multisystem 9
!% A system containing other systems.
!%Option ions 10
!% An ensemble of classical charged particles.
!%Option ensemble 11
!% An ensemble for multitrajectory runs
!%End
select case (type)
case (SYSTEM_MULTISYSTEM)
call parse_subsystems(namespace, names, types)
system => multisystem_basic_t(namespace, names, types, this, calc_mode_id)
SAFE_DEALLOCATE_A(names)
SAFE_DEALLOCATE_A(types)
case (SYSTEM_ELECTRONIC)
system => electrons_t(namespace, calc_mode_id)
case (SYSTEM_MAXWELL)
system => maxwell_t(namespace)
case (SYSTEM_CLASSICAL_PARTICLE)
system => classical_particle_t(namespace)
case (SYSTEM_CHARGED_PARTICLE)
system => charged_particle_t(namespace)
case (SYSTEM_DFTBPLUS)
system => dftb_t(namespace)
case (SYSTEM_LINEAR_MEDIUM)
system => linear_medium_t(namespace)
case (SYSTEM_MATTER)
system => matter_t(namespace)
case (SYSTEM_DISPERSIVE_MEDIUM)
system => dispersive_medium_t(namespace)
call messages_experimental('dispersive_medium', namespace=namespace)
case (SYSTEM_IONS)
system => ions_t(namespace)
case (SYSTEM_ENSEMBLE)
!%Variable NumberOfReplicas
!%Type integer
!%Default 1
!%Section System
!%Description
!% Number of replicas to be created for the ensemble.
!%End
call parse_variable(namespace, 'NumberOfReplicas', 1, n_replicas)
if (debug%info) then
write(message(1), '(a,i5,a)') "The ensemble has ", n_replicas, " replicas"
call messages_info(1, namespace=namespace)
end if
!%Variable FirstReplica
!%Type integer
!%Default 1
!%Section Multi-Trajectory
!%Description
!% First replica to be calculated in this run.
!%End
call parse_variable(namespace, 'FirstReplica', 1, first)
!%Variable LastReplica
!%Type integer
!%Default 0
!%Section Multi-Trajectory
!%Description
!% Last replica to be calculated in this run.
!%End
call parse_variable(namespace, 'LastReplica', n_replicas, last)
call parse_subsystems(namespace, names, types)
system => ensemble_t(namespace, n_replicas, first, last, this, names, types, calc_mode_id)
SAFE_DEALLOCATE_A(names)
SAFE_DEALLOCATE_A(types)
case default
call messages_input_error(namespace, 'Systems', 'Unknown system type.')
end select
POP_SUB(system_factory_create)
end function system_factory_create