Skip to content
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

STELLOPT: Added section for auto-creation of zip files. #285

Merged
merged 2 commits into from
Oct 9, 2024
Merged
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
16 changes: 16 additions & 0 deletions STELLOPTV2/Sources/General/stellopt_optimize.f90
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ SUBROUTINE stellopt_optimize
REAL(rprec), ALLOCATABLE :: fjac(:,:)
LOGICAL :: used_mango_algorithm
REAL(rprec), EXTERNAL :: enorm
CHARACTER(200) :: cmdtxt = ""
EXTERNAL stellopt_fcn

!----------------------------------------------------------------------
Expand Down Expand Up @@ -313,6 +314,21 @@ SUBROUTINE stellopt_optimize
ier=-500
CALL stellopt_fcn(mtargets,nvars,vars,fvec,ier,nfev)
END IF
!DEC$ IF DEFINED (STELZIP)
IF (myid == master) THEN
! Remove the *_opt* files
WRITE(6,*) ' Cleaning up _opt files'; CALL FLUSH(6); ier = 0; ierr_mpi = 0; cmdtxt=''
CALL EXECUTE_COMMAND_LINE("rm -rf *_opt*",WAIT=.TRUE.,EXITSTAT=ier,CMDSTAT=ierr_mpi,CMDMSG=cmdtxt)
WRITE(6,*) ' rm: EXITSTAT=',ier,' CMDSTAT=',ierr_mpi; CALL FLUSH(6)
WRITE(6,*) ' MESSAGE: ',TRIM(cmdtxt); CALL FLUSH(6)
! Zip up the results
WRITE(6,*) ' Zipping files'; CALL FLUSH(6); ier = 0; ierr_mpi = 0; cmdtxt=''
CALL EXECUTE_COMMAND_LINE("zip -r stellopt_files.zip *",WAIT=.TRUE.,EXITSTAT=ier,CMDSTAT=ierr_mpi,CMDMSG=cmdtxt)
WRITE(6,*) ' zip: EXITSTAT=',ier,' CMDSTAT=',ierr_mpi; CALL FLUSH(6)
WRITE(6,*) ' MESSAGE: ',TRIM(cmdtxt); CALL FLUSH(6)
ier = 0; ierr_mpi=0
END IF
!DEC$ ENDIF
IF (ALLOCATED(fvec)) DEALLOCATE(fvec)

!DEC$ IF DEFINED (MPI_OPT)
Expand Down