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."
223 default_val = option__pseudopotentialset__standard
224 if(factory%default_allelectron_type /= option__allelectrontype__no) default_val = option__pseudopotentialset__none
225 call parse_variable(namespace,
'PseudopotentialSet', default_val, factory%default_pseudopotential_set_id)
227 if (factory%default_pseudopotential_set_id /= option__pseudopotentialset__none)
then
233 if (factory%default_pseudopotential_set_id /= option__pseudopotentialset__none &
234 .and. factory%default_allelectron_type /= option__allelectrontype__no)
then
235 message(1) =
"PseudopotentialSet /= none cannot be used with AllElectronType /= no."
249 if (factory%initialized)
then
251 factory%initialized = .false.
267 character(len=*),
intent(in) :: label
268 integer,
intent(in) :: index
271 character(len=LABEL_LEN) :: lab
272 integer :: ib, row, n_spec_block, read_data
485 if (
parse_block(namespace,
'Species', blk) == 0)
then
491 block:
do ib = 1, n_spec_block
493 if (trim(lab) == trim(label))
then
501 spec => factory%create_from_block(namespace, blk, row, label, index, read_data)
504 assert(read_data > 0)
515 if(factory%default_allelectron_type /= option__allelectrontype__no)
then
516 select case(factory%default_allelectron_type)
517 case(option__allelectrontype__full_delta)
518 spec =>
full_delta_t(label, index, factory%default_sigma)
519 case(option__allelectrontype__full_gaussian)
521 case(option__allelectrontype__full_anc)
522 spec =>
full_anc_t(label, index, factory%default_anc_a)
533 call spec%set_zval(spec%get_z())
543 call read_from_set(spec, factory%default_pseudopotential_set_id, factory%default_pseudopotential_set, read_data)
545 if (read_data == 0)
then
546 call messages_write(
'Species '//trim(spec%get_label())//
' not found in default pseudopotential set.', new_line=.
true. )
561 function read_from_block(factory, namespace, blk, row, label, index, read_data)
result(spec)
564 type(
block_t),
intent(in) :: blk
565 integer,
intent(in) :: row
566 character(len=*),
intent(in) :: label
567 integer,
intent(in) :: index
568 integer,
intent(out):: read_data
571 integer :: ncols, icol, flag, set_read_data, ierr, type
574 integer :: user_lmax, user_llocal, hubbard_l, pseudopotential_set_id
575 real(real64) :: hubbard_u, hubbard_j, hubbard_alpha, mass, z_val, jradius, jthick, vdw_radius, aa
576 real(real64) :: sigma, softening
577 character(len=MAX_PATH_LEN) :: filename
579 integer,
parameter :: &
586 species_full_gaussian = 124, &
589 species_full_delta = 127, &
590 species_soft_coulomb = 128, &
591 species_full_anc = 130
604 call messages_write(
'Found a species with the old format. Please update', new_line = .
true.)
605 call messages_write(
'the Species block to the new format, where the second', new_line = .
true.)
618 case (species_soft_coulomb)
633 case (species_full_delta)
634 spec =>
full_delta_t(label, index, factory%default_sigma)
636 case (species_full_gaussian)
639 case (species_full_anc)
640 spec =>
full_anc_t(label, index, factory%default_anc_a)
655 call messages_input_error(namespace,
'Species',
"Unknown type for species '"//trim(spec%get_label())//
"'", row=row, column=1)
658 call spec%set_mass(-
m_one)
659 call spec%set_vdw_radius(-
m_one)
660 call spec%set_zval(-
m_one)
666 if (icol >= ncols)
exit
672 case (option__species__lmax)
678 call spec%set_user_lmax(user_lmax)
681 "The 'lmax' parameter in species "//trim(spec%get_label())//
" can only be used with pseudopotential species", &
682 row=row, column=icol+1)
685 if (user_lmax < 0)
then
687 "The 'lmax' parameter in species "//trim(spec%get_label())//
" cannot be negative", &
688 row=row, column=icol+1)
691 case (option__species__lloc)
697 call spec%set_user_lloc(user_llocal)
700 "The 'lloc' parameter in species "//trim(spec%get_label())//
" can only be used with pseudopotential species", &
701 row=row, column=icol+1)
704 if (user_llocal < 0)
then
706 "The 'lloc' parameter in species "//trim(spec%get_label())//
" cannot be negative", row=row, column=icol+1)
709 case (option__species__hubbard_l)
715 call spec%set_hubbard_l(hubbard_l)
718 "The 'hubbard_l' parameter in species "//trim(spec%get_label())//
" can only be used with pseudopotential species", &
719 row=row, column=icol+1)
722 if (hubbard_l < 0)
then
724 "The 'hubbard_l' parameter in species "//trim(spec%get_label())//
" cannot be negative", row=row, column=icol+1)
727 case (option__species__hubbard_u)
730 call spec%set_hubbard_u(hubbard_u)
732 case (option__species__hubbard_alpha)
735 call spec%set_hubbard_alpha(hubbard_alpha)
737 case (option__species__hubbard_j)
740 call spec%set_hubbard_j(hubbard_j)
742 if (abs(abs(spec%get_hubbard_j()-spec%get_hubbard_l())-
m_half) <=
m_epsilon)
then
744 trim(spec%get_label())//
" can only be hubbard_l +/- 1/2", row=row, column=icol+1)
747 case (option__species__mass)
750 call spec%set_mass(mass)
752 case (option__species__valence)
755 call spec%set_zval(z_val)
756 call spec%set_z(z_val)
758 case (option__species__jellium_radius)
762 row=row, column=icol+1)
766 call spec%set_radius(jradius)
768 call messages_input_error(namespace,
'Species',
'jellium_radius can only be used with species_jellium', &
769 row=row, column=icol+1)
772 case (option__species__gaussian_width)
776 row=row, column=icol+1)
779 call spec%set_sigma(sigma)
781 call messages_input_error(namespace,
'Species',
'gaussian_width can only be used with species_full_gaussian', &
782 row=row, column=icol+1)
785 case (option__species__anc_a)
789 row=row, column=icol+1)
795 call messages_input_error(namespace,
'Species',
'anc_a can only be used with species_full_anc', &
796 row=row, column=icol+1)
799 case (option__species__softening)
802 softening = softening**2
806 call spec%set_softening2(softening)
808 call messages_input_error(namespace,
'Species',
'softening can only be used with species_soft_coulomb', &
809 row=row, column=icol+1)
812 case (option__species__file)
815 call spec%set_filename(filename)
817 case (option__species__db_file)
818 call messages_write(
"The 'db_file' option for 'Species' block is obsolete. Please use", new_line = .
true.)
819 call messages_write(
"the option 'set' or the variable 'PseudopotentialSet' instead.")
822 case (option__species__set)
828 spec%pseudopotential_set_initialized = .
true.
829 spec%pseudopotential_set_id = pseudopotential_set_id
833 row=row, column=icol+1)
836 case (option__species__potential_formula)
842 call messages_input_error(namespace,
'Species',
'potential_formula can only be used with species_user_defined', &
843 row=row, column=icol+1)
846 case (option__species__volume)
854 call messages_input_error(namespace,
'Species',
'volume can only be used with species_jellium_charge_density', &
855 row=row, column=icol+1)
858 case (option__species__density_formula)
866 call messages_input_error(namespace,
'Species',
'density_formula can only be used with species_charge_density', &
867 row=row, column=icol+1)
870 case (option__species__thickness)
874 if (jthick <=
m_zero)
then
875 call messages_input_error(namespace,
'Species',
'the value of the thickness parameter in species '&
876 //trim(spec%get_label())//
' must be positive.', row=row, column=icol+1)
881 call spec%set_thickness(jthick)
883 call messages_input_error(namespace,
'Species',
'thickness can only be used with species_jellium_slab', &
884 row=row, column=icol+1)
887 case (option__species__vdw_radius)
890 call spec%set_vdw_radius(vdw_radius)
893 call messages_input_error(namespace,
'Species',
"Unknown parameter in species '"//trim(spec%get_label())//
"'", &
894 row=row, column=icol)
906 "The 'softening' parameter is missing for species "//trim(spec%get_label()))
912 "The 'potential_formula' parameter is missing for species '"//trim(spec%get_label())//
"'")
918 "The 'density_formula' parameter is missing for species '"//trim(spec%get_label())//
"'")
924 "The 'file' or 'db_file' parameter is missing for species '"//trim(spec%get_label())//
"'")
930 "The 'thickness' parameter is missing for species '"//trim(spec%get_label())//
"'")
936 "The 'volume' parameter is missing for species '"//trim(spec%get_label())//
"'")
941 if (spec%get_user_lloc() > spec%get_user_lmax())
then
943 "the 'lloc' parameter cannot be larger than the 'lmax' parameter in species "//trim(spec%get_label()))
952 spec%pseudopotential_set_id = factory%default_pseudopotential_set_id
953 spec%pseudopotential_set = factory%default_pseudopotential_set
956 call read_from_set(spec, spec%pseudopotential_set_id, spec%pseudopotential_set, set_read_data)
958 if (set_read_data == 0)
then
959 call messages_write(
'Species '//trim(spec%get_label())//
' is not defined in the requested pseudopotential set.', &
976 if (spec%get_zval() <
m_zero)
then
977 call spec%set_zval(spec%get_z())
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())
998 call spec%set_mass(
m_one)
999 call messages_write(
'Info: default mass for species '//trim(spec%get_label())//
':')
1006 call spec%set_vdw_radius(
m_zero)
1007 call messages_write(
'Info: default vdW radius for species '//trim(spec%get_label())//
':')
1014 if (spec%is_user_defined())
then
1015 call spec%set_zval(
m_zero)
1018 "The 'valence' parameter is missing for species '"//trim(spec%get_label())//
"'")
1031 integer(int64),
intent(in) :: param
1044 integer(int64),
intent(in) :: param
1049 call messages_input_error(namespace,
'Species',
"Duplicated parameter in species '"//trim(spec%get_label())//
"'")
1064 call messages_write(
'Cannot determine the element for species '//trim(spec%get_label())//
'.')
1070 if (spec%get_mass() <
m_zero)
then
1072 call messages_write(
'Info: default mass for species '//trim(spec%get_label())//
':')
1078 if (spec%get_vdw_radius() <
m_zero)
then
1080 if (spec%get_vdw_radius() <
m_zero)
then
1081 call spec%set_vdw_radius(
m_zero)
1082 call messages_write(
"The default vdW radius for species '"//trim(spec%get_label())//
"' is not defined.", &
1084 call messages_write(
"You can specify the vdW radius in %Species block.")
1087 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_)
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...