diff --git a/.travis.yml b/.travis.yml index 8f4fec1..208fe3f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,7 +36,7 @@ before_script: env: - OPTIONS="CVR=ON" TEST="" CHOICES=gfort.lapack - OPTIONS="CVR=ON PROGRESS=ON" TEST="" CHOICES=gfort.lapack - - OPTIONS="CVR=ON MAKELIB=ON lammps" TEST="_lmp" CHOICES=gfort.lapack + # - OPTIONS="CVR=ON MAKELIB=ON lammps" TEST="_lmp" CHOICES=gfort.lapack - LATTE_CMAKE=yes CMAKE_WITH_PROGRESS=yes - LATTE_CMAKE=yes LAMMPS_CMAKE=yes diff --git a/Manual/refman.pdf b/Manual/refman.pdf new file mode 100644 index 0000000..a1c7256 Binary files /dev/null and b/Manual/refman.pdf differ diff --git a/src/Doxyfile.in b/src/Doxyfile.in index b3d1d51..6894739 100644 --- a/src/Doxyfile.in +++ b/src/Doxyfile.in @@ -38,7 +38,7 @@ PROJECT_NAME = LATTE # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.0 +PROJECT_NUMBER = v1.2.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/src/constants_mod.f90 b/src/constants_mod.f90 index ed0d6e7..2c8669a 100644 --- a/src/constants_mod.f90 +++ b/src/constants_mod.f90 @@ -58,6 +58,7 @@ MODULE CONSTANTS_MOD INTEGER :: RSLEVEL INTEGER :: RESTARTLIB INTEGER :: FREEZE + INTEGER :: NEWSYSTEMLATTE REAL(LATTEPREC) :: BOX(3,3), BOX_OLD(3,3), BOXDIMS(3) REAL(LATTEPREC) :: BNDFIL, TOTNE REAL(LATTEPREC) :: COVE, TOTE, ENTE, KEE, ECOUL, EREP, TRRHOH diff --git a/src/deallocateall.f90 b/src/deallocateall.f90 index 32e5ce5..b9af1e1 100644 --- a/src/deallocateall.f90 +++ b/src/deallocateall.f90 @@ -39,7 +39,6 @@ SUBROUTINE DEALLOCATEALL USE PUREARRAY USE VIRIALARRAY - IMPLICIT NONE IF (EXISTERROR) RETURN diff --git a/src/diagmyh.f90 b/src/diagmyh.f90 index 8c06fac..1a1e122 100644 --- a/src/diagmyh.f90 +++ b/src/diagmyh.f90 @@ -48,8 +48,11 @@ SUBROUTINE DIAGMYH() #ifdef XSYEV #ifdef DOUBLEPREC + + CALL DSYEV(JOBZ, UPLO, HDIM, EVECS, HDIM, EVALS, & DIAG_WORK, DIAG_LWORK,INFO) + #elif defined(SINGLEPREC) ! ALLOCATE(TMPHMAT(HDIM, HDIM), TMPEVALS(HDIM), DWORK(3*HDIM - 1)) @@ -77,7 +80,7 @@ SUBROUTINE DIAGMYH() DIAG_WORK, DIAG_LWORK, DIAG_IWORK, DIAG_LIWORK, INFO) #endif -#endif +#endif ELSE @@ -130,6 +133,7 @@ SUBROUTINE DIAGMYH() ENDIF + RETURN END SUBROUTINE DIAGMYH diff --git a/src/getrho.f90 b/src/getrho.f90 index 911c653..7c4a6c4 100644 --- a/src/getrho.f90 +++ b/src/getrho.f90 @@ -52,6 +52,7 @@ SUBROUTINE GETRHO(MDITER) ENDIF #else CALL DIAGMYH() + IF (SPINON .EQ. 0) THEN CALL BOEVECS() ELSE @@ -80,7 +81,7 @@ SUBROUTINE GETRHO(MDITER) #ifdef PROGRESSON CALL SP2PRG - + #else IF (MDITER .LE. 10) THEN diff --git a/src/latte_c_bind.f90 b/src/latte_c_bind.f90 index 7dea2e9..35e9992 100644 --- a/src/latte_c_bind.f90 +++ b/src/latte_c_bind.f90 @@ -40,7 +40,8 @@ !! \param VEL Velocities passed to latte. !! \param DT integration step passed to latte. !! \param DT integration step passed to latte. -!! \param VIRIALINOUT Components of the second virial coefficient +!! \param VIRIAL_INOUT Components of the second virial coefficient +!! \param NEWSYSTEM Tells LATTE if a new system is passed. !! \param EXISTERROR Returns an error flag (.true.) to the hosting code. !! !! \brief This routine will be used load call latte_lib from a C/C++ program: @@ -58,9 +59,9 @@ !! \brief Note: All units are LATTE units by default. !! See https://github.com/losalamos/LATTE/blob/master/Manual/LATTE_manual.pdf !! -SUBROUTINE LATTE_C_BIND (FLAGS,NATS,COORDS,TYPES,NTYPES,MASSES,XLO & - ,XHI,XY,XZ,YZ,FORCES,MAXITER,VENERG, & - VEL,DT,VIRIALINOUT,EXISTERROR) BIND (C, NAME="latte") +SUBROUTINE LATTE_C_BIND (FLAGS, NATS, COORDS, TYPES, NTYPES, MASSES, XLO & + , XHI, XY, XZ, YZ, FORCES, MAXITER, VENERG, & + VEL, DT, VIRIAL_INOUT, NEWSYSTEM, EXISTERROR) BIND (C, NAME="latte") USE ISO_C_BINDING, ONLY: C_CHAR, C_NULL_CHAR, C_DOUBLE, C_INT, C_BOOL USE LATTE_LIB @@ -73,11 +74,12 @@ SUBROUTINE LATTE_C_BIND (FLAGS,NATS,COORDS,TYPES,NTYPES,MASSES,XLO & REAL(C_DOUBLE) :: XLO(3), EKIN, VENERG, DT REAL(C_DOUBLE) :: XY, XZ, YZ REAL(C_DOUBLE), INTENT(INOUT) :: FORCES(3, NATS), VEL(3, NATS) - REAL(C_DOUBLE), INTENT(INOUT) :: VIRIALINOUT(6) + REAL(C_DOUBLE), INTENT(INOUT) :: VIRIAL_INOUT(6) LOGICAL(C_BOOL) :: EXISTERROR + INTEGER(C_INT), INTENT(INOUT) :: NEWSYSTEM CALL LATTE(NTYPES, TYPES, COORDS, MASSES, XLO, XHI, XY, XZ, YZ, FORCES, & - MAXITER, VENERG, VEL, DT, VIRIALINOUT, EXISTERROR) + MAXITER, VENERG, VEL, DT, VIRIAL_INOUT, NEWSYSTEM, EXISTERROR) RETURN diff --git a/src/latte_lib.f90 b/src/latte_lib.f90 index bfb0625..58e63a0 100644 --- a/src/latte_lib.f90 +++ b/src/latte_lib.f90 @@ -88,8 +88,9 @@ MODULE LATTE_LIB !! \param VENERG This is the potential Energy that is given back from latte to the hosting code. !! \param VEL Velocities passed to latte. !! \param DT integration step passed to latte. - !! \param VIRIALINOUT Components of the second virial coefficient - !! \param EXISTERROR Returns an error flag (.true.) to the hosting code. + !! \param VIRIAL_INOUT Components of the second virial coefficient. + !! \param NEWSYSTEM Tells LATTE if a new system is passed. + !! \param EXISTERROR_INOUT Returns an error flag (.true.) to the hosting code. !! !! \brief This routine will be used load call latte_lib from a C/C++ program: !! @@ -105,8 +106,8 @@ MODULE LATTE_LIB !! !! \brief Note: All units are LATTE units by default. See https://github.com/losalamos/LATTE/blob/master/Manual/LATTE_manual.pdf !! - SUBROUTINE LATTE(NTYPES,TYPES,CR_IN,MASSES_IN,XLO,XHI,XY,XZ,YZ,FTOT_OUT, & - MAXITER_IN, VENERG, VEL_IN, DT_IN, VIRIALINOUT, EXISTERROR_INOUT) + SUBROUTINE LATTE(NTYPES, TYPES, CR_IN, MASSES_IN, XLO, XHI, XY, XZ, YZ, FTOT_OUT, & + MAXITER_IN, VENERG, VEL_IN, DT_IN, VIRIAL_INOUT, NEWSYSTEM, EXISTERROR_INOUT) USE CONSTANTS_MOD, ONLY: EXISTERROR @@ -122,10 +123,11 @@ SUBROUTINE LATTE(NTYPES,TYPES,CR_IN,MASSES_IN,XLO,XHI,XY,XZ,YZ,FTOT_OUT, & REAL(LATTEPREC), INTENT(IN) :: CR_IN(:,:),VEL_IN(:,:), MASSES_IN(:),XLO(3),XHI(3) REAL(LATTEPREC), INTENT(IN) :: DT_IN, XY, XZ, YZ REAL(LATTEPREC), INTENT(OUT) :: FTOT_OUT(:,:), VENERG - REAL(LATTEPREC), INTENT(OUT) :: VIRIALINOUT(6) + REAL(LATTEPREC), INTENT(OUT) :: VIRIAL_INOUT(6) INTEGER, INTENT(IN) :: NTYPES, TYPES(:), MAXITER_IN LOGICAL(1), INTENT(INOUT) :: EXISTERROR_INOUT REAL(LATTEPREC) :: MLSI, LUMO, HOMO + INTEGER, INTENT(INOUT) :: NEWSYSTEM #ifdef PROGRESSON TYPE(SYSTEM_TYPE) :: SY @@ -133,7 +135,6 @@ SUBROUTINE LATTE(NTYPES,TYPES,CR_IN,MASSES_IN,XLO,XHI,XY,XZ,YZ,FTOT_OUT, & #ifdef MPI_ON INTEGER :: IERR, STATUS(MPI_STATUS_SIZE), NUMPROCS - CALL MPI_INIT( IERR ) CALL MPI_COMM_RANK( MPI_COMM_WORLD, MYID, IERR ) CALL MPI_COMM_SIZE( MPI_COMM_WORLD, NUMPROCS, IERR ) @@ -141,8 +142,9 @@ SUBROUTINE LATTE(NTYPES,TYPES,CR_IN,MASSES_IN,XLO,XHI,XY,XZ,YZ,FTOT_OUT, & EXISTERROR = .FALSE. !We assume we start the lib call without errors - !INITIALIZATION - IF(.NOT. LIBINIT)THEN + IF(.NOT. LIBINIT .OR. NEWSYSTEM == 1)THEN + + CALL DEALLOCATEALL() LIBRUN = .TRUE. @@ -288,10 +290,9 @@ SUBROUTINE LATTE(NTYPES,TYPES,CR_IN,MASSES_IN,XLO,XHI,XY,XZ,YZ,FTOT_OUT, & CALL FLUSH(6) ENDIF + !End of initialization - !END OF INITIALIZATION - IF (MDON .EQ. 0 .AND. RELAXME .EQ. 0 .AND. DOSFITON .EQ. 0 & .AND. PPFITON .EQ. 0 .AND. ALLFITON .EQ. 0) THEN @@ -607,7 +608,7 @@ SUBROUTINE LATTE(NTYPES,TYPES,CR_IN,MASSES_IN,XLO,XHI,XY,XZ,YZ,FTOT_OUT, & CALL DTIME(TARRAY, RESULT) IF (VERBOSE >= 1)WRITE(*,*)"Setting up TBMD ..." - CALL SETUPTBMD + CALL SETUPTBMD(NEWSYSTEM) CALL FLUSH(6) @@ -706,9 +707,10 @@ SUBROUTINE LATTE(NTYPES,TYPES,CR_IN,MASSES_IN,XLO,XHI,XY,XZ,YZ,FTOT_OUT, & ! CALL GETPRESSURE - VIRIALINOUT = -VIRIAL + VIRIAL_INOUT = -VIRIAL LIBINIT = .TRUE. + NEWSYSTEM = 0 !Setting newsystem back to 0. #ifdef PROGRESSON IF(MOD(LIBCALLS,WRTFREQ) == 0)THEN @@ -777,6 +779,7 @@ SUBROUTINE LATTE(NTYPES,TYPES,CR_IN,MASSES_IN,XLO,XHI,XY,XZ,YZ,FTOT_OUT, & CALL FLUSH(6) !To force writing to file at every call EXISTERROR_INOUT = EXISTERROR + RETURN ELSEIF (MDON .EQ. 1 .AND. RELAXME .EQ. 0 .AND. MAXITER_IN >= 0) THEN @@ -912,6 +915,7 @@ SUBROUTINE LATTE(NTYPES,TYPES,CR_IN,MASSES_IN,XLO,XHI,XY,XZ,YZ,FTOT_OUT, & #endif LIBINIT = .TRUE. + NEWSYSTEM = 0 !Setting newsystem back to 0. EXISTERROR_INOUT = EXISTERROR END SUBROUTINE LATTE diff --git a/src/qconsistency.f90 b/src/qconsistency.f90 index 21d9bfe..b22f10a 100644 --- a/src/qconsistency.f90 +++ b/src/qconsistency.f90 @@ -37,6 +37,7 @@ SUBROUTINE QCONSISTENCY(SWITCH, MDITER) REAL(4) :: TIMEACC REAL(LATTEPREC) :: MAXDQ REAL(LATTEPREC), ALLOCATABLE :: QDIFF(:), SPINDIFF(:) + IF (EXISTERROR) RETURN ! @@ -77,6 +78,7 @@ SUBROUTINE QCONSISTENCY(SWITCH, MDITER) ENDIF ENDIF + ! Compute the density matrix TX = START_TIMER(DMBUILD_TIMER) diff --git a/src/setuptbmd.f90 b/src/setuptbmd.f90 index 367553f..a61b938 100644 --- a/src/setuptbmd.f90 +++ b/src/setuptbmd.f90 @@ -19,7 +19,7 @@ ! Public License for more details. ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -SUBROUTINE SETUPTBMD +SUBROUTINE SETUPTBMD(NEWSYSTEM) USE CONSTANTS_MOD USE SETUPARRAY @@ -41,14 +41,15 @@ SUBROUTINE SETUPTBMD INTEGER :: START_CLOCK, STOP_CLOCK, CLOCK_RATE, CLOCK_MAX REAL(LATTEPREC) :: THETIME, NEWESPIN, NEWECOUL REAL(LATTEPREC) :: RN, MYVOL - INTEGER :: FLAGAND + INTEGER :: FLAGAND, NEWSYSTEM + IF (EXISTERROR) RETURN ! ! Read MDcontroller to determine what kind of MD simulation to do ! - IF(.NOT.LIBINIT)THEN + IF(NEWSYSTEM == 1 .OR. (.NOT.LIBINIT))THEN IF (LATTEINEXISTS) THEN CALL PARSE_MD("latte.in") @@ -72,7 +73,7 @@ SUBROUTINE SETUPTBMD ! to get the bond-order ! - IF(.NOT.LIBINIT)THEN + IF(NEWSYSTEM == 1 .OR. .NOT.LIBINIT)THEN IF (CONTROL .EQ. 1) THEN CALL ALLOCATEDIAG ELSEIF (CONTROL .EQ. 2 .OR. CONTROL .EQ. 4 .OR. CONTROL .EQ. 5) THEN