Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
babc61f
compilation from y6 add new files and upate make
rreho Apr 18, 2026
7a5e260
allow double and single fftw
rreho Apr 19, 2026
e846abb
changes for elph plugin echo
rreho Apr 30, 2026
4c65019
ignore tests
rreho May 5, 2026
82ee49c
update to write ndb.electron-phonon db in y6
rreho May 5, 2026
21295a6
add option make lelphc make cleean_lelphc
rreho May 11, 2026
5030ea7
WIP: write dvqG to yambo db
rreho May 12, 2026
1be853a
update
rreho May 17, 2026
cbe0709
rm duplicated files
rreho May 20, 2026
650716a
changes in fallback
rreho May 20, 2026
fd74131
changes
rreho May 20, 2026
ebf3d5e
More elements to connect to the main
andreamarini May 26, 2026
f374bed
change for compilation and linking order
rreho May 26, 2026
e7b6ef4
Merge branch 'tech-y6-compilation' of github.com:rreho/LetzElPhC into…
rreho May 26, 2026
693bc3f
introduce new order
rreho May 26, 2026
8e2d13b
still on it
rreho May 26, 2026
8abf218
revert changes
rreho May 26, 2026
e1876d1
MODIFIED * compile/headers_and_libs.mk compile/libraries.mk
andreamarini May 27, 2026
b10b2fd
remove circularly dependency between common and nonloc due to free_Ps…
rreho May 28, 2026
fdb81fa
fix cycle dep between io and io/qe
rreho May 28, 2026
e48989c
update lib order
rreho May 28, 2026
863c112
MODIFIED * compile/libraries.mk
andreamarini May 29, 2026
31f8ea1
MODIFIED * compile/libraries.mk
andreamarini May 29, 2026
bb6189d
allow write file in y6
rreho May 29, 2026
5911185
trick to avoid writing to stdout
rreho May 29, 2026
70dc17b
MODIFIED * services/elph/elph_driver.c services/io/qe/get_dvscf_dyn_…
andreamarini Jun 11, 2026
8b791a9
MODIFIED * compile/compile_me.mk services/elph/.objects services/elp…
andreamarini Jun 11, 2026
fd3c5e1
MODIFIED * services/elph/elph.h services/elph/elph_driver_cb2.c serv…
andreamarini Jun 12, 2026
f2eefe2
MODIFIED * services/common/dtypes.h services/elph/elph.h services/el…
andreamarini Jun 12, 2026
44448fe
MODIFIED * services/elph/elph.h services/elph/elph_driver_cb2.c serv…
andreamarini Jun 12, 2026
0ab2d9b
support query-only mode (i_control<0): populate y6_data early, skip g…
rreho Jun 13, 2026
3b18f60
changes for PAR
rreho Jun 13, 2026
e8ea52a
comp error
rreho Jun 13, 2026
5e7b365
MODIFIED * services/common/dtypes.h services/common/parallel.c servi…
andreamarini Jun 15, 2026
b3e508b
reading of nsym and nspin
rreho Jun 15, 2026
4070035
MODIFIED * services/common/dtypes.h services/common/parallel.c servi…
andreamarini Jun 16, 2026
ff738cd
commit bef pulling
rreho Jun 16, 2026
148c85e
Merge branch 'tech-y6-compilation' of github.com:rreho/LetzElPhC into…
rreho Jun 16, 2026
0cd13c0
MODIFIED * services/common/parallel.c services/elph/compute_elph_mat…
andreamarini Jun 16, 2026
0488e2c
wip MPI
rreho Jun 16, 2026
e7c00bb
BUG in q-points Y6 and Letz. Y6 does not macth QE. Still working on d…
rreho Jun 17, 2026
f2ed71a
usual mac/linux prob
rreho Jun 17, 2026
db091f3
expose k and kplusq grids, move netcdf routines elsewhere
rreho Jun 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ controllers/options/options_driver.c
controllers/defaults/DEFAULTS_driver.F
services/controllers/SERVICES_setup.F
services/units/UNITS_defaults.F
tests/
14 changes: 14 additions & 0 deletions compile/compile_me.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#
# License-Identifier: GPL
#
# Copyright (C) 2025 The Yambo Team
#
# Authors (see AUTHORS file for details): MN
#
# Co-Authors (see AUTHORS file for details): RR AM
# LetzElPhC ep plugin - yambo build system stub
# Integration handled via SERVICES_LIBS in libraries.mk
#
ifneq (,$(findstring yambo_ep,$(MAKECMDGOALS)))
Y_PRECMP= -D_Y6_LETZ
endif
9 changes: 9 additions & 0 deletions compile/goals.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# License-Identifier: GPL
#
# Copyright (C) 2025 The Yambo Team
#
# Authors (see AUTHORS file for details): AM MN RR
#

