address portability issues to the flang LLVM Fortran 2018 compiler

This commit is contained in:
Axel Kohlmeyer 2022-10-16 11:48:18 -04:00
parent c206cbf6d1
commit 46a72f685c
No known key found for this signature in database
GPG Key ID: D9B44E93BF0C375A
2 changed files with 9 additions and 8 deletions

View File

@ -60,7 +60,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
@ -94,7 +94,7 @@ FUNCTION f_lammps_with_C_args(argc, argv) BIND(C)
INTERFACE INTERFACE
FUNCTION c_strlen(str) BIND(C,name='strlen') FUNCTION c_strlen(str) BIND(C,name='strlen')
IMPORT :: c_ptr, c_size_t USE ISO_C_BINDING, ONLY: c_ptr, c_size_t
IMPLICIT NONE IMPLICIT NONE
TYPE(c_ptr), INTENT(IN), VALUE :: str TYPE(c_ptr), INTENT(IN), VALUE :: str
INTEGER(c_size_t) :: c_strlen INTEGER(c_size_t) :: c_strlen

View File

@ -71,13 +71,13 @@ FUNCTION f_lammps_gather_atoms_concat_mask(i) BIND(C)
CALL lmp%gather_atoms_concat('mask', 1_c_int, mask) CALL lmp%gather_atoms_concat('mask', 1_c_int, mask)
CALL lmp%gather_atoms_concat('id', 1_c_int, tag) CALL lmp%gather_atoms_concat('id', 1_c_int, tag)
f_lammps_gather_atoms_concat_mask = -1
DO j = 1, SIZE(tag) DO j = 1, SIZE(tag)
IF (tag(j) == i) THEN IF (tag(j) == i) THEN
f_lammps_gather_atoms_concat_mask = mask(j) f_lammps_gather_atoms_concat_mask = mask(j)
RETURN EXIT
END IF END IF
END DO END DO
f_lammps_gather_atoms_concat_mask = -1
END FUNCTION f_lammps_gather_atoms_concat_mask END FUNCTION f_lammps_gather_atoms_concat_mask
FUNCTION f_lammps_gather_atoms_concat_position(xyz, id) BIND(C) FUNCTION f_lammps_gather_atoms_concat_position(xyz, id) BIND(C)
@ -93,6 +93,7 @@ FUNCTION f_lammps_gather_atoms_concat_position(xyz, id) BIND(C)
CALL lmp%gather_atoms_concat('x', 3_c_int, positions) CALL lmp%gather_atoms_concat('x', 3_c_int, positions)
CALL lmp%gather_atoms_concat('id', 1_c_int, tag) CALL lmp%gather_atoms_concat('id', 1_c_int, tag)
f_lammps_gather_atoms_concat_position = -1.0_c_double
DO j = 1, SIZE(tag) DO j = 1, SIZE(tag)
IF (tag(j) == id) THEN IF (tag(j) == id) THEN
f_lammps_gather_atoms_concat_position = positions((j-1)*3 + xyz) f_lammps_gather_atoms_concat_position = positions((j-1)*3 + xyz)
@ -112,13 +113,13 @@ FUNCTION f_lammps_gather_atoms_subset_mask(i) BIND(C)
INTEGER(c_int), DIMENSION(*), PARAMETER :: tag = [3,2] INTEGER(c_int), DIMENSION(*), PARAMETER :: tag = [3,2]
CALL lmp%gather_atoms_subset('mask', 1_c_int, tag, mask) CALL lmp%gather_atoms_subset('mask', 1_c_int, tag, mask)
f_lammps_gather_atoms_subset_mask = -1
DO j = 1, SIZE(tag) DO j = 1, SIZE(tag)
IF (tag(j) == i) THEN IF (tag(j) == i) THEN
f_lammps_gather_atoms_subset_mask = mask(j) f_lammps_gather_atoms_subset_mask = mask(j)
RETURN EXIT
END IF END IF
END DO END DO
f_lammps_gather_atoms_subset_mask = -1
END FUNCTION f_lammps_gather_atoms_subset_mask END FUNCTION f_lammps_gather_atoms_subset_mask
FUNCTION f_lammps_gather_atoms_subset_position(xyz,id) BIND(C) FUNCTION f_lammps_gather_atoms_subset_position(xyz,id) BIND(C)
@ -133,13 +134,13 @@ FUNCTION f_lammps_gather_atoms_subset_position(xyz,id) BIND(C)
INTEGER :: j INTEGER :: j
CALL lmp%gather_atoms_subset('x', 3_c_int, tag, positions) CALL lmp%gather_atoms_subset('x', 3_c_int, tag, positions)
f_lammps_gather_atoms_subset_position = -1.0_c_double
DO j = 1, SIZE(tag) DO j = 1, SIZE(tag)
IF (tag(j) == id) THEN IF (tag(j) == id) THEN
f_lammps_gather_atoms_subset_position = positions((j-1)*3 + xyz) f_lammps_gather_atoms_subset_position = positions((j-1)*3 + xyz)
RETURN EXIT
END IF END IF
END DO END DO
f_lammps_gather_atoms_subset_position = -1.0D0
END FUNCTION f_lammps_gather_atoms_subset_position END FUNCTION f_lammps_gather_atoms_subset_position
SUBROUTINE f_lammps_scatter_atoms_masks() BIND(C) SUBROUTINE f_lammps_scatter_atoms_masks() BIND(C)