Skip to content

[Refactor] Move certain files to source_main #6290

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jun 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .github/workflows/version_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
# Validate version.h matches the release tag
- name: Assert version increment
run: |
CODE_VERSION=$(grep -oP '#define\s+VERSION\s+"\K\d+(\.\d+){2,3}' source/version.h)
CODE_VERSION=$(grep -oP '#define\s+VERSION\s+"\K\d+(\.\d+){2,3}' source/source_main/version.h)

if [[ -z "$CODE_VERSION" ]]; then
echo "::error::Failed to extract version from source/version.h"
echo "::error::Failed to extract version from source/source_main/version.h"
exit 1
fi

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ include_directories(${ABACUS_SOURCE_DIR}/module_base/module_container)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

add_executable(${ABACUS_BIN_NAME} source/main.cpp)
add_executable(${ABACUS_BIN_NAME} source/source_main/main.cpp)
if(ENABLE_COVERAGE)
add_coverage(${ABACUS_BIN_NAME})
endif()
Expand Down
4 changes: 2 additions & 2 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ add_subdirectory(module_rdmft)
add_library(
driver
OBJECT
driver.cpp
driver_run.cpp
source_main/driver.cpp
source_main/driver_run.cpp
)

list(APPEND device_srcs
Expand Down
2 changes: 1 addition & 1 deletion source/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ include Makefile.vars
# Compiler information
#==========================

INCLUDES = -I. -Icommands -I../ -Imodule_base/module_container
INCLUDES = -I. -Isource_main -Isource_main/commands -Icommands -I../ -Imodule_base/module_container

LIBS = -lm -lpthread
OPTS = -std=c++14 -pedantic -m64 ${INCLUDES}
Expand Down
3 changes: 2 additions & 1 deletion source/Makefile.Objects
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
#

VERSION = ABACUS
HEADERS = *.h
HEADERS = source_main/*.h

VPATH=./src_global:\
./source_main:\
./module_basis/module_ao:\
./module_basis/module_nao:\
./module_cell/module_neighbor:\
Expand Down
2 changes: 1 addition & 1 deletion source/module_base/parallel_global.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "module_base/parallel_reduce.h"
#include "module_parameter/parameter.h"
// #include "module_base/tool_quit.h"
#include "version.h"
#include "source_main/version.h"

#include <iostream>
#include <thread>
Expand Down
5 changes: 3 additions & 2 deletions source/module_basis/module_pw/test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ GTEST_DIR = /home/qianrui/gnucompile/g_gtest
# Compiler information
#==========================
HONG = -D__NORMAL
INCLUDES = -I. -I../../../ -I../../../module_base/module_container
INCLUDES = -I. -I../../../ -I../../../source_main -I../../../module_base/module_container
LIBS =
OPTS = -Ofast -march=native -std=c++11 -m64 ${INCLUDES}
OBJ_DIR = obj
Expand Down Expand Up @@ -101,7 +101,8 @@ GTESTOPTS = -I${GTEST_DIR}/include -L${GTEST_DIR}/lib -lgtest -lpthread -w
#==========================
# Objects
#==========================
VPATH=../../../module_base\
VPATH=../../../source_main\
../../../module_base\
../../../module_base/module_device\
../../../module_base/module_container/ATen/core\
../../../module_base/module_container/ATen\
Expand Down
2 changes: 1 addition & 1 deletion source/module_esolver/lcao_before_scf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ void ESolver_KS_LCAO<TK, TR>::before_scf(UnitCell& ucell, const int istep)
// 18) update of RDMFT, added by jghan
if (PARAM.inp.rdmft == true)
{
// necessary operation of these parameters have be done with p_esolver->Init() in source/driver_run.cpp
// necessary operation of these parameters have be done with p_esolver->Init() in source/source_main/driver_run.cpp
rdmft_solver.update_ion(ucell,
*(this->pw_rho),
this->locpp.vloc,
Expand Down
3 changes: 2 additions & 1 deletion source/module_hamilt_lcao/module_deepks/test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ OPTS = ${INCLUDES} -Ofast -std=c++14 -march=native -xHost -m64 -qopenmp -Werror

include Makefile.Objects

VPATH=../../module_base\
VPATH=../../../source_main\
:../../module_base\
:../../module_io\
:../../module_hamilt_pw/hamilt_pwdft\
:../../module_basis/module_ao\
Expand Down
6 changes: 3 additions & 3 deletions source/module_hamilt_pw/hamilt_pwdft/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ OPENBLAS_LIB_DIR = /home/qianrui/gnucompile/openblas/lib
#==========================
# Compiler information
#==========================
INCLUDES = -I. -Icommands -I../../
INCLUDES = -I. -Icommands -I../../ -I../../source_main/
LIBS = -lm -lpthread
OPTS = -Ofast -march=native -std=c++11 -m64 ${INCLUDES}
ifeq ($(findstring mpi, $(CXX)), mpi)
Expand Down Expand Up @@ -124,8 +124,8 @@ ${VERSION}-PW.x : ${FP_OBJS}
#==========================
# rules
#==========================
${OBJ_DIR}/main.o:../main.cpp
${CXX} ${OPTS} -c ${HONG} ../main.cpp -o ${OBJ_DIR}/main.o
${OBJ_DIR}/main.o:../source_main/main.cpp
${CXX} ${OPTS} -c ${HONG} ../source_main/main.cpp -o ${OBJ_DIR}/main.o

${OBJ_DIR}/%.o:%.cpp
${CXX} ${OPTS} -c ${HONG} $< -o $@
Expand Down
2 changes: 1 addition & 1 deletion source/module_io/json_output/general_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "../para_json.h"
#include "abacusjson.h"
#include "module_base/parallel_global.h"
#include "version.h"
#include "source_main/version.h"

// Add json objects to gener_info
namespace Json
Expand Down
2 changes: 1 addition & 1 deletion source/module_io/json_output/test/para_json_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "../readin_info.h"
#include "module_parameter/parameter.h"
#include "module_io/para_json.h"
#include "version.h"
#include "source_main/version.h"
#undef private
/************************************************
* unit test of json output module
Expand Down
2 changes: 1 addition & 1 deletion source/module_io/parse_args.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <iostream>

#include "module_io/read_input.h"
#include "version.h"
#include "source_main/version.h"

namespace ModuleIO
{
Expand Down
2 changes: 1 addition & 1 deletion source/module_io/test/parse_args_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "gtest/gtest.h"
#include "module_io/read_input.h"
#include "version.h"
#include "source_main/version.h"

bool ModuleIO::ReadInput::check_mode = false;

Expand Down
4 changes: 2 additions & 2 deletions source/driver.cpp → source/source_main/driver.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "driver.h"
#include "source_main/driver.h"

#include "module_base/global_file.h"
#include "module_base/memory.h"
Expand All @@ -12,7 +12,7 @@
#include "module_io/read_input.h"
#include "module_io/winput.h"
#include "module_parameter/parameter.h"
#include "version.h"
#include "source_main/version.h"
Driver::Driver()
{
}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "driver.h"
#include "source_main/driver.h"
#include "module_cell/check_atomic_stru.h"
#include "module_cell/module_neighbor/sltk_atom_arrange.h"
#include "module_hamilt_pw/hamilt_pwdft/global.h"
Expand Down
2 changes: 1 addition & 1 deletion source/main.cpp → source/source_main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// DATE : 2008-11-10
//==========================================================

#include "driver.h"
#include "source_main/driver.h"
#include "fftw3.h"
#include "module_base/parallel_global.h"
#include "module_io/parse_args.h"
Expand Down
File renamed without changes.
Loading