42#include "./base/base_uses.f90"
48 LOGICAL,
PRIVATE,
PARAMETER :: debug_this_module = .true.
49 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'nnp_environment_types'
63 INTEGER,
PARAMETER,
PUBLIC :: &
67 INTEGER,
PARAMETER,
PUBLIC :: &
86 INTEGER,
DIMENSION(:),
ALLOCATABLE :: n_rad
87 INTEGER,
DIMENSION(:),
ALLOCATABLE :: n_ang
89 CHARACTER(len=2),
ALLOCATABLE,
DIMENSION(:) :: ele
90 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: nuc_ele
91 LOGICAL :: scale_acsf = .false.
92 LOGICAL :: scale_sigma_acsf = .false.
93 LOGICAL :: center_acsf = .false.
94 LOGICAL :: normnodes = .false.
95 INTEGER :: n_radgrp = -1
96 INTEGER :: n_anggrp = -1
97 INTEGER :: cut_type = -1
98 REAL(kind=
dp) :: eshortmin = -1.0_dp
99 REAL(kind=
dp) :: eshortmax = -1.0_dp
100 REAL(kind=
dp) :: scmax = -1.0_dp
101 REAL(kind=
dp) :: scmin = -1.0_dp
102 REAL(kind=
dp) :: max_cut = -1.0_dp
103 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: atom_energies
105 INTEGER :: n_committee = -1
106 INTEGER :: n_hlayer = -1
107 INTEGER :: n_layer = -1
108 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: n_hnodes
109 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: actfnct
110 INTEGER :: expol = -1
111 LOGICAL :: output_expol = .false.
113 INTEGER :: num_atoms = -1
114 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: atomic_energy
115 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: committee_energy
116 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: ele_ind, nuc_atoms, sort, sort_inv
117 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: coord
118 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: myforce
119 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: committee_forces, committee_stress
120 CHARACTER(len=default_string_length), &
121 ALLOCATABLE,
DIMENSION(:) :: atoms
122 REAL(kind=
dp),
DIMENSION(:, :),
ALLOCATABLE :: nnp_forces
123 REAL(kind=
dp) :: nnp_potential_energy = -1.0_dp
129 LOGICAL :: use_ref_cell = .false.
131 LOGICAL :: bias = .false.
132 LOGICAL :: bias_align = .false.
133 REAL(kind=
dp) :: bias_energy = -1.0_dp
134 REAL(kind=
dp) :: bias_kb = -1.0_dp
135 REAL(kind=
dp) :: bias_sigma0 = -1.0_dp
136 REAL(kind=
dp) :: bias_sigma = -1.0_dp
137 REAL(kind=
dp),
DIMENSION(:, :),
ALLOCATABLE :: bias_forces
138 REAL(kind=
dp),
DIMENSION(:),
ALLOCATABLE :: bias_e_avrg
150 TYPE nnp_symfgrp_type
151 INTEGER :: n_symf = -1
152 INTEGER,
DIMENSION(:),
ALLOCATABLE :: symf
153 INTEGER,
DIMENSION(:),
ALLOCATABLE :: ele_ind
154 CHARACTER(LEN=2),
DIMENSION(:),
ALLOCATABLE :: ele
155 REAL(kind=
dp) :: cutoff = -1.0_dp
174 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: y
175 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: funccut
176 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: eta
177 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: rs
178 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: loc_min
179 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: loc_max
180 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: loc_av
181 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: sigma
182 CHARACTER(len=2),
ALLOCATABLE,
DIMENSION(:) :: ele
183 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: nuc_ele
184 INTEGER :: n_symfgrp = -1
185 TYPE(nnp_symfgrp_type),
DIMENSION(:),
ALLOCATABLE :: symfgrp
205 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: y
206 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: funccut
207 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: eta
208 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: zeta
209 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: prefzeta
210 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: lam
211 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: loc_min
212 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: loc_max
213 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: loc_av
214 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: sigma
215 CHARACTER(len=2),
ALLOCATABLE,
DIMENSION(:) :: ele1
216 CHARACTER(len=2),
ALLOCATABLE,
DIMENSION(:) :: ele2
217 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: nuc_ele1
218 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: nuc_ele2
219 INTEGER :: n_symfgrp = -1
220 TYPE(nnp_symfgrp_type),
DIMENSION(:),
ALLOCATABLE :: symfgrp
231 INTEGER,
DIMENSION(3) :: pbc_copies = -1
232 INTEGER,
DIMENSION(:),
ALLOCATABLE :: n_rad
233 INTEGER,
DIMENSION(:),
ALLOCATABLE :: n_ang1
234 INTEGER,
DIMENSION(:),
ALLOCATABLE :: n_ang2
235 INTEGER,
DIMENSION(:, :),
ALLOCATABLE :: ind_rad
236 INTEGER,
DIMENSION(:, :),
ALLOCATABLE :: ind_ang1
237 INTEGER,
DIMENSION(:, :),
ALLOCATABLE :: ind_ang2
238 REAL(kind=
dp),
DIMENSION(:, :, :),
ALLOCATABLE :: dist_rad
239 REAL(kind=
dp),
DIMENSION(:, :, :),
ALLOCATABLE :: dist_ang1
240 REAL(kind=
dp),
DIMENSION(:, :, :),
ALLOCATABLE :: dist_ang2
249 TYPE(nnp_arc_layer_type),
POINTER,
DIMENSION(:) :: layer => null()
250 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: n_nodes
258 TYPE nnp_arc_layer_type
259 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: weights
260 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: bweights
261 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: node
262 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: node_grad
263 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: tmp_der
276 TYPE(
nnp_type),
INTENT(INOUT) :: nnp_env
280 IF (
ASSOCIATED(nnp_env%rad))
THEN
281 DO i = 1, nnp_env%n_ele
282 DO j = 1, nnp_env%rad(i)%n_symfgrp
283 DEALLOCATE (nnp_env%rad(i)%symfgrp(j)%symf, &
284 nnp_env%rad(i)%symfgrp(j)%ele, &
285 nnp_env%rad(i)%symfgrp(j)%ele_ind)
287 DEALLOCATE (nnp_env%rad(i)%y, &
288 nnp_env%rad(i)%funccut, &
289 nnp_env%rad(i)%eta, &
291 nnp_env%rad(i)%loc_min, &
292 nnp_env%rad(i)%loc_max, &
293 nnp_env%rad(i)%loc_av, &
294 nnp_env%rad(i)%sigma, &
295 nnp_env%rad(i)%ele, &
296 nnp_env%rad(i)%nuc_ele, &
297 nnp_env%rad(i)%symfgrp)
299 DEALLOCATE (nnp_env%rad)
302 IF (
ASSOCIATED(nnp_env%ang))
THEN
303 DO i = 1, nnp_env%n_ele
304 DO j = 1, nnp_env%ang(i)%n_symfgrp
305 DEALLOCATE (nnp_env%ang(i)%symfgrp(j)%symf, &
306 nnp_env%ang(i)%symfgrp(j)%ele, &
307 nnp_env%ang(i)%symfgrp(j)%ele_ind)
309 DEALLOCATE (nnp_env%ang(i)%y, &
310 nnp_env%ang(i)%funccut, &
311 nnp_env%ang(i)%eta, &
312 nnp_env%ang(i)%zeta, &
313 nnp_env%ang(i)%prefzeta, &
314 nnp_env%ang(i)%lam, &
315 nnp_env%ang(i)%loc_min, &
316 nnp_env%ang(i)%loc_max, &
317 nnp_env%ang(i)%loc_av, &
318 nnp_env%ang(i)%sigma, &
319 nnp_env%ang(i)%ele1, &
320 nnp_env%ang(i)%ele2, &
321 nnp_env%ang(i)%nuc_ele1, &
322 nnp_env%ang(i)%nuc_ele2, &
323 nnp_env%ang(i)%symfgrp)
325 DEALLOCATE (nnp_env%ang)
328 IF (
ASSOCIATED(nnp_env%arc))
THEN
329 DO i = 1, nnp_env%n_ele
330 IF (
ASSOCIATED(nnp_env%arc(i)%layer))
THEN
331 DO j = 1, nnp_env%n_layer
332 IF (
ALLOCATED(nnp_env%arc(i)%layer(j)%node))
THEN
333 DEALLOCATE (nnp_env%arc(i)%layer(j)%node)
335 IF (
ALLOCATED(nnp_env%arc(i)%layer(j)%node_grad))
THEN
336 DEALLOCATE (nnp_env%arc(i)%layer(j)%node_grad)
338 IF (
ALLOCATED(nnp_env%arc(i)%layer(j)%weights))
THEN
339 DEALLOCATE (nnp_env%arc(i)%layer(j)%weights)
341 IF (
ALLOCATED(nnp_env%arc(i)%layer(j)%bweights))
THEN
342 DEALLOCATE (nnp_env%arc(i)%layer(j)%bweights)
344 IF (
ALLOCATED(nnp_env%arc(i)%layer(j)%tmp_der))
THEN
345 DEALLOCATE (nnp_env%arc(i)%layer(j)%tmp_der)
348 DEALLOCATE (nnp_env%arc(i)%layer, &
349 nnp_env%arc(i)%n_nodes)
352 DEALLOCATE (nnp_env%arc)
355 IF (
ALLOCATED(nnp_env%ele))
DEALLOCATE (nnp_env%ele)
356 IF (
ALLOCATED(nnp_env%nuc_ele))
DEALLOCATE (nnp_env%nuc_ele)
357 IF (
ALLOCATED(nnp_env%n_hnodes))
DEALLOCATE (nnp_env%n_hnodes)
358 IF (
ALLOCATED(nnp_env%actfnct))
DEALLOCATE (nnp_env%actfnct)
359 IF (
ALLOCATED(nnp_env%nnp_forces))
DEALLOCATE (nnp_env%nnp_forces)
360 IF (
ALLOCATED(nnp_env%atomic_energy))
DEALLOCATE (nnp_env%atomic_energy)
361 IF (
ALLOCATED(nnp_env%committee_energy))
DEALLOCATE (nnp_env%committee_energy)
362 IF (
ALLOCATED(nnp_env%ele_ind))
DEALLOCATE (nnp_env%ele_ind)
363 IF (
ALLOCATED(nnp_env%nuc_atoms))
DEALLOCATE (nnp_env%nuc_atoms)
364 IF (
ALLOCATED(nnp_env%sort))
DEALLOCATE (nnp_env%sort)
365 IF (
ALLOCATED(nnp_env%sort_inv))
DEALLOCATE (nnp_env%sort_inv)
366 IF (
ALLOCATED(nnp_env%coord))
DEALLOCATE (nnp_env%coord)
367 IF (
ALLOCATED(nnp_env%myforce))
DEALLOCATE (nnp_env%myforce)
368 IF (
ALLOCATED(nnp_env%committee_forces))
DEALLOCATE (nnp_env%committee_forces)
369 IF (
ALLOCATED(nnp_env%committee_stress))
DEALLOCATE (nnp_env%committee_stress)
370 IF (
ALLOCATED(nnp_env%atoms))
DEALLOCATE (nnp_env%atoms)
371 IF (
ALLOCATED(nnp_env%nnp_forces))
DEALLOCATE (nnp_env%nnp_forces)
373 IF (
ASSOCIATED(nnp_env%subsys))
THEN
376 IF (
ASSOCIATED(nnp_env%subsys))
THEN
379 IF (
ASSOCIATED(nnp_env%cell))
THEN
382 IF (
ASSOCIATED(nnp_env%cell_ref))
THEN
414 atomic_kind_set, particle_set, local_particles, &
415 molecule_kind_set, molecule_set, local_molecules, &
416 nnp_input, force_env_input, cell, cell_ref, &
417 use_ref_cell, nnp_potential_energy, virial)
419 TYPE(
nnp_type),
INTENT(IN) :: nnp_env
420 REAL(kind=
dp),
DIMENSION(:, :),
OPTIONAL,
POINTER :: nnp_forces
423 POINTER :: atomic_kind_set
425 POINTER :: particle_set
428 POINTER :: molecule_kind_set
430 POINTER :: molecule_set
433 TYPE(
cell_type),
OPTIONAL,
POINTER :: cell, cell_ref
434 LOGICAL,
INTENT(OUT),
OPTIONAL :: use_ref_cell
435 REAL(kind=
dp),
INTENT(OUT),
OPTIONAL :: nnp_potential_energy
443 NULLIFY (atomic_kinds, particles, molecules, molecule_kinds)
445 IF (
PRESENT(nnp_potential_energy))
THEN
446 nnp_potential_energy = nnp_env%nnp_potential_energy
448 IF (
PRESENT(nnp_forces)) nnp_forces = nnp_env%nnp_forces
452 IF (
PRESENT(cell)) cell => nnp_env%cell
454 IF (
PRESENT(subsys)) subsys => nnp_env%subsys
455 IF (
ASSOCIATED(nnp_env%subsys))
THEN
457 atomic_kinds=atomic_kinds, &
458 particles=particles, &
459 molecule_kinds=molecule_kinds, &
460 molecules=molecules, &
461 local_molecules=local_molecules, &
462 local_particles=local_particles, &
466 IF (
PRESENT(atomic_kind_set)) atomic_kind_set => atomic_kinds%els
467 IF (
PRESENT(particle_set)) particle_set => particles%els
468 IF (
PRESENT(molecule_kind_set)) molecule_kind_set => molecule_kinds%els
469 IF (
PRESENT(molecule_set)) molecule_set => molecules%els
471 IF (
PRESENT(nnp_input)) nnp_input => nnp_env%nnp_input
472 IF (
PRESENT(force_env_input)) force_env_input => nnp_env%force_env_input
473 IF (
PRESENT(cell_ref)) cell_ref => nnp_env%cell_ref
474 IF (
PRESENT(use_ref_cell)) use_ref_cell = nnp_env%use_ref_cell
502 atomic_kind_set, particle_set, local_particles, &
503 molecule_kind_set, molecule_set, local_molecules, &
504 nnp_input, force_env_input, cell, cell_ref, &
505 use_ref_cell, nnp_potential_energy)
507 TYPE(
nnp_type),
INTENT(INOUT) :: nnp_env
508 REAL(kind=
dp),
DIMENSION(:, :),
OPTIONAL,
POINTER :: nnp_forces
511 POINTER :: atomic_kind_set
513 POINTER :: particle_set
516 POINTER :: molecule_kind_set
518 POINTER :: molecule_set
521 TYPE(
cell_type),
OPTIONAL,
POINTER :: cell, cell_ref
522 LOGICAL,
INTENT(IN),
OPTIONAL :: use_ref_cell
523 REAL(kind=
dp),
INTENT(IN),
OPTIONAL :: nnp_potential_energy
530 IF (
PRESENT(nnp_potential_energy))
THEN
531 nnp_env%nnp_potential_energy = nnp_potential_energy
533 IF (
PRESENT(nnp_forces)) nnp_env%nnp_forces(:, :) = nnp_forces
535 IF (
PRESENT(subsys))
THEN
536 IF (
ASSOCIATED(nnp_env%subsys))
THEN
537 IF (.NOT.
ASSOCIATED(nnp_env%subsys, subsys))
THEN
541 nnp_env%subsys => subsys
543 IF (
PRESENT(cell))
THEN
544 IF (
ASSOCIATED(cell))
THEN
549 IF (
ASSOCIATED(nnp_env%subsys))
THEN
553 IF (
PRESENT(atomic_kind_set))
THEN
555 CALL cp_subsys_set(nnp_env%subsys, atomic_kinds=atomic_kinds)
558 IF (
PRESENT(particle_set))
THEN
563 IF (
PRESENT(molecule_kind_set))
THEN
565 CALL cp_subsys_set(nnp_env%subsys, molecule_kinds=molecule_kinds)
568 IF (
PRESENT(molecule_set))
THEN
573 IF (
PRESENT(local_particles))
THEN
574 CALL cp_subsys_set(nnp_env%subsys, local_particles=local_particles)
576 IF (
PRESENT(local_molecules))
THEN
577 CALL cp_subsys_set(nnp_env%subsys, local_molecules=local_molecules)
580 IF (
PRESENT(nnp_input)) nnp_env%nnp_input => nnp_input
581 IF (
PRESENT(force_env_input))
THEN
582 nnp_env%force_env_input => force_env_input
584 IF (
PRESENT(cell_ref))
THEN
587 nnp_env%cell_ref => cell_ref
589 IF (
PRESENT(use_ref_cell)) nnp_env%use_ref_cell = use_ref_cell
represent a simple array based list of the given type
subroutine, public atomic_kind_list_release(list)
releases a list (see doc/ReferenceCounting.html)
subroutine, public atomic_kind_list_create(list, els_ptr, owns_els, n_els)
creates a list
Define the atomic kind types and their sub types.
Handles all functions related to the CELL.
subroutine, public cell_release(cell)
releases the given cell (see doc/ReferenceCounting.html)
subroutine, public cell_retain(cell)
retains the given cell (see doc/ReferenceCounting.html)
types that represent a subsys, i.e. a part of the system
subroutine, public cp_subsys_release(subsys)
releases a subsys (see doc/ReferenceCounting.html)
subroutine, public cp_subsys_set(subsys, atomic_kinds, particles, local_particles, molecules, molecule_kinds, local_molecules, para_env, colvar_p, shell_particles, core_particles, gci, multipoles, results, cell)
sets various propreties of the subsys
subroutine, public cp_subsys_get(subsys, ref_count, atomic_kinds, atomic_kind_set, particles, particle_set, local_particles, molecules, molecule_set, molecule_kinds, molecule_kind_set, local_molecules, para_env, colvar_p, shell_particles, core_particles, gci, multipoles, natom, nparticle, ncore, nshell, nkind, atprop, virial, results, cell)
returns information about various attributes of the given subsys
stores a lists of integer that are local to a processor. The idea is that these integers represent ob...
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
represent a simple array based list of the given type
subroutine, public molecule_kind_list_create(list, els_ptr, owns_els, n_els)
creates a list
subroutine, public molecule_kind_list_release(list)
releases a list (see doc/ReferenceCounting.html)
Define the molecule kind structure types and the corresponding functionality.
represent a simple array based list of the given type
subroutine, public molecule_list_create(list, els_ptr, owns_els, n_els)
creates a list
subroutine, public molecule_list_release(list)
releases a list (see doc/ReferenceCounting.html)
Define the data structure for the molecule information.
Data types for neural network potentials.
integer, parameter, public nnp_actfnct_lin
integer, parameter, public nnp_cut_tanh
subroutine, public nnp_env_set(nnp_env, nnp_forces, subsys, atomic_kind_set, particle_set, local_particles, molecule_kind_set, molecule_set, local_molecules, nnp_input, force_env_input, cell, cell_ref, use_ref_cell, nnp_potential_energy)
Sets various attributes of the nnp environment.
integer, parameter, public nnp_actfnct_cos
integer, parameter, public nnp_actfnct_invsig
integer, parameter, public nnp_actfnct_sig
integer, parameter, public nnp_actfnct_exp
integer, parameter, public nnp_cut_cos
derived data types
integer, parameter, public nnp_actfnct_softplus
integer, parameter, public nnp_actfnct_quad
integer, parameter, public nnp_actfnct_gaus
subroutine, public nnp_env_get(nnp_env, nnp_forces, subsys, atomic_kind_set, particle_set, local_particles, molecule_kind_set, molecule_set, local_molecules, nnp_input, force_env_input, cell, cell_ref, use_ref_cell, nnp_potential_energy, virial)
Returns various attributes of the nnp environment.
subroutine, public nnp_env_release(nnp_env)
Release data structure that holds all the information for neural network potentials.
integer, parameter, public nnp_actfnct_tanh
represent a simple array based list of the given type
subroutine, public particle_list_create(list, els_ptr, owns_els, n_els)
creates a list
subroutine, public particle_list_release(list)
releases a list (see doc/ReferenceCounting.html)
Define the data structure for the particle information.
represent a list of objects
Provides all information about an atomic kind.
Type defining parameters related to the simulation cell.
represents a system: atoms, molecules, their pos,vel,...
structure to store local (to a processor) ordered lists of integers.
represent a list of objects
represent a list of objects
Set of angular symmetry function type.
Set of radial symmetry function type.
Data type for artificial neural networks.
Contains neighbors list of an atom.
Main data type collecting all relevant data for neural network potentials.
represent a list of objects