.PHONY: lelphc clean_lelphc
15 changes: 15 additions & 0 deletions compile/headers_and_libs.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#
# License-Identifier: GPL
#
# Copyright (C) 2025 The Yambo Team
#
# Authors (see AUTHORS file for details): RR AM
#
# LetzElPhC ep plugin - extra include paths for the vendored C source.
# C files under plugins/ep/services/<sub>/*.c use relative includes
# like "common/dtypes.h", so the plugin services root must be on the
# include path.
#
iheaders += $(IFLAG)$(srcdir)/plugins/letz/services
include_headers += $(IFLAG)$(srcdir)/plugins/letz/services
llibs += -lcblas
16 changes: 16 additions & 0 deletions compile/help.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#
# License-Identifier: GPL
#
# Copyright (C) 2025 The Yambo Team
#
# Authors (see AUTHORS file for details): RR AM
#
# Help blurb for the ep (LetzElPhC) plugin, called from
# compile/global/functions/help.mk when plugins/ep.pulled is present.
#
define ep_help
$(ECHO) " ep plugin = LetzElPhC electron-phonon coupling plugin";\
$(ECHO) " Trigger: yambo -collisions ep";\
$(ECHO) " Source: plugins/ep/services/, integration: packages/el-ph/";\
$(ECHO)
endef
31 changes: 27 additions & 4 deletions compile/libraries.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,31 @@ ifeq ($(wildcard compile/global/defs.mk),compile/global/defs.mk)
include compile/defs.mk
endif
#
EP_S1= [Sep,nonloc] [Sep,io/ezxml] [Sep,parser/inih] [Sep,io]
EP_S2= [Sep,io/qe] [Sep,common] [Sep,dvloc] [Sep,elph] [Sep,wfc] [Sep,symmetries] [Sep,fft]
EP_S3= [Sep,common/cwalk] [Sep,preprocessor] [Sep,interpolation] [Sep,common/ELPH_hash_map] [Sep,phonon] [Sep,common/kdtree] [Sep,parser]
# Library link order is INTRINSIC to LetzElPhC's dependency.
# Static linker is left-to-right: symbol-users before symbol-providers.
#
SERVICES_LIBS += ${EP_S1} ${EP_S2} ${EP_S3}
# Dependency tiers (each tier depends only on equal/lower tiers):
# T6 drivers : interpolation, elph
# T5 QE I/O : io/qe
# T4 main I/O : io
# T3 kernels+pp : dvloc, symmetries, nonloc, preprocessor
# T2 primitives : fft, parser, phonon, wfc
# T1 base+vendors : common, common/kdtree, io/ezxml, common/ELPH_hash_map,
# parser/inih, common/cwalk
#
# elph (T5) hosts the Fortran-to-C ABI boundary (ep_f2c_bridge.c):
# elph_driver_f2c / elph_driver_cb_f2c / elph_driver_cb2_f2c
# These are the ONLY entry points yambo_ep calls into LetzElPhC.
#
# Order generated by check_dep.py topological sort (most-dependent first).
#
EP_S1= [Sletz,interpolation]
EP_S2= [Sletz,io/qe] [Sletz,common/ELPH_hash_map] [Sletz,common] [Sletz,symmetries] [Sletz,nonloc]
EP_S3= [Sletz,dvloc] [Sletz,io] [Sletz,io/ezxml]
EP_S4= [Sletz,wfc] [Sletz,fft] [Sletz,dvloc] [Sletz,common/cwalk] [Sletz,preprocessor]
EP_S5= [Sletz,phonon] [Sletz,parser/inih] [Sletz,parser]
EP_S6= [Sletz,common/kdtree] [Sletz,elph]
#
ifneq (,$(filter yambo_ep ypp_ep,$(MAKECMDGOALS)))
SERVICES_LIBS += ${EP_S1} ${EP_S2} ${EP_S3} ${EP_S4} ${EP_S5} ${EP_S6}
endif
12 changes: 12 additions & 0 deletions compile/targets.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# License-Identifier: GPL
#
# Copyright (C) 2025 The Yambo Team
#
# Authors (see AUTHORS file for details): AM MN RR
#
lelphc:
$(MAKE) -C $(srcdir)/plugins/letz/services

clean_lelphc:
-$(MAKE) -C $(srcdir)/plugins/letz/services clean
7 changes: 7 additions & 0 deletions info/compilation.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#
# License-Identifier: GPL
#
# Copyright (C) 2026 The Yambo Team
#
# Authors (see AUTHORS file for details): AM RR
#
8 changes: 8 additions & 0 deletions info/intro.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#
# License-Identifier: GPL
#
# Copyright (C) 2026 The Yambo Team
#
# Authors (see AUTHORS file for details): AM RR
#
[letz-plugin] This plugin connects Yambo with the LetzElPhC code
15 changes: 9 additions & 6 deletions services/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ TARGET := lelphc

