Skip to content

Commit

Permalink
add missing initialization part
Browse files Browse the repository at this point in the history
  • Loading branch information
alchem0x2A committed Jan 18, 2024
1 parent 057469f commit 0a364ca
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/include/isddft.h
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ typedef struct _SPARC_OBJ{
int socket_port; // socket host
int socket_inet; // boolean value to indicate whether to use inet socket
int socket_fd; // socket file descriptor; This should be initialized to -1
int socket_max_niter; // max number of iterations
int socket_max_niter; // max number of iterations. Default is 10000
#endif
}SPARC_OBJ;

Expand Down
13 changes: 13 additions & 0 deletions src/initialization.c
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,19 @@ void set_defaults(SPARC_INPUT_OBJ *pSPARC_Input, SPARC_OBJ *pSPARC) {

/* Default parameter for cyclix */
pSPARC_Input->twist = 0.0;

/* Default socket options */
#ifdef USE_SOCKET
// Defaults for pSPARC_Input, if not initialized by the cmdline
if (pSPARC_Input->SocketFlag != 1)
{
pSPARC_Input->SocketFlag = 0; // socket off
strncpy(pSPARC_Input->socket_host, "localhost", sizeof(pSPARC_Input->socket_host));
pSPARC_Input->socket_port = -1; // socket port
pSPARC_Input->socket_inet = 0; // 0: -> default unix socket, 1: -> inet socket
}
pSPARC_Input->socket_max_niter = 10000; // Set to a very large number
#endif
}


Expand Down
4 changes: 4 additions & 0 deletions src/socket/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,10 @@ void main_Socket(SPARC_OBJ *pSPARC)
status = -1; // -1: not initialized
init = 1;
hasdata = 0;
#ifdef DEBUG
if (rank == 0)
printf("Status: socket_max_niter %d\n", pSPARC->socket_max_niter);
#endif // DEBUG
// TODO: option to specify N_MAXSTEPS (or directly taken from MD / relax?)
while (pSPARC->SocketSCFCount <= pSPARC->socket_max_niter)
{
Expand Down

0 comments on commit 0a364ca

Please sign in to comment.