22 use,
intrinsic :: iso_fortran_env
51 type(namespace_t),
intent(in) :: namespace
53 type(electrons_t),
pointer :: sys
57 integer :: n_centroids
58 real(real64) :: inertia
59 integer(int64),
allocatable :: seeds(:)
60 real(real64),
allocatable :: centroids(:, :)
61 character(len=1),
allocatable :: dummy_species(:)
73 call lcao_run(namespace, sys%space, sys%gr, sys%ions, sys%ext_partners, &
81 sys%st%rho(:, 1),
unit_one, ierr, pos=sys%ions%pos, atoms=sys%ions%atom)
86 allocate(dummy_species(n_centroids), source=
'A')
88 allocate(seeds(1), source=int(101, int64))
89 safe_allocate(centroids(1:sys%space%dim, 1:n_centroids))
94 call weighted_kmeans(sys%space, sys%gr, sys%st%rho(1:sys%gr%np, 1), centroids, inertia=inertia)
95 write(
message(1),
'(a, f18.12)')
"test_weighted_kmeans: inertia", inertia
103 deallocate(dummy_species)
104 safe_deallocate_a(centroids)
106 safe_deallocate_p(sys)
This module handles the calculation mode.
type(calc_mode_par_t), public calc_mode_par
Singleton instance of parallel calculation mode.
integer, parameter, public p_strategy_states
parallelization in states
real(real64), parameter, public lmm_r_single_atom
Default local magnetic moments sphere radius for an isolated system.
character(len= *), parameter, public static_dir
subroutine, public dio_function_output(how, dir, fname, namespace, space, mesh, ff, unit, ierr, pos, atoms, grp, root)
Top-level IO routine for functions defined on the mesh.
subroutine, public write_standard_xyz_file(namespace, fname, pos, species, header)
Write a standard xyz file with atom labels and positions (in Angstrom).
subroutine, public io_close(iunit, grp)
subroutine, public io_mkdir(fname, namespace, parents)
integer function, public io_open(file, namespace, action, status, form, position, die, recl, grp)
subroutine, public weighted_kmeans(space, mesh, weight, centroids, n_iter, centroid_tol, discretize, inertia)
Weighted K-means clustering.
subroutine, public sample_initial_centroids(mesh, centroids, seed_value)
Sample initial centroids from the full mesh.
subroutine, public lcao_run(namespace, space, gr, ions, ext_partners, st, ks, hm, st_start, lmm_r)
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
subroutine, public messages_info(no_lines, iunit, debug_only, stress, all_nodes, namespace)
type(mpi_grp_t), public mpi_world
subroutine, public states_elec_deallocate_wfns(st)
Deallocates the KS wavefunctions defined within a states_elec_t structure.
subroutine, public states_elec_allocate_wfns(st, mesh, wfs_type, skip, packed)
Allocates the KS wavefunctions defined within a states_elec_t structure.
subroutine, public test_weighted_kmeans(namespace)
Test weighted kmeans algorithm for a finite system.
This module defines the unit system, used for input and output.
type(unit_t), public unit_angstrom
For XYZ files.
type(unit_t), public unit_one
some special units required for particular quantities
Class describing the electron system.