Skip to content

Commit

Permalink
Everything after second component was missing from structure factor c…
Browse files Browse the repository at this point in the history
…alculation
  • Loading branch information
RandomDefaultUser committed Dec 13, 2024
1 parent c34a926 commit f84dd75
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 12 deletions.
15 changes: 13 additions & 2 deletions external_modules/total_energy_module/total_energy.f90
Original file line number Diff line number Diff line change
Expand Up @@ -663,9 +663,13 @@ SUBROUTINE set_positions_gauss(verbose, gaussian_descriptors,reference_gaussian_
CALL mp_barrier( intra_image_comm )
CALL start_clock( 'structure_factors' )
ALLOCATE(rgd_of_g(ngm,1), rhon(ngm))
DO isp = 1, nsp
PRINT *, SHAPE(gaussian_descriptors(:, isp:isp)), SHAPE(strf(:,isp:isp))
CALL rho_r2g(dfftp, gaussian_descriptors(:, isp:isp), strf(:,isp:isp))
ENDDO

CALL rho_r2g(dfftp, gaussian_descriptors, strf)

! CALL rho_r2g(dfftp, gaussian_descriptors, strf)
!
CALL rho_r2g(dfftp, reference_gaussian_descriptors, rgd_of_g)

DO isp = 1, nsp
Expand Down Expand Up @@ -807,6 +811,8 @@ SUBROUTINE set_rho_of_r(rho_of_r,nnr_in,nspin_in)
USE cell_base, ONLY : omega
USE mp, ONLY : mp_sum
USE mp_bands, ONLY : intra_bgrp_comm
USE vlocal, ONLY : strf
USE ions_base, ONLY : nsp

IMPLICIT NONE
INTEGER, INTENT(IN) :: nnr_in, nspin_in
Expand All @@ -815,6 +821,7 @@ SUBROUTINE set_rho_of_r(rho_of_r,nnr_in,nspin_in)
REAL(DP) :: charge
REAL(DP) :: etotefield
INTEGER :: ir
INTEGER :: isp

! Check consistency of dimensions
IF (nnr_in /= dfftp%nnr) STOP "*** nnr provided to set_rho_of_r() does not match dfftp%nnr"
Expand Down Expand Up @@ -861,6 +868,10 @@ SUBROUTINE set_rho_of_r(rho_of_r,nnr_in,nspin_in)
!
CALL mp_sum( deband, intra_bgrp_comm )
!
DO isp = 1, nsp
print *, strf(1:10,isp)
ENDDO


RETURN

Expand Down
18 changes: 13 additions & 5 deletions mala/descriptors/atomic_density.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,20 @@ def __calculate_lammps(self, outdir, **kwargs):
use_fp64=use_fp64,
)

# self._clean_calculation(lmp, keep_logs)
self._clean_calculation(lmp, keep_logs)
gaussian_descriptors_np_test = gaussian_descriptors_np.copy()
# if np.shape(gaussian_descriptors_np_test)[1] > 7:
# gaussian_descriptors_np_test[:, 6] = gaussian_descriptors_np[:, 7]
# gaussian_descriptors_np_test[:, 7] = gaussian_descriptors_np[:, 8]
# gaussian_descriptors_np_test[:, 8] = gaussian_descriptors_np[:, 6]

if (
isinstance(self.parameters.minterpy_lp_norm, list)
and np.shape(gaussian_descriptors_np_test)[1] > 7
):
for index in range(len(self.parameters.minterpy_lp_norm)):
gaussian_descriptors_np_test[:, 6 + index] = (
gaussian_descriptors_np[
:, self.parameters.minterpy_lp_norm[index] + 6
]
)

# In comparison to bispectrum, the atomic density always returns
# in the "local mode". Thus we have to make some slight adjustments
# if we operate without MPI.
Expand Down
10 changes: 5 additions & 5 deletions mala/targets/density.py
Original file line number Diff line number Diff line change
Expand Up @@ -1014,8 +1014,8 @@ def __setup_total_energy_module(
barrier()

# Right after setup we can delete the file.
# if get_rank() == 0:
# os.remove(tem_input_name)
if get_rank() == 0:
os.remove(tem_input_name)

printout(
"Total energy module: Time used by total energy initialization: {:.8f}s".format(
Expand Down Expand Up @@ -1047,9 +1047,9 @@ def __setup_total_energy_module(
"Number of atoms is inconsistent between MALA "
"and Quantum Espresso."
)
# test_positions = te.get_positions(
# atoms_Angstrom.get_global_number_of_atoms()
# )
test_positions = te.get_positions(
atoms_Angstrom.get_global_number_of_atoms()
)

# We need to find out if the grid dimensions are consistent.
# That depends on the form of the density data we received.
Expand Down

0 comments on commit f84dd75

Please sign in to comment.