#### make start here

SUBDIR = nonloc io/ezxml parser/inih io \
io/qe common dvloc elph wfc \
symmetries fft common/cwalk \
preprocessor interpolation \
common/ELPH_hash_map phonon \
common/kdtree parser
# SUBDIR order mirrors the link-tier (T0 base → T5 drivers).
# For library use, compile/libraries.mk enforces the same tier ordering.
SUBDIR = common common/cwalk common/ELPH_hash_map common/kdtree \
io/ezxml parser/inih \
wfc fft phonon parser \
dvloc nonloc symmetries preprocessor \
io \
io/qe \
elph interpolation

.SUFFIXES :

Expand Down
9 changes: 8 additions & 1 deletion services/common/dtypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ struct calc_details
// name of the input file.
// can be elph input or DFT-Phonon input
// base on calc_type
char ph_save_dir[512];
// phonon save directory path for QE preprocessor
};

struct symmetry
Expand Down Expand Up @@ -141,7 +143,9 @@ struct Lattice
// array of symmetries (operated on cartisian coordinates)
bool is_soc_present;
// system has soc if true else false
// -------------------------------------------------------
// Yambo parallel workload
int *K_par;
int NK_par;
};

struct Phonon
Expand Down Expand Up @@ -178,6 +182,9 @@ struct Phonon
// (natom,3,3,3)
// Quadrapole tensor. for now not used is kept to NULL.
// -------------------------------------------------------
// Yambo parallel workload
int *Q_par;
int NQ_par;
};

struct Vloc_table
Expand Down
32 changes: 1 addition & 31 deletions services/common/free_dtypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#include "dtypes.h"
#include "elphC.h"
#include "nonloc/fcoeff.h"

void free_wfc_type(struct WFC* Wfc)
{
Expand Down Expand Up @@ -109,33 +108,4 @@ void free_local_pseudo_type(struct local_pseudo* lpseudo)
lpseudo->rab_grid = NULL;

return;
}

void free_Pseudo_type(struct Pseudo* pseudo)
{
if (!pseudo)
{
return;
}

free_f_Coeff(pseudo);
free(pseudo->fCoeff);
free_Vloc_table_type(pseudo->vloc_table);
free(pseudo->Fsign);
free(pseudo->PP_table);

if (pseudo->loc_pseudo)
{
for (ND_int itype = 0; itype < pseudo->ntype; ++itype)
{
free_local_pseudo_type(pseudo->loc_pseudo + itype);
}
}
free(pseudo->loc_pseudo);

pseudo->loc_pseudo = NULL;
pseudo->PP_table = NULL;
pseudo->Fsign = NULL;
pseudo->fCoeff = NULL;
return;
}
}
3 changes: 1 addition & 2 deletions services/common/free_dtypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ void free_lattice_type(struct Lattice* lattice);
void free_phonon_type(struct Phonon* phonon);
void free_Vloc_table_type(struct Vloc_table* vloc_tab);
void free_local_pseudo_type(struct local_pseudo* lpseudo);
void free_Pseudo_type(struct Pseudo* pseudo);
void free_wfc_type(struct WFC* wfc);
void free_wfc_type(struct WFC* wfc);
1 change: 1 addition & 0 deletions services/common/parallel.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ This file contains function which distributes cpus
#include "dtypes.h"
#include "elphC.h"
#include "error.h"
#include <stdio.h>

/*get block size and starting idx of dimension that is distrbuted amoung cpus*/
ND_int get_mpi_local_size_idx(const ND_int n, ND_int* start_idx, MPI_Comm Comm)
Expand Down
13 changes: 10 additions & 3 deletions services/common/print_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,25 @@

#include "dtypes.h"

static FILE* elph_log_fp = NULL;

void elph_set_log_file(FILE* fp) { elph_log_fp = fp; }

FILE* elph_get_log_file(void) { return elph_log_fp ? elph_log_fp : stdout; }

void print_info_msg(int mpi_rank, const char* fmt, ...)
{
if (mpi_rank)
{
return;
}
FILE* out = elph_get_log_file();
va_list args;
va_start(args, fmt);
vfprintf(stdout, fmt, args);
vfprintf(out, fmt, args);
va_end(args);
fprintf(stdout, "\n");
fflush(stdout);
fprintf(out, "\n");
fflush(out);
}

