21 USE ieee_arithmetic,
ONLY: ieee_is_finite
30#include "../base/base_uses.f90"
37 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'atom_upf'
51 SUBROUTINE atom_read_upf(pot, upf_filename, read_header, read_augmentation)
54 CHARACTER(len=*),
INTENT(IN) :: upf_filename
55 LOGICAL,
INTENT(IN),
OPTIONAL :: read_header, read_augmentation
57 CHARACTER(LEN=2) :: symbol
58 INTEGER :: l, ncore, nel
59 LOGICAL :: readall, readaug
61 IF (
PRESENT(read_header))
THEN
62 readall = .NOT. read_header
67 IF (
PRESENT(read_augmentation)) readaug = read_augmentation
70 pot%filename = adjustl(trim(upf_filename))
73 l = len_trim(pot%filename)
75 IF (pot%filename(l - 4:l) ==
'.json')
THEN
81 CALL atom_read_upf_v2(pot, upf_filename, readall, readaug)
84 IF (sum(pot%econf) == 0)
THEN
85 symbol = adjustl(trim(pot%symbol))
87 pot%econf(0:3) =
ptable(ncore)%e_conv(0:3)
88 nel = nint(ncore - pot%zion)
91 cpabort(
"Unknown Core State")
95 pot%econf(0:3) = pot%econf(0:3) -
ptable(2)%e_conv(0:3)
97 pot%econf(0:3) = pot%econf(0:3) -
ptable(10)%e_conv(0:3)
99 pot%econf(0:3) = pot%econf(0:3) -
ptable(18)%e_conv(0:3)
101 pot%econf(0:3) = pot%econf(0:3) -
ptable(18)%e_conv(0:3)
102 pot%econf(2) = pot%econf(2) - 10
104 pot%econf(0:3) = pot%econf(0:3) -
ptable(36)%e_conv(0:3)
106 pot%econf(0:3) = pot%econf(0:3) -
ptable(36)%e_conv(0:3)
107 pot%econf(2) = pot%econf(2) - 10
109 pot%econf(0:3) = pot%econf(0:3) -
ptable(54)%e_conv(0:3)
111 pot%econf(0:3) = pot%econf(0:3) -
ptable(36)%e_conv(0:3)
112 pot%econf(2) = pot%econf(2) - 10
113 pot%econf(3) = pot%econf(3) - 14
116 pot%econf(0:3) = pot%econf(0:3) - [10, 18, 20, 14]
118 pot%econf(0:3) = pot%econf(0:3) -
ptable(54)%e_conv(0:3)
119 pot%econf(3) = pot%econf(3) - 14
121 pot%econf(0:3) = pot%econf(0:3) -
ptable(54)%e_conv(0:3)
122 pot%econf(2) = pot%econf(2) - 10
123 pot%econf(3) = pot%econf(3) - 14
126 cpassert(all(pot%econf >= 0))
130 IF (pot%pname ==
"")
THEN
131 pot%pname = adjustl(trim(pot%symbol))
143 SUBROUTINE atom_read_upf_v2(pot, upf_filename, readall, readaug)
146 CHARACTER(len=*),
INTENT(IN) :: upf_filename
147 LOGICAL,
INTENT(IN) :: readall, readaug
149 CHARACTER(LEN=default_string_length) :: nametag
155 CALL parser_create(parser, upf_filename, apply_preprocessing=.false.)
161 IF (nametag(1:1) /=
"<") cycle
164 IF (nametag(2:4) ==
"UPF")
THEN
168 pot%version = trim(nametag)
169 cpassert(nametag(1:5) ==
"2.0.1")
171 cpassert(nametag(1:1) ==
">")
174 ELSE IF (ntag == 1)
THEN
176 IF (nametag(2:8) ==
"PP_INFO")
THEN
177 cpassert(nametag(9:9) ==
">")
178 CALL upf_info_section(parser, pot)
179 ELSE IF (nametag(2:10) ==
"PP_HEADER")
THEN
180 IF (.NOT. (nametag(11:11) ==
">"))
THEN
181 CALL upf_header_option(parser, pot)
183 IF (readaug .AND. pot%is_ultrasoft .AND. .NOT. pot%is_paw .AND. pot%has_wfc)
THEN
184 cpassert(.NOT.
ALLOCATED(pot%partial_waves))
185 ALLOCATE (pot%partial_waves)
187 ELSE IF (nametag(2:8) ==
"PP_MESH")
THEN
188 IF (.NOT. (nametag(9:9) ==
">"))
THEN
189 CALL upf_mesh_option(parser, pot)
191 CALL upf_mesh_section(parser, pot)
192 ELSE IF (nametag(2:8) ==
"PP_NLCC")
THEN
193 IF (nametag(9:9) ==
">")
THEN
194 CALL upf_nlcc_section(parser, pot, .false.)
196 CALL upf_nlcc_section(parser, pot, .true.)
198 ELSE IF (nametag(2:9) ==
"PP_LOCAL")
THEN
199 IF (nametag(10:10) ==
">")
THEN
200 CALL upf_local_section(parser, pot, .false.)
202 CALL upf_local_section(parser, pot, .true.)
204 ELSE IF (nametag(2:12) ==
"PP_NONLOCAL")
THEN
205 cpassert(nametag(13:13) ==
">")
206 CALL upf_nonlocal_section(parser, pot, readaug)
207 ELSE IF (nametag(2:13) ==
"PP_SEMILOCAL")
THEN
208 CALL upf_semilocal_section(parser, pot)
209 ELSE IF (nametag(2:9) ==
"PP_PSWFC")
THEN
211 ELSE IF (nametag(2:12) ==
"PP_FULL_WFC")
THEN
212 IF (
ALLOCATED(pot%partial_waves))
THEN
213 CALL upf_full_wfc_section(parser, pot%partial_waves, nametag, pot%mesh_size, pot%number_of_proj)
215 ELSE IF (nametag(2:11) ==
"PP_RHOATOM")
THEN
217 ELSE IF (nametag(2:7) ==
"PP_PAW")
THEN
219 ELSE IF (nametag(2:6) ==
"/UPF>")
THEN
229 IF (
ALLOCATED(pot%beta))
THEN
230 cpassert(
ALLOCATED(pot%r) .AND.
ALLOCATED(pot%rab))
231 DO ib = 1, pot%number_of_proj
232 IF (pot%r(1) == 0.0_dp)
THEN
233 pot%beta(2:, ib) = pot%beta(2:, ib)/pot%r(2:)
235 pot%beta(:, ib) = pot%beta(:, ib)/pot%r(:)
242 IF (pot%is_ultrasoft .AND. .NOT. readaug)
THEN
243 cpabort(
"UPF ultrasoft pseudopotential not implemented")
246 cpabort(
"UPF PAW potential not implemented")
249 IF (readaug .AND. pot%is_ultrasoft .AND. .NOT. pot%is_paw)
THEN
250 cpassert(
ALLOCATED(pot%qij) .AND.
ALLOCATED(pot%qijl))
253 IF (
ALLOCATED(pot%partial_waves))
THEN
254 cpassert(
ALLOCATED(pot%partial_waves%ae_wfc))
255 cpassert(
ALLOCATED(pot%partial_waves%ps_wfc))
256 cpassert(all(pot%partial_waves%angular_momenta == pot%lbeta))
259 END SUBROUTINE atom_read_upf_v2
266 SUBROUTINE upf_info_section(parser, pot)
270 CHARACTER(LEN=default_string_length) :: line, string
271 INTEGER :: icount, iline
277 cpassert(.NOT. at_end)
278 iline = parser%buffer%present_line_number
279 line = trim(parser%buffer%input_lines(iline))
281 IF (string(1:10) ==
"</PP_INFO>")
EXIT
283 IF (icount > pot%maxinfo) cycle
284 pot%info(icount) = line
288 END SUBROUTINE upf_info_section
295 SUBROUTINE upf_header_option(parser, pot)
299 CHARACTER(LEN=default_string_length) :: string
305 cpassert(.NOT. at_end)
308 IF (string ==
"/>")
EXIT
320 cpassert(2 <= len(pot%symbol))
323 CASE (
"RELATIVISTIC")
325 CASE (
"IS_ULTRASOFT")
337 CASE (
"PAW_AS_GIPAW")
339 CASE (
"CORE_CORRECTION")
345 CASE (
"TOTAL_PSENERGY")
359 CASE (
"NUMBER_OF_WFC")
361 CASE (
"NUMBER_OF_PROJ")
365 CALL cp_abort(__location__,
"Error while parsing UPF header: "// &
366 "Adjust format of delimiters ... only double quotes are admissible.")
370 END SUBROUTINE upf_header_option
377 SUBROUTINE upf_mesh_option(parser, pot)
381 CHARACTER(LEN=default_string_length) :: string
388 cpassert(.NOT. at_end)
391 IF (string ==
">")
EXIT
401 cpassert(pot%mesh_size == jj)
405 cpabort(
"Unknown UPF PP_MESH option <"//trim(string)//
"> found")
410 END SUBROUTINE upf_mesh_option
417 SUBROUTINE upf_mesh_section(parser, pot)
421 CHARACTER(LEN=default_string_length) :: line, string, string2
422 INTEGER :: icount, m, mc, ms
427 cpassert(.NOT. at_end)
430 CASE (
"<PP_R",
"<PP_R>")
434 IF (string /=
"<PP_R>")
THEN
439 cpassert(.NOT. at_end)
442 IF (string2 ==
">")
EXIT
443 SELECT CASE (string2)
446 cpassert(line ==
"REAL")
453 cpabort(
"Unknown UPF PP_R option <"//trim(string2)//
"> found")
460 DO WHILE (icount <= ms)
463 cpassert(.NOT. at_end)
469 CASE (
"<PP_RAB",
"<PP_RAB>")
473 IF (string /=
"<PP_RAB>")
THEN
478 cpassert(.NOT. at_end)
481 IF (string2 ==
">")
EXIT
482 SELECT CASE (string2)
485 cpassert(line ==
"REAL")
492 cpabort(
"Unknown UPF PP_RAB option <"//trim(string2)//
"> found")
496 ALLOCATE (pot%rab(m))
499 DO WHILE (icount <= ms)
502 cpassert(.NOT. at_end)
515 END SUBROUTINE upf_mesh_section
523 SUBROUTINE upf_nlcc_section(parser, pot, options)
526 LOGICAL,
INTENT(IN) :: options
528 CHARACTER(LEN=default_string_length) :: line, string
529 INTEGER :: icount, m, mc, ms
539 cpassert(.NOT. at_end)
542 IF (string ==
">")
EXIT
546 cpassert(line ==
"REAL")
553 cpabort(
"Unknown UPF PP_NLCC option <"//trim(string)//
"> found")
558 ALLOCATE (pot%rho_nlcc(m))
559 pot%rho_nlcc = 0.0_dp
561 DO WHILE (icount <= ms)
564 cpassert(.NOT. at_end)
572 cpassert(.NOT. at_end)
574 cpassert(string ==
"</PP_NLCC>")
576 END SUBROUTINE upf_nlcc_section
584 SUBROUTINE upf_local_section(parser, pot, options)
587 LOGICAL,
INTENT(IN) :: options
589 CHARACTER(LEN=default_string_length) :: line, string
590 INTEGER :: icount, m, mc, ms
600 cpassert(.NOT. at_end)
603 IF (string ==
">")
EXIT
607 cpassert(line ==
"REAL")
614 cpabort(
"Unknown UPF PP_LOCAL option <"//trim(string)//
"> found")
619 ALLOCATE (pot%vlocal(m))
622 DO WHILE (icount <= ms)
625 cpassert(.NOT. at_end)
633 pot%vlocal = 0.5_dp*pot%vlocal
636 cpassert(.NOT. at_end)
638 cpassert(string ==
"</PP_LOCAL>")
640 END SUBROUTINE upf_local_section
648 SUBROUTINE upf_nonlocal_section(parser, pot, readaug)
651 LOGICAL,
INTENT(IN) :: readaug
653 CHARACTER(LEN=default_string_length) :: line, string
654 INTEGER :: i1, i2, ibeta, icount, la, m, mc, ms, &
659 nbeta = pot%number_of_proj
660 ALLOCATE (pot%dion(nbeta, nbeta), pot%beta(m, nbeta), pot%lbeta(nbeta))
668 cpassert(.NOT. at_end)
670 IF (string(1:8) ==
"<PP_BETA")
THEN
675 cpassert(ibeta <= nbeta)
679 cpassert(.NOT. at_end)
682 IF (string ==
">")
EXIT
686 cpassert(line ==
"REAL")
694 cpassert(i1 <= nbeta)
695 CASE (
"ANGULAR_MOMENTUM")
700 CASE (
"CUTOFF_RADIUS_INDEX")
703 CASE (
"CUTOFF_RADIUS")
706 CASE (
"ULTRASOFT_CUTOFF_RADIUS")
710 cpabort(
"Unknown UPF PP_BETA option <"//trim(string)//
"> found")
715 DO WHILE (icount <= ms)
718 cpassert(.NOT. at_end)
724 ELSE IF (string(1:7) ==
"<PP_DIJ")
THEN
726 IF (string /=
"<PP_DIJ>")
THEN
730 cpassert(.NOT. at_end)
733 IF (string ==
">")
EXIT
737 cpassert(line ==
"REAL")
740 cpassert(ms == nbeta*nbeta)
744 cpabort(
"Unknown UPF PP_DIJ option <"//trim(string)//
"> found")
749 DO WHILE (icount <= ms)
752 cpassert(.NOT. at_end)
754 i1 = (icount - 1)/nbeta + 1
755 i2 = mod(icount - 1, nbeta) + 1
760 ELSE IF (string(1:16) ==
"<PP_AUGMENTATION")
THEN
761 IF (readaug .AND. .NOT. pot%is_paw)
CALL upf_augmentation_section(parser, pot)
762 ELSE IF (string(1:14) ==
"</PP_NONLOCAL>")
THEN
773 pot%dion = 0.5_dp*pot%dion
775 END SUBROUTINE upf_nonlocal_section
785 SUBROUTINE upf_augmentation_section(parser, pot)
789 CHARACTER(LEN=default_string_length) :: string, tag, value
790 INTEGER :: i, j, k, l, lmax, m, nb, nc, nqf, nqlc, &
791 pair, size_data, tag_i, tag_j, tag_l
792 LOGICAL :: at_end, is_null, q_with_l, read_q, &
794 LOGICAL,
ALLOCATABLE :: present_channel(:, :)
796 cpassert(.NOT.
ALLOCATED(pot%qij) .AND. .NOT.
ALLOCATED(pot%qijl))
797 cpassert(all(pot%lbeta >= 0))
798 nb = pot%number_of_proj
800 lmax = 2*maxval(pot%lbeta)
807 cpassert(.NOT. at_end)
810 IF (string ==
">")
EXIT
819 cpabort(
"Unknown UPF PP_AUGMENTATION option <"//trim(string)//
"> found")
822 IF (.NOT. q_with_l .OR. nqf /= 0)
THEN
823 cpabort(
"Native USPP import requires angular-resolved PP_QIJL with nqf=0")
825 IF (nqlc == 0) nqlc = lmax + 1
826 cpassert(nqlc >= lmax + 1)
828 ALLOCATE (pot%qij(nb, nb), pot%qijl(m, nc, 0:lmax), present_channel(nc, 0:lmax))
831 present_channel = .false.
835 cpassert(.NOT. at_end)
837 IF (tag ==
"</PP_AUGMENTATION>")
EXIT
838 IF (tag(1:2) ==
"</") cycle
839 cpassert(tag(1:8) ==
"<PP_QIJL" .OR. tag ==
"<PP_Q" .OR. tag ==
"<PP_Q>")
845 IF (tag ==
"<PP_Q" .OR. tag ==
"<PP_Q>") size_data = nb*nb
847 self_closing = .false.
848 IF (tag /=
"<PP_Q>")
THEN
852 cpassert(.NOT. at_end)
855 IF (string ==
">")
EXIT
856 IF (string ==
"/>")
THEN
857 self_closing = .true.
863 cpassert(
value ==
"REAL")
870 CASE (
"SECOND_INDEX")
872 CASE (
"COMPOSITE_INDEX")
874 CASE (
"ANGULAR_MOMENTUM")
879 cpabort(
"Unknown UPF augmentation array option <"//trim(string)//
"> found")
883 IF (tag(1:8) ==
"<PP_QIJL")
THEN
884 cpassert(i >= 1 .AND. i <= j .AND. j <= nb)
885 cpassert(pair == j*(j - 1)/2 + i)
886 cpassert(l >= abs(pot%lbeta(i) - pot%lbeta(j)))
887 cpassert(l <= pot%lbeta(i) + pot%lbeta(j))
888 cpassert(
modulo(pot%lbeta(i) + pot%lbeta(j) - l, 2) == 0)
891 DO k = 1, len_trim(string)
892 IF (string(k:k) ==
".") string(k:k) =
" "
894 READ (string, *) tag_i, tag_j, tag_l
895 cpassert(tag_i == i .AND. tag_j == j .AND. tag_l == l)
896 cpassert(.NOT. present_channel(pair, l))
897 present_channel(pair, l) = .true.
899 cpassert(self_closing .AND. size_data == 0)
902 cpassert(.NOT. self_closing .AND. size_data == m)
906 cpassert(.NOT. at_end)
911 cpassert(.NOT. read_q .AND. .NOT. self_closing .AND. .NOT. is_null)
912 cpassert(size_data == nb*nb)
917 cpassert(.NOT. at_end)
928 pair = j*(j - 1)/2 + i
929 DO l = abs(pot%lbeta(i) - pot%lbeta(j)), pot%lbeta(i) + pot%lbeta(j), 2
930 cpassert(present_channel(pair, l))
934 END SUBROUTINE upf_augmentation_section
941 SUBROUTINE upf_semilocal_section(parser, pot)
945 CHARACTER(LEN=default_string_length) :: line, string
946 INTEGER :: i1, ib, icount, la, lmax, m, mc, ms
951 ALLOCATE (pot%vsemi(m, lmax + 1))
957 cpassert(.NOT. at_end)
959 IF (string(1:7) ==
"<PP_VNL")
THEN
964 cpassert(ib <= lmax + 1)
968 cpassert(.NOT. at_end)
971 IF (string ==
">")
EXIT
975 cpassert(line ==
"REAL")
984 cpabort(
"Unknown UPF PP_VNL option <"//trim(string)//
"> found")
989 DO WHILE (icount <= ms)
992 cpassert(.NOT. at_end)
998 ELSE IF (string(1:15) ==
"</PP_SEMILOCAL>")
THEN
1005 pot%vsemi = 0.5_dp*pot%vsemi
1007 END SUBROUTINE upf_semilocal_section
1014 SUBROUTINE upf_next_line(parser, at_end)
1016 LOGICAL,
INTENT(OUT) :: at_end
1018 CHARACTER(LEN=:),
ALLOCATABLE :: line
1019 LOGICAL :: in_comment
1021 in_comment = .false.
1025 cpassert(.NOT. in_comment)
1028 line = adjustl(parser%buffer%input_lines(parser%buffer%present_line_number))
1029 IF (.NOT. in_comment .AND. index(line,
'<!--') /= 1)
RETURN
1030 in_comment = index(line,
'-->') == 0
1032 END SUBROUTINE upf_next_line
1042 SUBROUTINE upf_real_array(parser, tag, values, index_value, angular_momentum)
1044 CHARACTER(LEN=*),
INTENT(IN) :: tag
1045 REAL(
dp),
INTENT(OUT) :: values(:)
1046 INTEGER,
INTENT(OUT),
OPTIONAL :: index_value, angular_momentum
1048 CHARACTER(LEN=default_string_length) :: name, string, value
1049 INTEGER :: i, last, n
1053 last = len_trim(tag)
1054 IF (
PRESENT(index_value)) index_value = -1
1055 IF (
PRESENT(angular_momentum)) angular_momentum = -1
1056 IF (tag(last:last) ==
">")
THEN
1057 name = tag(2:last - 1)
1062 CALL upf_next_line(parser, at_end)
1063 cpassert(.NOT. at_end)
1066 IF (string ==
">")
EXIT
1067 SELECT CASE (string)
1070 cpassert(
value ==
"REAL")
1073 cpassert(n ==
SIZE(values))
1077 cpassert(
PRESENT(index_value))
1080 cpassert(
PRESENT(angular_momentum))
1085 cpabort(
"Unknown UPF "//trim(name)//
" option <"//trim(string)//
"> found")
1091 CALL upf_next_line(parser, at_end)
1092 cpassert(.NOT. at_end)
1096 cpassert(all(ieee_is_finite(values)))
1097 CALL upf_next_line(parser, at_end)
1098 cpassert(.NOT. at_end)
1100 cpassert(string ==
"</"//trim(name)//
">")
1101 END SUBROUTINE upf_real_array
1111 SUBROUTINE upf_full_wfc_section(parser, waves, opening_tag, mesh_size, number_of_proj)
1115 CHARACTER(LEN=*),
INTENT(IN) :: opening_tag
1116 INTEGER,
INTENT(IN) :: mesh_size, number_of_proj
1118 CHARACTER(LEN=default_string_length) :: string, suffix, tag
1119 INTEGER :: i, index_value, ios, l, last, m, n, nb, &
1122 LOGICAL,
ALLOCATABLE :: found(:, :)
1123 REAL(
dp),
ALLOCATABLE :: values(:)
1127 cpassert(nb > 0 .AND. m > 0)
1128 cpassert(.NOT.
ALLOCATED(waves%ae_wfc) .AND. .NOT.
ALLOCATED(waves%ps_wfc))
1129 cpassert(.NOT.
ALLOCATED(waves%angular_momenta))
1130 IF (opening_tag /=
"<PP_FULL_WFC>")
THEN
1133 CALL upf_next_line(parser, at_end)
1134 cpassert(.NOT. at_end)
1137 IF (string ==
">")
EXIT
1138 cpassert(string ==
"NUMBER_OF_WFC")
1143 ALLOCATE (waves%ae_wfc(m, nb), waves%ps_wfc(m, nb), waves%angular_momenta(nb))
1144 ALLOCATE (found(nb, 2), values(m))
1146 waves%angular_momenta = -1
1148 CALL upf_next_line(parser, at_end)
1149 cpassert(.NOT. at_end)
1151 IF (tag ==
"</PP_FULL_WFC>")
EXIT
1152 SELECT CASE (tag(1:10))
1158 cpabort(
"Unknown UPF full partial-wave tag "//trim(tag))
1160 last = len_trim(tag)
1161 IF (tag(last:last) ==
">") last = last - 1
1162 suffix = tag(11:last)
1163 READ (suffix, *, iostat=ios) i
1165 cpassert(i >= 1 .AND. i <= nb)
1166 cpassert(.NOT. found(i, wave_type))
1167 CALL upf_real_array(parser, tag, values, index_value, l)
1168 IF (index_value /= -1)
THEN
1169 cpassert(index_value == i)
1172 IF (waves%angular_momenta(i) >= 0)
THEN
1173 cpassert(l == waves%angular_momenta(i))
1175 waves%angular_momenta(i) = l
1176 IF (wave_type == 1)
THEN
1177 waves%ae_wfc(:, i) = values
1179 waves%ps_wfc(:, i) = values
1181 found(i, wave_type) = .true.
1183 cpassert(all(found))
1184 END SUBROUTINE upf_full_wfc_section
static GRID_HOST_DEVICE int modulo(int a, int m)
Equivalent of Fortran's MODULO, which always return a positive number. https://gcc....
Routines that process Quantum Espresso UPF files.
pure subroutine, public atom_release_upf(upfpot)
...
subroutine, public atom_read_upf(pot, upf_filename, read_header, read_augmentation)
...
Utility routines to read data from files. Kept as close as possible to the old parser because.
subroutine, public parser_get_next_line(parser, nline, at_end)
Read the next input line and broadcast the input information. Skip (nline-1) lines and skip also all ...
character(len=3) function, public parser_test_next_token(parser, string_length)
Test next input object.
Utility routines to read data from files. Kept as close as possible to the old parser because.
subroutine, public parser_release(parser)
releases the parser
subroutine, public parser_create(parser, file_name, unit_nr, para_env, end_section_label, separator_chars, comment_char, continuation_char, quote_char, section_char, parse_white_lines, initial_variables, apply_preprocessing)
Start a parser run. Initial variables allow to @SET stuff before opening the file.
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
Periodic Table related data definitions.
type(atom), dimension(0:nelem), public ptable
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.
Owned UPF dataset and radial conventions shared by ATOM and Quickstep. Dataset availability does not ...
real(dp) function, dimension(size(pot%r)), public upf_radial_weights(pot)
Composite Simpson weights for dr on the supplied UPF mesh index.
pure subroutine, public upf_release(pot)
Release every owned field and reset metadata before reusing a dataset.