Skip to content

Commit

Permalink
Merge pull request #233 from ltimmerman3/master
Browse files Browse the repository at this point in the history
  • Loading branch information
phanish-suryanarayana authored Nov 19, 2024
2 parents f6d3a45 + c954418 commit 54fe2a8
Show file tree
Hide file tree
Showing 21 changed files with 612 additions and 2,509 deletions.
7 changes: 5 additions & 2 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@
--------------
Nov 18, 2024
Name: Tian Tian, Lucas Timmerman
Changes: (initialization.c, initialization.h, electronicGroundState.c,
include/isddft.h, main.c, main_socket.c, makefile, md.c, relax.c,
Changes: (initialization.c, readfiles.c, initialization.h, electronicGroundState.c,
include/isddft.h, main.c, main_socket.c, makefile, md.c, relax.c, tests/,
socket/*.h, socket/*.c, tests/Socket/*, CI workflow, doc)
1. Add socket communication layer and socket submodule
2. Unifying MLFF and DFT single point calculations to Calculate_Properties function
3. Update CI workflow for compiling socket code
4. Update socket mode simple tests
5. Update documentation for socket mode
6. Rewrite of sparc_mlff_interface to allow mlff compatibility with socket and relaxation
7. Removed extraneous variable hnl_file_name
8. Modified .inpt files for mlff tests to account for src changes

--------------
Nov 13, 2024
Expand Down
4 changes: 1 addition & 3 deletions src/include/isddft.h
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ typedef struct _SPARC_OBJ{
int n_str_max_mlff;
int n_train_max_mlff;
int mlff_flag;
int last_train_MD_iter;
int last_train_iter;
int kernel_typ_MLFF;
int descriptor_typ_MLFF;
int N_rgrid_MLFF;
Expand All @@ -688,7 +688,6 @@ typedef struct _SPARC_OBJ{
double xi_3_SOAP;
double F_tol_SOAP;
double F_rel_scale;
char hnl_file_name[L_STRING];
char mlff_data_folder[L_STRING];
double stress_rel_scale[6];
int MLFF_DFT_fq;
Expand Down Expand Up @@ -1153,7 +1152,6 @@ typedef struct _SPARC_INPUT_OBJ{
double F_tol_SOAP;
double F_rel_scale;
double stress_rel_scale[6];
char hnl_file_name[L_STRING];
char mlff_data_folder[L_STRING];
int MLFF_DFT_fq;

Expand Down
10 changes: 4 additions & 6 deletions src/initialization.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
#define min(x,y) ((x)<(y)?(x):(y))
#define max(x,y) ((x)>(y)?(x):(y))

#define N_MEMBR 209
//#define N_MEMBR 209
#define N_MEMBR 208


/**
Expand Down Expand Up @@ -1310,8 +1311,7 @@ void SPARC_copy_input(SPARC_OBJ *pSPARC, SPARC_INPUT_OBJ *pSPARC_Input) {
pSPARC->xi_3_SOAP = pSPARC_Input->xi_3_SOAP;
pSPARC->F_tol_SOAP = pSPARC_Input->F_tol_SOAP;
pSPARC->F_rel_scale = pSPARC_Input->F_rel_scale;
strncpy(pSPARC->hnl_file_name, pSPARC_Input->hnl_file_name,sizeof(pSPARC->hnl_file_name));
strncpy(pSPARC->mlff_data_folder, pSPARC_Input->mlff_data_folder,sizeof(pSPARC->mlff_data_folder));
strncpy(pSPARC->mlff_data_folder, pSPARC_Input->mlff_data_folder,sizeof(pSPARC->mlff_data_folder));
pSPARC->stress_rel_scale[0] = pSPARC_Input->stress_rel_scale[0];
pSPARC->stress_rel_scale[1] = pSPARC_Input->stress_rel_scale[1];
pSPARC->stress_rel_scale[2] = pSPARC_Input->stress_rel_scale[2];
Expand Down Expand Up @@ -3957,7 +3957,6 @@ void write_output_init(SPARC_OBJ *pSPARC) {
fprintf(output_fp, "MLFF_FLAG: %d\n", pSPARC->mlff_flag);
fprintf(output_fp, "MLFF_INITIAL_STEPS_TRAIN: %d\n", pSPARC->begin_train_steps);

// fprintf(output_fp, "MLFF_hnl_FILE: %s\n", pSPARC->hnl_file_name);
if (pSPARC->mlff_flag>1){
fprintf(output_fp, "MLFF_IF_ATOM_DATA_AVAILABLE: %d\n", pSPARC->if_atom_data_available);
fprintf(output_fp, "MLFF_MODEL_FOLDER: %s\n", pSPARC->mlff_data_folder);
Expand Down Expand Up @@ -4326,7 +4325,7 @@ void SPARC_Input_MPI_create(MPI_Datatype *pSPARC_INPUT_MPI) {
1, 1, 1, 1, 1,
1, /* double */
32, 32, 32, L_STRING, L_STRING, /* char */
L_STRING, L_STRING, L_STRING, L_STRING, L_STRING,
L_STRING, L_STRING, L_STRING, L_STRING,
L_STRING};

// calculating offsets in an architecture independent manner
Expand Down Expand Up @@ -4551,7 +4550,6 @@ void SPARC_Input_MPI_create(MPI_Datatype *pSPARC_INPUT_MPI) {
MPI_Get_address(&sparc_input_tmp.InDensUCubFilename, addr + i++);
MPI_Get_address(&sparc_input_tmp.InDensDCubFilename, addr + i++);

MPI_Get_address(&sparc_input_tmp.hnl_file_name, addr + i++);
MPI_Get_address(&sparc_input_tmp.mlff_data_folder, addr + i++);
for (i = 0; i < N_MEMBR; i++) {
disps[i] = addr[i] - base;
Expand Down
29 changes: 2 additions & 27 deletions src/mlff/covariance_matrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ void copy_descriptors(DescriptorObj *desc_str_MLFF, DescriptorObj *desc_str){


/*
add_firstMD function updates the MLFF_Obj by updating design matrix, b vector etc. for the first MD
add_firstDFT function updates the MLFF_Obj by updating design matrix, b vector etc. for the first MD
[Input]
1. desc_str: DescriptorObj structure of the first MD
Expand All @@ -229,7 +229,7 @@ add_firstMD function updates the MLFF_Obj by updating design matrix, b vector et
*/


void add_firstMD(DescriptorObj *desc_str, NeighList *nlist, MLFF_Obj *mlff_str, double E, double *F, double *stress_sparc) {
void add_firstDFT(DescriptorObj *desc_str, NeighList *nlist, MLFF_Obj *mlff_str, double E, double *F, double *stress_sparc) {

int rank, nprocs;
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
Expand Down Expand Up @@ -1426,31 +1426,6 @@ void remove_train_cols(MLFF_Obj *mlff_str, int col_ID){
}


/*
get_N_r_hnl function calculates the number of grid points in hnl_file
[Input]
1. pSPARC: SPARC structure
[Output]
1. pSPARC: SPARC structure
*/
void get_N_r_hnl(SPARC_OBJ *pSPARC){
int i, j, info;
FILE *fp;
char line[512];
char a1[512], a2[512], a3[512], a4[512];
int count1=0, count2=0;

// fp = fopen("hnl.txt","r");
fp = fopen(pSPARC->hnl_file_name,"r");

fgets(line, sizeof (line), fp);
sscanf(line, "%s%s%s%s", a1, a2, a3, a4);
int N_r = atoi(a4);
pSPARC->N_rgrid_MLFF = N_r;
fclose(fp);
}

// The functions below are outdated.
// /*
// mlff_kernel function computes the SOAP kernel between two descriptors {X2_str, X3_str} and {X2_tr, X3_tr}
Expand Down
14 changes: 2 additions & 12 deletions src/mlff/covariance_matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void copy_descriptors(DescriptorObj *desc_str_MLFF, DescriptorObj *desc_str);


/*
add_firstMD function updates the MLFF_Obj by updating design matrix, b vector etc. for the first MD
add_firstDFT function updates the MLFF_Obj by updating design matrix, b vector etc. for the first MD
[Input]
1. desc_str: DescriptorObj structure of the first MD
Expand All @@ -59,7 +59,7 @@ add_firstMD function updates the MLFF_Obj by updating design matrix, b vector et
[Output]
1. mlff_str: MLFF_Obj structure
*/
void add_firstMD(DescriptorObj *desc_str, NeighList *nlist, MLFF_Obj *mlff_str, double E, double* F, double* stress_sparc);
void add_firstDFT(DescriptorObj *desc_str, NeighList *nlist, MLFF_Obj *mlff_str, double E, double* F, double* stress_sparc);


/*
Expand Down Expand Up @@ -128,16 +128,6 @@ remove_train_cols function removes a given local confiugration from the training
*/
void remove_train_cols(MLFF_Obj *mlff_str, int col_ID);

/*
get_N_r_hnl function calculates the number of grid points in hnl_file
[Input]
1. pSPARC: SPARC structure
[Output]
1. pSPARC: SPARC structure
*/
void get_N_r_hnl(SPARC_OBJ *pSPARC);

// double mlff_kernel(int kernel_typ, double **X2_str, double **X3_str, double **X2_tr, double **X3_tr, int atom, int atom_tr,
// double beta_2, double beta_3, double xi_3, int size_X2, int size_X3);

Expand Down
Loading

0 comments on commit 54fe2a8

Please sign in to comment.