void print_input_info(const char* save_dir, const char* ph_save_dir,
Expand Down
3 changes: 3 additions & 0 deletions services/common/print_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ void print_ELPH_logo(int mpi_rank, FILE* output);

void print_info_msg(int mpi_rank, const char* fmt, ...);

void elph_set_log_file(FILE* fp);
FILE* elph_get_log_file(void);

void print_input_info(const char* save_dir, const char* ph_save_dir,
const char* kernel, const bool kminusq,
const enum ELPH_dft_code dft_code,
Expand Down
68 changes: 68 additions & 0 deletions services/elph.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#pragma once
#include <mpi.h>
#include <stdbool.h>

#include "common/dtypes.h"
#include "elphC.h"

/*
* Per-(iq_BZ, ik_BZ) fill callback for yambo COLL integration.
* Called once per BZ (q,k) pair on commK_rank==0 processes.
* iq_BZ, ik_BZ : 0-based BZ indices
* data : ELPH_cmplx buffer, C row-major (nmodes, nspin, nbnds, nbnds)
* nq..nb_start : full-BZ dimensions (constant across calls); nb_start is 1-based
*/
typedef void (*elph_fill_fn)(int iq_BZ, int ik_BZ,
const void* data,
int nq, int nk, int nmodes, int nspin,
int nbnds, int nb_start);

/*
* Callback for dV_q^nu(G) in reciprocal space, called once per iBZ q-point
* from commK rank 0.
* iq_iBZ : 0-based global iBZ q-point index
* dVG : C row-major (nmodes, nmag, nfft_x, nfft_y, nfft_z) after forward FFT
* ph_freqs : phonon frequencies omega_ph[nmodes] in Hartree (ELPH_float*)
* nq_iBZ : total number of iBZ q-points
*/
typedef void (*elph_dvG_fill_fn)(int iq_iBZ,
const void* dVG,
const void* ph_freqs,
int nq_iBZ, int nmodes, int nmag,
int nfft_x, int nfft_y, int nfft_z);

void elph_driver(const char* ELPH_input_file, enum ELPH_dft_code dft_code,
MPI_Comm comm_world);

/* Callback-enabled variant: skips ndb.elph; calls fill_fn per (q,k) instead. */
void elph_driver_cb(const char* ELPH_input_file, enum ELPH_dft_code dft_code,
MPI_Comm comm_world, elph_fill_fn fill_fn);

/*
* Extended callback variant: like elph_driver_cb plus calls dvG_fill_fn once per
* iBZ q-point with the full dV_q^nu(G) potential in reciprocal space.
* Either callback may be NULL to skip that output.
*/
void elph_driver_cb2(const char* ELPH_input_file, enum ELPH_dft_code dft_code,
MPI_Comm comm_world, elph_fill_fn fill_fn,
elph_dvG_fill_fn dvG_fill_fn);

void compute_and_write_elphq(struct WFC* wfcs, struct Lattice* lattice,
struct Pseudo* pseudo, struct Phonon* phonon,
const ND_int iqpt, ELPH_cmplx* eigVec,
ELPH_cmplx* dVscfq, const int ncid_elph,
const int varid_elph, const int ncid_dmat,
const int varid_dmat, const bool non_loc,
const bool kminusq,
const struct ELPH_MPI_Comms* Comm,
elph_fill_fn fill_fn);

void compute_and_write_dmats(const char* file_name, const struct WFC* wfcs,
const struct Lattice* lattice,
const ND_int nph_sym,
const struct symmetry* sym_data,
const struct ELPH_MPI_Comms* Comm);

void init_kernel(struct kernel_info* kernel);

void set_kernel(const char* kernel_str, struct kernel_info* kernel);
3 changes: 2 additions & 1 deletion services/elph/.objects
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
objs = set_kernel.o elph_driver.o compute_elph_matq.o compute_dmats.o
objs = elph_driver_cb.o set_kernel.o elph_driver.o ep_f2c_bridge.o dvG_utils.o compute_elph_matq.o compute_dmats.o \
elph_driver_cb2.o
17 changes: 12 additions & 5 deletions services/elph/compute_dmats.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,16 @@ void compute_and_write_dmats(const char* file_name, const struct WFC* wfcs,
struct progress_bar pbar[1];
start_progressbar(pbar, Comm->commW_rank, ndmats);

for (ND_int idmat = 0; idmat < ndmats; ++idmat)
for (ND_int i_par = 0; i_par < lattice->NK_par; ++i_par)
{
ND_int isym = (idmat + dmat_shift) / nk_totalBZ;
ND_int ikBZ = (idmat + dmat_shift) % nk_totalBZ;

ND_int ikBZ=lattice->K_par[i_par];

for (ND_int isym = 0; isym < nph_sym; ++isym)
{

//ND_int isym = (idmat + dmat_shift) / nk_totalBZ;
//ND_int ikBZ = (idmat + dmat_shift) % nk_totalBZ;

startp[0] = isym;
startp[1] = ikBZ;
Expand All @@ -116,8 +122,9 @@ void compute_and_write_dmats(const char* file_name, const struct WFC* wfcs,
}
}

// update the progress bar
print_progressbar(pbar);
}
// update the progress bar
print_progressbar(pbar);
}
if (Comm->commK_rank == 0)
{
Expand Down
Loading