50 logical :: initialized = .false.
51 integer :: default_pseudopotential_set_id
52 type(pseudo_set_t) :: default_pseudopotential_set
53 integer :: default_allelectron_type
54 real(real64) :: default_sigma
55 real(real64) :: default_anc_a
67 class(species_factory_t),
intent(inout) :: factory
68 type(namespace_t),
intent(in) :: namespace
70 integer :: ierr, default_val
72 if (factory%initialized)
return
76 factory%initialized = .
true.
109 call parse_variable(namespace,
'AllElectronType', option__allelectrontype__no, factory%default_allelectron_type)
131 call parse_variable(namespace,
'AllElectronSigma', 0.6_real64, factory%default_sigma)
152 call parse_variable(namespace,
'AllElectronANCParam', 4.0_real64, factory%default_anc_a)
156 factory%default_allelectron_type /= option__allelectrontype__full_gaussian)
then
157 message(1) =
"AllElectronSigma is only used by species_full_gaussian and will be ignored."
161 factory%default_allelectron_type /= option__allelectrontype__full_anc)
then
162 message(1) =
"AllElectronANCParam is only used by species_full_anc and will be ignored."
231 default_val = option__pseudopotentialset__standard
232 if(factory%default_allelectron_type /= option__allelectrontype__no) default_val = option__pseudopotentialset__none
233 call parse_variable(namespace,
'PseudopotentialSet', default_val, factory%default_pseudopotential_set_id)
235 if (factory%default_pseudopotential_set_id /= option__pseudopotentialset__none)
then
241 if (factory%default_pseudopotential_set_id /= option__pseudopotentialset__none &
242 .and. factory%default_allelectron_type /= option__allelectrontype__no)
then
243 message(1) =
"PseudopotentialSet /= none cannot be used with AllElectronType /= no."
257 if (factory%initialized)
then
259 factory%initialized = .false.
275 character(len=*),
intent(in) :: label
276 integer,
intent(in) :: index
279 character(len=LABEL_LEN) :: lab
280 integer :: ib, row, n_spec_block, read_data
493 if (
parse_block(namespace,
'Species', blk) == 0)
then
499 block:
do ib = 1, n_spec_block
501 if (trim(lab) == trim(label))
then
509 spec => factory%create_from_block(namespace, blk, row, label, index, read_data)
512 assert(read_data > 0)
523 if(factory%default_allelectron_type /= option__allelectrontype__no)
then
524 select case(factory%default_allelectron_type)
525 case(option__allelectrontype__full_delta)
526 spec =>
full_delta_t(label, index, factory%default_sigma)
527 case(option__allelectrontype__full_gaussian)
529 case(option__allelectrontype__full_anc)
530 spec =>
full_anc_t(label, index, factory%default_anc_a)
541 call spec%set_zval(spec%get_z())
551 call read_from_set(spec, factory%default_pseudopotential_set_id, factory%default_pseudopotential_set, read_data)
553 if (read_data == 0)
then
554 call messages_write(
'Species '//trim(spec%get_label())//
' not found in default pseudopotential set.', new_line=.
true. )
569 function read_from_block(factory, namespace, blk, row, label, index, read_data)
result(spec)
572 type(
block_t),
intent(in) :: blk
573 integer,
intent(in) :: row
574 character(len=*),
intent(in) :: label
575 integer,
intent(in) :: index
576 integer,
intent(out):: read_data
579 integer :: ncols, icol, flag, set_read_data, ierr, type
582 integer :: user_lmax, user_llocal, hubbard_l, pseudopotential_set_id
583 real(real64) :: hubbard_u, hubbard_j, hubbard_alpha, mass, z_val, jradius, jthick, vdw_radius, aa
584 real(real64) :: sigma, softening
585 character(len=MAX_PATH_LEN) :: filename
587 integer,
parameter :: &
594 species_full_gaussian = 124, &
597 species_full_delta = 127, &
598 species_soft_coulomb = 128, &
599 species_full_anc = 130
612 call messages_write(
'Found a species with the old format. Please update', new_line = .
true.)
613 call messages_write(
'the Species block to the new format, where the second', new_line = .
true.)
626 case (species_soft_coulomb)
641 case (species_full_delta)
642 spec =>
full_delta_t(label, index, factory%default_sigma)
644 case (species_full_gaussian)
647 case (species_full_anc)
648 spec =>
full_anc_t(label, index, factory%default_anc_a)
663 call messages_input_error(namespace,
'Species',
"Unknown type for species '"//trim(spec%get_label())//
"'", row=row, column=1)
666 call spec%set_mass(-
m_one)
667 call spec%set_vdw_radius(-
m_one)
668 call spec%set_zval(-
m_one)
674 if (icol >= ncols)
exit
680 case (option__species__lmax)
686 call spec%set_user_lmax(user_lmax)
689 "The 'lmax' parameter in species "//trim(spec%get_label())//
" can only be used with pseudopotential species", &
690 row=row, column=icol+1)
693 if (user_lmax < 0)
then
695 "The 'lmax' parameter in species "//trim(spec%get_label())//
" cannot be negative", &
696 row=row, column=icol+1)
699 case (option__species__lloc)
705 call spec%set_user_lloc(user_llocal)
708 "The 'lloc' parameter in species "//trim(spec%get_label())//
" can only be used with pseudopotential species", &
709 row=row, column=icol+1)
712 if (user_llocal < 0)
then
714 "The 'lloc' parameter in species "//trim(spec%get_label())//
" cannot be negative", row=row, column=icol+1)
717 case (option__species__hubbard_l)
723 call spec%set_hubbard_l(hubbard_l)
726 "The 'hubbard_l' parameter in species "//trim(spec%get_label())//
" can only be used with pseudopotential species", &
727 row=row, column=icol+1)
730 if (hubbard_l < 0)
then
732 "The 'hubbard_l' parameter in species "//trim(spec%get_label())//
" cannot be negative", row=row, column=icol+1)
735 case (option__species__hubbard_u)
738 call spec%set_hubbard_u(hubbard_u)
740 case (option__species__hubbard_alpha)
743 call spec%set_hubbard_alpha(hubbard_alpha)
745 case (option__species__hubbard_j)
748 call spec%set_hubbard_j(hubbard_j)
750 if (abs(abs(spec%get_hubbard_j()-spec%get_hubbard_l())-
m_half) <=
m_epsilon)
then
752 trim(spec%get_label())//
" can only be hubbard_l +/- 1/2", row=row, column=icol+1)
755 case (option__species__mass)
758 call spec%set_mass(mass)
760 case (option__species__valence)
763 call spec%set_zval(z_val)
764 call spec%set_z(z_val)
766 case (option__species__jellium_radius)
770 row=row, column=icol+1)
774 call spec%set_radius(jradius)
776 call messages_input_error(namespace,
'Species',
'jellium_radius can only be used with species_jellium', &
777 row=row, column=icol+1)
780 case (option__species__gaussian_width)
784 row=row, column=icol+1)
787 call spec%set_sigma(sigma)
789 call messages_input_error(namespace,
'Species',
'gaussian_width can only be used with species_full_gaussian', &
790 row=row, column=icol+1)
793 case (option__species__anc_a)
797 row=row, column=icol+1)
803 call messages_input_error(namespace,
'Species',
'anc_a can only be used with species_full_anc', &
804 row=row, column=icol+1)
807 case (option__species__softening)
810 softening = softening**2
814 call spec%set_softening2(softening)
816 call messages_input_error(namespace,
'Species',
'softening can only be used with species_soft_coulomb', &
817 row=row, column=icol+1)
820 case (option__species__file)
823 call spec%set_filename(filename)
825 case (option__species__db_file)
826 call messages_write(
"The 'db_file' option for 'Species' block is obsolete. Please use", new_line = .
true.)
827 call messages_write(
"the option 'set' or the variable 'PseudopotentialSet' instead.")
830 case (option__species__set)
836 spec%pseudopotential_set_initialized = .
true.
837 spec%pseudopotential_set_id = pseudopotential_set_id
841 row=row, column=icol+1)
844 case (option__species__potential_formula)
850 call messages_input_error(namespace,
'Species',
'potential_formula can only be used with species_user_defined', &
851 row=row, column=icol+1)
854 case (option__species__volume)
862 call messages_input_error(namespace,
'Species',
'volume can only be used with species_jellium_charge_density', &
863 row=row, column=icol+1)
866 case (option__species__density_formula)
874 call messages_input_error(namespace,
'Species',
'density_formula can only be used with species_charge_density', &
875 row=row, column=icol+1)
878 case (option__species__thickness)
882 if (jthick <=
m_zero)
then
883 call messages_input_error(namespace,
'Species',
'the value of the thickness parameter in species '&
884 //trim(spec%get_label())//
' must be positive.', row=row, column=icol+1)
889 call spec%set_thickness(jthick)
891 call messages_input_error(namespace,
'Species',
'thickness can only be used with species_jellium_slab', &
892 row=row, column=icol+1)
895 case (option__species__vdw_radius)
898 call spec%set_vdw_radius(vdw_radius)
901 call messages_input_error(namespace,
'Species',
"Unknown parameter in species '"//trim(spec%get_label())//
"'", &
902 row=row, column=icol)
914 "The 'softening' parameter is missing for species "//trim(spec%get_label()))
920 "The 'potential_formula' parameter is missing for species '"//trim(spec%get_label())//
"'")
926 "The 'density_formula' parameter is missing for species '"//trim(spec%get_label())//
"'")
932 "The 'file' or 'db_file' parameter is missing for species '"//trim(spec%get_label())//
"'")
938 "The 'thickness' parameter is missing for species '"//trim(spec%get_label())//
"'")
944 "The 'volume' parameter is missing for species '"//trim(spec%get_label())//
"'")
949 if (spec%get_user_lloc() > spec%get_user_lmax())
then
951 "the 'lloc' parameter cannot be larger than the 'lmax' parameter in species "//trim(spec%get_label()))
960 spec%pseudopotential_set_id = factory%default_pseudopotential_set_id
961 spec%pseudopotential_set = factory%default_pseudopotential_set
964 call read_from_set(spec, spec%pseudopotential_set_id, spec%pseudopotential_set, set_read_data)
966 if (set_read_data == 0)
then
967 call messages_write(
'Species '//trim(spec%get_label())//
' is not defined in the requested pseudopotential set.', &
984 if (spec%get_zval() <
m_zero)
then
985 call spec%set_zval(spec%get_z())
992 if (spec%get_zval() <
m_zero)
then
993 call spec%set_zval(spec%get_z())
1000 if (spec%get_zval() <
m_zero)
then
1001 call spec%set_zval(spec%get_z())
1006 call spec%set_mass(
m_one)
1007 call messages_write(
'Info: default mass for species '//trim(spec%get_label())//
':')
1014 call spec%set_vdw_radius(
m_zero)
1015 call messages_write(
'Info: default vdW radius for species '//trim(spec%get_label())//
':')
1022 if (spec%is_user_defined())
then
1023 call spec%set_zval(
m_zero)
1026 "The 'valence' parameter is missing for species '"//trim(spec%get_label())//
"'")
1039 integer(int64),
intent(in) :: param
1052 integer(int64),
intent(in) :: param
1057 call messages_input_error(namespace,
'Species',
"Duplicated parameter in species '"//trim(spec%get_label())//
"'")
1072 call messages_write(
'Cannot determine the element for species '//trim(spec%get_label())//
'.')
1078 if (spec%get_mass() <
m_zero)
then
1080 call messages_write(
'Info: default mass for species '//trim(spec%get_label())//
':')
1086 if (spec%get_vdw_radius() <
m_zero)
then
1088 if (spec%get_vdw_radius() <
m_zero)
then
1089 call spec%set_vdw_radius(
m_zero)
1090 call messages_write(
"The default vdW radius for species '"//trim(spec%get_label())//
"' is not defined.", &
1092 call messages_write(
"You can specify the vdW radius in %Species block.")
1095 call messages_write(
'Info: default vdW radius for species '//trim(spec%get_label())//
':')
subroutine check_duplication(param)
logical function parameter_defined(param)
logical function, public element_valid(self)
real(real64), parameter, public m_zero
real(real64), parameter, public m_epsilon
type(conf_t), public conf
Global instance of Octopus configuration.
real(real64), parameter, public m_half
real(real64), parameter, public m_one
This module implements a simple hash table for non-negative integer keys and integer values.
subroutine, public iihash_end(h)
Free a hash table.
subroutine, public iihash_insert(h, key, val)
Insert a (key, val) pair into the hash table h.
integer function, public iihash_lookup(h, key, found)
Look up a value in the hash table h. If found is present, it indicates if key could be found in the t...
subroutine, public iihash_init(h)
Initialize a hash table h.
integer, parameter, public species_charge_density
user-defined function for charge density
integer, parameter, public species_jellium_charge_density
jellium volume read from file
integer, parameter, public species_jellium
jellium sphere.
integer, parameter, public species_from_file
integer, parameter, public species_usdef
user-defined function for local potential
integer, parameter, public species_jellium_slab
jellium slab.
subroutine, public messages_warning(no_lines, all_nodes, namespace)
subroutine, public messages_obsolete_variable(namespace, name, rep)
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
subroutine, public messages_input_error(namespace, var, details, row, column)
subroutine, public messages_info(no_lines, iunit, debug_only, stress, all_nodes, namespace)
logical function, public parse_is_defined(namespace, name)
subroutine, public parse_block_string(blk, l, c, res, convert_to_c)
integer function, public parse_block(namespace, name, blk, check_varinfo_)
/* To use the profiling module, call profiling_in and profiling_out with the label of the region as a...
subroutine, public pseudo_set_init(pseudo_set, dirname, ierr)
character(len=max_path_len) function, public get_set_directory(set_id)
subroutine, public read_from_set(spec, set_id, set, read_data)
Creates a pseudopotential type from a set.
integer, parameter, public species_pseudo
pseudopotential
integer, parameter, public species_pspio
pseudopotential parsed by pspio library
subroutine, public share_directory_set(dir)
class(species_t) function, pointer species_factory_create_from_input(factory, namespace, label, index)
Reads the information (from the input file) about a species_t variable, initializing part of it (it h...
subroutine, public species_factory_init(factory, namespace)
class(species_t) function, pointer read_from_block(factory, namespace, blk, row, label, index, read_data)
Parses the species block for a given species.
subroutine, public species_factory_end(factory)
character(kind=c_char) function, dimension(label_len+1), public get_symbol(label)
brief This module defines the class unit_t which is used by the unit_systems_oct_m module.
This module defines the unit system, used for input and output.
type(unit_system_t), public units_inp
the units systems for reading and writing
subroutine check_real_atom_species()
An abstract class for species. Derived classes include jellium, all electron, and pseudopotential spe...