Skip to content

Commit 54fe2a8

Browse files
Merge pull request #233 from ltimmerman3/master
2 parents f6d3a45 + c954418 commit 54fe2a8

21 files changed

+612
-2509
lines changed

ChangeLog

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@
55
--------------
66
Nov 18, 2024
77
Name: Tian Tian, Lucas Timmerman
8-
Changes: (initialization.c, initialization.h, electronicGroundState.c,
9-
include/isddft.h, main.c, main_socket.c, makefile, md.c, relax.c,
8+
Changes: (initialization.c, readfiles.c, initialization.h, electronicGroundState.c,
9+
include/isddft.h, main.c, main_socket.c, makefile, md.c, relax.c, tests/,
1010
socket/*.h, socket/*.c, tests/Socket/*, CI workflow, doc)
1111
1. Add socket communication layer and socket submodule
1212
2. Unifying MLFF and DFT single point calculations to Calculate_Properties function
1313
3. Update CI workflow for compiling socket code
1414
4. Update socket mode simple tests
1515
5. Update documentation for socket mode
16+
6. Rewrite of sparc_mlff_interface to allow mlff compatibility with socket and relaxation
17+
7. Removed extraneous variable hnl_file_name
18+
8. Modified .inpt files for mlff tests to account for src changes
1619

1720
--------------
1821
Nov 13, 2024

src/include/isddft.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ typedef struct _SPARC_OBJ{
670670
int n_str_max_mlff;
671671
int n_train_max_mlff;
672672
int mlff_flag;
673-
int last_train_MD_iter;
673+
int last_train_iter;
674674
int kernel_typ_MLFF;
675675
int descriptor_typ_MLFF;
676676
int N_rgrid_MLFF;
@@ -688,7 +688,6 @@ typedef struct _SPARC_OBJ{
688688
double xi_3_SOAP;
689689
double F_tol_SOAP;
690690
double F_rel_scale;
691-
char hnl_file_name[L_STRING];
692691
char mlff_data_folder[L_STRING];
693692
double stress_rel_scale[6];
694693
int MLFF_DFT_fq;
@@ -1153,7 +1152,6 @@ typedef struct _SPARC_INPUT_OBJ{
11531152
double F_tol_SOAP;
11541153
double F_rel_scale;
11551154
double stress_rel_scale[6];
1156-
char hnl_file_name[L_STRING];
11571155
char mlff_data_folder[L_STRING];
11581156
int MLFF_DFT_fq;
11591157

src/initialization.c

+4-6
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
#define min(x,y) ((x)<(y)?(x):(y))
5252
#define max(x,y) ((x)>(y)?(x):(y))
5353

54-
#define N_MEMBR 209
54+
//#define N_MEMBR 209
55+
#define N_MEMBR 208
5556

5657

5758
/**
@@ -1310,8 +1311,7 @@ void SPARC_copy_input(SPARC_OBJ *pSPARC, SPARC_INPUT_OBJ *pSPARC_Input) {
13101311
pSPARC->xi_3_SOAP = pSPARC_Input->xi_3_SOAP;
13111312
pSPARC->F_tol_SOAP = pSPARC_Input->F_tol_SOAP;
13121313
pSPARC->F_rel_scale = pSPARC_Input->F_rel_scale;
1313-
strncpy(pSPARC->hnl_file_name, pSPARC_Input->hnl_file_name,sizeof(pSPARC->hnl_file_name));
1314-
strncpy(pSPARC->mlff_data_folder, pSPARC_Input->mlff_data_folder,sizeof(pSPARC->mlff_data_folder));
1314+
strncpy(pSPARC->mlff_data_folder, pSPARC_Input->mlff_data_folder,sizeof(pSPARC->mlff_data_folder));
13151315
pSPARC->stress_rel_scale[0] = pSPARC_Input->stress_rel_scale[0];
13161316
pSPARC->stress_rel_scale[1] = pSPARC_Input->stress_rel_scale[1];
13171317
pSPARC->stress_rel_scale[2] = pSPARC_Input->stress_rel_scale[2];
@@ -3957,7 +3957,6 @@ void write_output_init(SPARC_OBJ *pSPARC) {
39573957
fprintf(output_fp, "MLFF_FLAG: %d\n", pSPARC->mlff_flag);
39583958
fprintf(output_fp, "MLFF_INITIAL_STEPS_TRAIN: %d\n", pSPARC->begin_train_steps);
39593959

3960-
// fprintf(output_fp, "MLFF_hnl_FILE: %s\n", pSPARC->hnl_file_name);
39613960
if (pSPARC->mlff_flag>1){
39623961
fprintf(output_fp, "MLFF_IF_ATOM_DATA_AVAILABLE: %d\n", pSPARC->if_atom_data_available);
39633962
fprintf(output_fp, "MLFF_MODEL_FOLDER: %s\n", pSPARC->mlff_data_folder);
@@ -4326,7 +4325,7 @@ void SPARC_Input_MPI_create(MPI_Datatype *pSPARC_INPUT_MPI) {
43264325
1, 1, 1, 1, 1,
43274326
1, /* double */
43284327
32, 32, 32, L_STRING, L_STRING, /* char */
4329-
L_STRING, L_STRING, L_STRING, L_STRING, L_STRING,
4328+
L_STRING, L_STRING, L_STRING, L_STRING,
43304329
L_STRING};
43314330

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

4554-
MPI_Get_address(&sparc_input_tmp.hnl_file_name, addr + i++);
45554553
MPI_Get_address(&sparc_input_tmp.mlff_data_folder, addr + i++);
45564554
for (i = 0; i < N_MEMBR; i++) {
45574555
disps[i] = addr[i] - base;

src/mlff/covariance_matrix.c

+2-27
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ void copy_descriptors(DescriptorObj *desc_str_MLFF, DescriptorObj *desc_str){
215215

216216

217217
/*
218-
add_firstMD function updates the MLFF_Obj by updating design matrix, b vector etc. for the first MD
218+
add_firstDFT function updates the MLFF_Obj by updating design matrix, b vector etc. for the first MD
219219
220220
[Input]
221221
1. desc_str: DescriptorObj structure of the first MD
@@ -229,7 +229,7 @@ add_firstMD function updates the MLFF_Obj by updating design matrix, b vector et
229229
*/
230230

231231

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

234234
int rank, nprocs;
235235
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
@@ -1426,31 +1426,6 @@ void remove_train_cols(MLFF_Obj *mlff_str, int col_ID){
14261426
}
14271427

14281428

1429-
/*
1430-
get_N_r_hnl function calculates the number of grid points in hnl_file
1431-
1432-
[Input]
1433-
1. pSPARC: SPARC structure
1434-
[Output]
1435-
1. pSPARC: SPARC structure
1436-
*/
1437-
void get_N_r_hnl(SPARC_OBJ *pSPARC){
1438-
int i, j, info;
1439-
FILE *fp;
1440-
char line[512];
1441-
char a1[512], a2[512], a3[512], a4[512];
1442-
int count1=0, count2=0;
1443-
1444-
// fp = fopen("hnl.txt","r");
1445-
fp = fopen(pSPARC->hnl_file_name,"r");
1446-
1447-
fgets(line, sizeof (line), fp);
1448-
sscanf(line, "%s%s%s%s", a1, a2, a3, a4);
1449-
int N_r = atoi(a4);
1450-
pSPARC->N_rgrid_MLFF = N_r;
1451-
fclose(fp);
1452-
}
1453-
14541429
// The functions below are outdated.
14551430
// /*
14561431
// mlff_kernel function computes the SOAP kernel between two descriptors {X2_str, X3_str} and {X2_tr, X3_tr}

src/mlff/covariance_matrix.h

+2-12
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void copy_descriptors(DescriptorObj *desc_str_MLFF, DescriptorObj *desc_str);
4747

4848

4949
/*
50-
add_firstMD function updates the MLFF_Obj by updating design matrix, b vector etc. for the first MD
50+
add_firstDFT function updates the MLFF_Obj by updating design matrix, b vector etc. for the first MD
5151
5252
[Input]
5353
1. desc_str: DescriptorObj structure of the first MD
@@ -59,7 +59,7 @@ add_firstMD function updates the MLFF_Obj by updating design matrix, b vector et
5959
[Output]
6060
1. mlff_str: MLFF_Obj structure
6161
*/
62-
void add_firstMD(DescriptorObj *desc_str, NeighList *nlist, MLFF_Obj *mlff_str, double E, double* F, double* stress_sparc);
62+
void add_firstDFT(DescriptorObj *desc_str, NeighList *nlist, MLFF_Obj *mlff_str, double E, double* F, double* stress_sparc);
6363

6464

6565
/*
@@ -128,16 +128,6 @@ remove_train_cols function removes a given local confiugration from the training
128128
*/
129129
void remove_train_cols(MLFF_Obj *mlff_str, int col_ID);
130130

131-
/*
132-
get_N_r_hnl function calculates the number of grid points in hnl_file
133-
134-
[Input]
135-
1. pSPARC: SPARC structure
136-
[Output]
137-
1. pSPARC: SPARC structure
138-
*/
139-
void get_N_r_hnl(SPARC_OBJ *pSPARC);
140-
141131
// double mlff_kernel(int kernel_typ, double **X2_str, double **X3_str, double **X2_tr, double **X3_tr, int atom, int atom_tr,
142132
// double beta_2, double beta_3, double xi_3, int size_X2, int size_X3);
143133

0 commit comments

Comments
 (0)