33 #include "../base/base_uses.f90"
41 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'atomic_kind_types'
46 TYPE(fist_potential_type),
POINTER :: fist_potential => null()
47 CHARACTER(LEN=default_string_length) :: name =
""
48 CHARACTER(LEN=2) :: element_symbol =
""
49 REAL(KIND=
dp) :: mass = 0.0_dp
50 INTEGER :: kind_number = -1
52 INTEGER,
DIMENSION(:),
POINTER :: atom_list => null()
53 LOGICAL :: shell_active = .false.
54 TYPE(shell_kind_type),
POINTER :: shell => null()
55 TYPE(damping_p_type),
POINTER :: damping => null()
56 END TYPE atomic_kind_type
60 TYPE atomic_kind_p_type
61 TYPE(atomic_kind_type),
DIMENSION(:), &
62 POINTER :: atomic_kind_set => null()
63 END TYPE atomic_kind_p_type
74 PUBLIC :: atomic_kind_type
87 TYPE(atomic_kind_type),
DIMENSION(:),
POINTER :: atomic_kind_set
89 INTEGER :: ikind, nkind
91 IF (.NOT.
ASSOCIATED(atomic_kind_set))
THEN
92 CALL cp_abort(__location__, &
93 "The pointer atomic_kind_set is not associated and "// &
94 "cannot be deallocated")
97 nkind =
SIZE(atomic_kind_set)
100 IF (
ASSOCIATED(atomic_kind_set(ikind)%fist_potential))
THEN
101 CALL deallocate_potential(atomic_kind_set(ikind)%fist_potential)
103 IF (
ASSOCIATED(atomic_kind_set(ikind)%atom_list))
THEN
104 DEALLOCATE (atomic_kind_set(ikind)%atom_list)
106 IF (
ASSOCIATED(atomic_kind_set(ikind)%shell))
DEALLOCATE (atomic_kind_set(ikind)%shell)
110 DEALLOCATE (atomic_kind_set)
135 element_symbol, name, mass, kind_number, natom, atom_list, &
136 rcov, rvdw, z, qeff, apol, cpol, mm_radius, &
137 shell, shell_active, damping)
139 TYPE(atomic_kind_type),
INTENT(IN) :: atomic_kind
140 TYPE(fist_potential_type),
OPTIONAL,
POINTER :: fist_potential
141 CHARACTER(LEN=2),
INTENT(OUT),
OPTIONAL :: element_symbol
142 CHARACTER(LEN=default_string_length), &
143 INTENT(OUT),
OPTIONAL :: name
144 REAL(kind=
dp),
INTENT(OUT),
OPTIONAL :: mass
145 INTEGER,
INTENT(OUT),
OPTIONAL :: kind_number, natom
146 INTEGER,
DIMENSION(:),
OPTIONAL,
POINTER :: atom_list
147 REAL(kind=
dp),
INTENT(OUT),
OPTIONAL :: rcov, rvdw
148 INTEGER,
INTENT(OUT),
OPTIONAL :: z
149 REAL(kind=
dp),
INTENT(OUT),
OPTIONAL :: qeff, apol, cpol, mm_radius
150 TYPE(shell_kind_type),
OPTIONAL,
POINTER :: shell
151 LOGICAL,
INTENT(OUT),
OPTIONAL :: shell_active
152 TYPE(damping_p_type),
OPTIONAL,
POINTER :: damping
154 IF (
PRESENT(fist_potential)) fist_potential => atomic_kind%fist_potential
155 IF (
PRESENT(element_symbol)) element_symbol = atomic_kind%element_symbol
156 IF (
PRESENT(name)) name = atomic_kind%name
157 IF (
PRESENT(mass)) mass = atomic_kind%mass
158 IF (
PRESENT(kind_number)) kind_number = atomic_kind%kind_number
159 IF (
PRESENT(natom)) natom = atomic_kind%natom
160 IF (
PRESENT(atom_list)) atom_list => atomic_kind%atom_list
165 IF (
PRESENT(rcov))
THEN
168 IF (
PRESENT(rvdw))
THEN
171 IF (
PRESENT(qeff))
THEN
172 IF (
ASSOCIATED(atomic_kind%fist_potential))
THEN
173 CALL get_potential(potential=atomic_kind%fist_potential, qeff=qeff)
178 IF (
PRESENT(apol))
THEN
179 IF (
ASSOCIATED(atomic_kind%fist_potential))
THEN
180 CALL get_potential(potential=atomic_kind%fist_potential, apol=apol)
185 IF (
PRESENT(cpol))
THEN
186 IF (
ASSOCIATED(atomic_kind%fist_potential))
THEN
187 CALL get_potential(potential=atomic_kind%fist_potential, cpol=cpol)
192 IF (
PRESENT(mm_radius))
THEN
193 IF (
ASSOCIATED(atomic_kind%fist_potential))
THEN
194 CALL get_potential(potential=atomic_kind%fist_potential, mm_radius=mm_radius)
196 mm_radius = -huge(0.0_dp)
199 IF (
PRESENT(shell)) shell => atomic_kind%shell
200 IF (
PRESENT(shell_active)) shell_active = atomic_kind%shell_active
201 IF (
PRESENT(damping)) damping => atomic_kind%damping
221 natom, nshell, fist_potential_present, shell_present, &
222 shell_adiabatic, shell_check_distance, damping_present)
224 TYPE(atomic_kind_type),
DIMENSION(:),
INTENT(IN) :: atomic_kind_set
225 INTEGER,
ALLOCATABLE,
DIMENSION(:),
OPTIONAL :: atom_of_kind, kind_of, natom_of_kind
226 INTEGER,
INTENT(OUT),
OPTIONAL :: maxatom, natom, nshell
227 LOGICAL,
INTENT(OUT),
OPTIONAL :: fist_potential_present, shell_present, &
228 shell_adiabatic, shell_check_distance, &
231 INTEGER :: atom_a, iatom, ikind, my_natom
235 DO ikind = 1,
SIZE(atomic_kind_set)
236 my_natom = my_natom + atomic_kind_set(ikind)%natom
239 IF (
PRESENT(maxatom)) maxatom = 0
240 IF (
PRESENT(natom)) natom = my_natom
241 IF (
PRESENT(nshell)) nshell = 0
242 IF (
PRESENT(shell_present)) shell_present = .false.
243 IF (
PRESENT(shell_adiabatic)) shell_adiabatic = .false.
244 IF (
PRESENT(shell_check_distance)) shell_check_distance = .false.
245 IF (
PRESENT(damping_present)) damping_present = .false.
246 IF (
PRESENT(atom_of_kind))
THEN
247 ALLOCATE (atom_of_kind(my_natom))
250 IF (
PRESENT(kind_of))
THEN
251 ALLOCATE (kind_of(my_natom))
254 IF (
PRESENT(natom_of_kind))
THEN
255 ALLOCATE (natom_of_kind(
SIZE(atomic_kind_set)))
259 DO ikind = 1,
SIZE(atomic_kind_set)
260 associate(atomic_kind => atomic_kind_set(ikind))
261 IF (
PRESENT(maxatom))
THEN
262 maxatom = max(maxatom, atomic_kind%natom)
264 IF (
PRESENT(fist_potential_present))
THEN
265 IF (
ASSOCIATED(atomic_kind%fist_potential))
THEN
266 fist_potential_present = .true.
269 IF (
PRESENT(shell_present))
THEN
270 IF (
ASSOCIATED(atomic_kind%shell))
THEN
271 shell_present = .true.
274 IF (
PRESENT(shell_adiabatic) .AND.
ASSOCIATED(atomic_kind%shell))
THEN
275 IF (.NOT. shell_adiabatic)
THEN
276 shell_adiabatic = (atomic_kind%shell%massfrac /= 0.0_dp)
279 IF (
PRESENT(shell_check_distance) .AND.
ASSOCIATED(atomic_kind%shell))
THEN
280 IF (.NOT. shell_check_distance)
THEN
281 shell_check_distance = (atomic_kind%shell%max_dist > 0.0_dp)
284 IF (
PRESENT(damping_present))
THEN
285 IF (
ASSOCIATED(atomic_kind%damping))
THEN
286 damping_present = .true.
289 IF (
PRESENT(atom_of_kind))
THEN
290 DO iatom = 1, atomic_kind%natom
291 atom_a = atomic_kind%atom_list(iatom)
292 atom_of_kind(atom_a) = iatom
295 IF (
PRESENT(kind_of))
THEN
296 DO iatom = 1, atomic_kind%natom
297 atom_a = atomic_kind%atom_list(iatom)
298 kind_of(atom_a) = ikind
301 IF (
PRESENT(natom_of_kind))
THEN
302 natom_of_kind(ikind) = atomic_kind%natom
325 fist_potential, shell, &
326 shell_active, damping)
328 TYPE(atomic_kind_type),
INTENT(INOUT) :: atomic_kind
329 CHARACTER(LEN=*),
INTENT(IN),
OPTIONAL :: element_symbol, name
330 REAL(kind=dp),
INTENT(IN),
OPTIONAL :: mass
331 INTEGER,
INTENT(IN),
OPTIONAL :: kind_number, natom
332 INTEGER,
DIMENSION(:),
INTENT(IN),
OPTIONAL :: atom_list
333 TYPE(fist_potential_type),
OPTIONAL,
POINTER :: fist_potential
334 TYPE(shell_kind_type),
OPTIONAL,
POINTER :: shell
335 LOGICAL,
INTENT(IN),
OPTIONAL :: shell_active
336 TYPE(damping_p_type),
OPTIONAL,
POINTER :: damping
340 IF (
PRESENT(element_symbol)) atomic_kind%element_symbol = element_symbol
341 IF (
PRESENT(name)) atomic_kind%name = name
342 IF (
PRESENT(mass)) atomic_kind%mass = mass
343 IF (
PRESENT(kind_number)) atomic_kind%kind_number = kind_number
344 IF (
PRESENT(natom)) atomic_kind%natom = natom
345 IF (
PRESENT(atom_list))
THEN
348 IF (
ASSOCIATED(atomic_kind%atom_list))
THEN
349 DEALLOCATE (atomic_kind%atom_list)
351 ALLOCATE (atomic_kind%atom_list(n))
352 atomic_kind%atom_list(:) = atom_list(:)
353 atomic_kind%natom = n
355 cpabort(
"An invalid atom_list was supplied")
358 IF (
PRESENT(fist_potential)) atomic_kind%fist_potential => fist_potential
359 IF (
PRESENT(shell))
THEN
360 IF (
ASSOCIATED(atomic_kind%shell))
THEN
361 IF (.NOT.
ASSOCIATED(atomic_kind%shell, shell))
THEN
362 DEALLOCATE (atomic_kind%shell)
365 atomic_kind%shell => shell
367 IF (
PRESENT(shell_active)) atomic_kind%shell_active = shell_active
369 IF (
PRESENT(damping)) atomic_kind%damping => damping
380 TYPE(atomic_kind_type),
INTENT(IN) :: atomic_kind
383 res = trim(atomic_kind%element_symbol) ==
"H"
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind_set(atomic_kind_set, atom_of_kind, kind_of, natom_of_kind, maxatom, natom, nshell, fist_potential_present, shell_present, shell_adiabatic, shell_check_distance, damping_present)
Get attributes of an atomic kind set.
subroutine, public set_atomic_kind(atomic_kind, element_symbol, name, mass, kind_number, natom, atom_list, fist_potential, shell, shell_active, damping)
Set the components of an atomic kind data set.
subroutine, public get_atomic_kind(atomic_kind, fist_potential, element_symbol, name, mass, kind_number, natom, atom_list, rcov, rvdw, z, qeff, apol, cpol, mm_radius, shell, shell_active, damping)
Get attributes of an atomic kind.
subroutine, public deallocate_atomic_kind_set(atomic_kind_set)
Destructor routine for a set of atomic kinds.
elemental logical function, public is_hydrogen(atomic_kind)
Determines if the atomic_kind is HYDROGEN.
subroutine, public damping_p_release(damping)
Release Data-structure that contains damping information.
Definition of the atomic potential types.
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
Periodic Table related data definitions.
subroutine, public get_ptable_info(symbol, number, amass, ielement, covalent_radius, metallic_radius, vdw_radius, found)
Pass information about the kind given the element symbol.