mirror of https://github.com/lammps/lammps.git
increase portability and standard conformance
This commit is contained in:
parent
4c0b415487
commit
c214a81526
|
@ -1690,7 +1690,6 @@ CONTAINS
|
||||||
IF (size_tagint /= 4_c_int) THEN
|
IF (size_tagint /= 4_c_int) THEN
|
||||||
CALL lmp_error(self, LMP_ERROR_ALL + LMP_ERROR_WORLD, &
|
CALL lmp_error(self, LMP_ERROR_ALL + LMP_ERROR_WORLD, &
|
||||||
'Incompatible integer kind in gather_bonds [Fortran API]')
|
'Incompatible integer kind in gather_bonds [Fortran API]')
|
||||||
RETURN
|
|
||||||
END IF
|
END IF
|
||||||
IF (ALLOCATED(data)) DEALLOCATE(data)
|
IF (ALLOCATED(data)) DEALLOCATE(data)
|
||||||
size_bigint = lmp_extract_setting(self, 'bigint')
|
size_bigint = lmp_extract_setting(self, 'bigint')
|
||||||
|
@ -1717,7 +1716,6 @@ CONTAINS
|
||||||
IF (size_tagint /= 8_c_int) THEN
|
IF (size_tagint /= 8_c_int) THEN
|
||||||
CALL lmp_error(self, LMP_ERROR_ALL + LMP_ERROR_WORLD, &
|
CALL lmp_error(self, LMP_ERROR_ALL + LMP_ERROR_WORLD, &
|
||||||
'Incompatible integer kind in gather_bonds [Fortran API]')
|
'Incompatible integer kind in gather_bonds [Fortran API]')
|
||||||
RETURN
|
|
||||||
END IF
|
END IF
|
||||||
nbonds = lmp_extract_global(self, 'nbonds')
|
nbonds = lmp_extract_global(self, 'nbonds')
|
||||||
IF (ALLOCATED(data)) DEALLOCATE(data)
|
IF (ALLOCATED(data)) DEALLOCATE(data)
|
||||||
|
@ -1750,7 +1748,6 @@ CONTAINS
|
||||||
CALL lmp_error(self, LMP_ERROR_ALL + LMP_ERROR_WORLD, &
|
CALL lmp_error(self, LMP_ERROR_ALL + LMP_ERROR_WORLD, &
|
||||||
'Unable to create_atoms; your id/image array types are incompatible&
|
'Unable to create_atoms; your id/image array types are incompatible&
|
||||||
& with LAMMPS_SMALLBIG and LAMMPS_SMALLSMALL [Fortran/create_atoms]')
|
& with LAMMPS_SMALLBIG and LAMMPS_SMALLSMALL [Fortran/create_atoms]')
|
||||||
RETURN ! in case exception is caught
|
|
||||||
END IF
|
END IF
|
||||||
n = SIZE(type, KIND=c_int)
|
n = SIZE(type, KIND=c_int)
|
||||||
IF (PRESENT(bexpand)) THEN
|
IF (PRESENT(bexpand)) THEN
|
||||||
|
@ -1769,8 +1766,6 @@ CONTAINS
|
||||||
END IF
|
END IF
|
||||||
IF (PRESENT(type)) THEN
|
IF (PRESENT(type)) THEN
|
||||||
Ctype = C_LOC(type(1))
|
Ctype = C_LOC(type(1))
|
||||||
ELSE
|
|
||||||
RETURN ! We shouldn't get here unless exceptions are being caught
|
|
||||||
END IF
|
END IF
|
||||||
IF (PRESENT(image)) THEN
|
IF (PRESENT(image)) THEN
|
||||||
Cimage = C_LOC(image(1))
|
Cimage = C_LOC(image(1))
|
||||||
|
@ -1782,7 +1777,6 @@ CONTAINS
|
||||||
ELSE
|
ELSE
|
||||||
CALL lmp_error(self, LMP_ERROR_ALL + LMP_ERROR_WORLD, &
|
CALL lmp_error(self, LMP_ERROR_ALL + LMP_ERROR_WORLD, &
|
||||||
'the argument "x" to create_atoms is required')
|
'the argument "x" to create_atoms is required')
|
||||||
RETURN
|
|
||||||
END IF
|
END IF
|
||||||
IF (PRESENT(v)) THEN
|
IF (PRESENT(v)) THEN
|
||||||
Cv = C_LOC(v(1))
|
Cv = C_LOC(v(1))
|
||||||
|
@ -2647,11 +2641,11 @@ CONTAINS
|
||||||
|
|
||||||
IF (.NOT. C_ASSOCIATED(ptr)) THEN
|
IF (.NOT. C_ASSOCIATED(ptr)) THEN
|
||||||
f_string = ''
|
f_string = ''
|
||||||
RETURN
|
ELSE
|
||||||
|
n = INT(c_strlen(ptr), KIND=KIND(n))
|
||||||
|
CALL C_F_POINTER(ptr, c_string, [n+1])
|
||||||
|
f_string = array2string(c_string, n)
|
||||||
END IF
|
END IF
|
||||||
n = INT(c_strlen(ptr), KIND=KIND(n))
|
|
||||||
CALL C_F_POINTER(ptr, c_string, [n+1])
|
|
||||||
f_string = array2string(c_string, n)
|
|
||||||
END FUNCTION c2f_string
|
END FUNCTION c2f_string
|
||||||
|
|
||||||
! Copy a known-length or null-terminated array of C characters into a string
|
! Copy a known-length or null-terminated array of C characters into a string
|
||||||
|
|
|
@ -14,8 +14,9 @@ if(CMAKE_Fortran_COMPILER)
|
||||||
message(STATUS "Skipping Tests for the LAMMPS Fortran Module: cannot identify Fortran compiler")
|
message(STATUS "Skipping Tests for the LAMMPS Fortran Module: cannot identify Fortran compiler")
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
# GNU Fortran 4.8.x on RHEL/CentOS 7.x is not sufficient to compile the Fortran module
|
# GNU Fortran 4.8.x on RHEL/CentOS 7.x is not sufficient to compile the Fortran module. Work around flang being detected as GNU
|
||||||
if((CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") AND (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 6.0))
|
get_filename_component(_tmp_fc ${CMAKE_Fortran_COMPILER} NAME)
|
||||||
|
if((CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") AND (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 6.0) AND NOT (_tmp_fc STREQUAL "flang"))
|
||||||
message(FATAL_ERROR "Need GNU Fortran compiler version 6.x or later for unit testing")
|
message(FATAL_ERROR "Need GNU Fortran compiler version 6.x or later for unit testing")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -36,6 +37,10 @@ if(CMAKE_Fortran_COMPILER)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(flammps STATIC ${LAMMPS_FORTRAN_MODULE} keepstuff.f90)
|
add_library(flammps STATIC ${LAMMPS_FORTRAN_MODULE} keepstuff.f90)
|
||||||
|
get_filename_component(_tmp_fc ${CMAKE_Fortran_COMPILER} NAME)
|
||||||
|
if (_tmp_fc STREQUAL "flang")
|
||||||
|
target_link_libraries(flammps PUBLIC gfortran)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(MPI_Fortran_HAVE_F90_MODULE)
|
if(MPI_Fortran_HAVE_F90_MODULE)
|
||||||
add_executable(test_fortran_create wrap_create.cpp test_fortran_create.f90)
|
add_executable(test_fortran_create wrap_create.cpp test_fortran_create.f90)
|
||||||
|
|
|
@ -46,7 +46,7 @@ CONTAINS
|
||||||
|
|
||||||
INTERFACE
|
INTERFACE
|
||||||
FUNCTION lammps_malloc(size) BIND(C, name='malloc')
|
FUNCTION lammps_malloc(size) BIND(C, name='malloc')
|
||||||
IMPORT :: c_ptr, c_size_t
|
USE, INTRINSIC :: ISO_C_BINDING, ONLY : c_ptr, c_size_t
|
||||||
IMPLICIT NONE
|
IMPLICIT NONE
|
||||||
INTEGER(c_size_t), VALUE :: size
|
INTEGER(c_size_t), VALUE :: size
|
||||||
TYPE(c_ptr) :: lammps_malloc
|
TYPE(c_ptr) :: lammps_malloc
|
||||||
|
|
Loading…
Reference in New Issue