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
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
INTEGER(c_size_t), VALUE :: size
TYPE(c_ptr) :: lammps_malloc
@ -94,7 +94,7 @@ FUNCTION f_lammps_with_C_args(argc, argv) BIND(C)
INTERFACE
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
TYPE(c_ptr), INTENT(IN), VALUE :: str
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('id', 1_c_int, tag)
f_lammps_gather_atoms_concat_mask = -1
DO j = 1, SIZE(tag)
IF (tag(j) == i) THEN
f_lammps_gather_atoms_concat_mask = mask(j)
RETURN
EXIT
END IF
END DO
f_lammps_gather_atoms_concat_mask = -1
END FUNCTION f_lammps_gather_atoms_concat_mask
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('id', 1_c_int, tag)
f_lammps_gather_atoms_concat_position = -1.0_c_double
DO j = 1, SIZE(tag)
IF (tag(j) == id) THEN
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]
CALL lmp%gather_atoms_subset('mask', 1_c_int, tag, mask)
f_lammps_gather_atoms_subset_mask = -1
DO j = 1, SIZE(tag)
IF (tag(j) == i) THEN
f_lammps_gather_atoms_subset_mask = mask(j)
RETURN
EXIT
END IF
END DO
f_lammps_gather_atoms_subset_mask = -1
END FUNCTION f_lammps_gather_atoms_subset_mask
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
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)
IF (tag(j) == id) THEN
f_lammps_gather_atoms_subset_position = positions((j-1)*3 + xyz)
RETURN
EXIT
END IF
END DO
f_lammps_gather_atoms_subset_position = -1.0D0
END FUNCTION f_lammps_gather_atoms_subset_position
SUBROUTINE f_lammps_scatter_atoms_masks() BIND(C)