Skip to content
4 changes: 4 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ on:
branches:
- main
- development
types:
- opened
- synchronize
paths:
- ".github/workflows/cmake.yml"
- "CMakeLists.txt"
- "**.f90"
- "**.F90"
workflow_dispatch:

permissions:
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@ name: run-code-coverage

on:
push:
branches: ["main"]
branches:
- "main"
paths:
- ".github/workflows/coverage.yml"
- "CMakeLists.txt"
- "**.f90"
- "**.F90"
- "**.cmake"
pull_request:
branches: ["main"]
branches:
- "main"
types:
- opened
- synchronize
paths:
- ".github/workflows/coverage.yml"
- "CMakeLists.txt"
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: format-checker

on:
push:
branches:
- main
paths:
- ".github/workflows/formatting.yml"
- "**.f90"
- "**.F90"
pull_request:
branches:
- main
- development
types:
- opened
- synchronize
paths:
- ".github/workflows/formatting.yml"
- "**.f90"
- "**.F90"
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: formatting
cancel-in-progress: false

jobs:
format-checker:
runs-on: ubuntu-latest

steps:
- name: checkout repo
uses: actions/checkout@v4

- name: actions-setup-python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Run format checker
id: run_format_checker
run: |
python tools/check_indentation.py
continue-on-error: true

- name: Comment on PR if script failed
if: github.event_name == 'pull_request' && steps.run_format_checker.outcome != 'success'
run: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '⚠️ The format checker failed.
Please check the formatting of your code by running tools/check_indentation.py locally.'
})

3 changes: 3 additions & 0 deletions .github/workflows/fpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
branches:
- main
- development
types:
- opened
- synchronize
paths:
- ".github/workflows/fpm.yml"
- "fpm.toml"
Expand Down
75 changes: 36 additions & 39 deletions app/inputs.f90
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ subroutine set_global_vars()
!---------------------------------------------------------------------------
! read flags and assign to variables
!---------------------------------------------------------------------------
flagloop: do i=0,command_argument_count()
flagloop: do i = 0, command_argument_count()
empty=.false.
if (skip) then
skip=.false.
Expand All @@ -115,7 +115,7 @@ subroutine set_global_vars()
call get_command_argument(i,buffer)
buffer=trim(buffer)
!------------------------------------------------------------------------
! file and directory flags
! flag options
!------------------------------------------------------------------------
if(index(buffer,'-f').eq.1)then
flag="-f"
Expand All @@ -127,7 +127,7 @@ subroutine set_global_vars()
&ERROR: No input filename supplied, &
&but the flag ''-f'' was used&
&")')
infilename_do: do j=1,3
infilename_do: do j = 1, 3
write(6,'("Please supply an input filename:")')
read(5,'(A)') input_file
if(trim(input_file).ne.'')then
Expand All @@ -142,9 +142,6 @@ subroutine set_global_vars()
end if
end do infilename_do
end if
!------------------------------------------------------------------------
! verbose flags
!------------------------------------------------------------------------
elseif(index(buffer,'-v').eq.1)then
flag="-v"
call print_build_info()
Expand Down Expand Up @@ -228,9 +225,9 @@ subroutine read_input_file(file_name)
!---------------------------------------------------------------------------
! set up namelists for input file
!---------------------------------------------------------------------------
namelist /setup/ task, filename_host, seed, grid, &
grid_spacing, &
database_format, database, verbose, output_dir
namelist /setup/ task, filename_host, seed, grid, &
grid_spacing, &
database_format, database, verbose, output_dir
namelist /placement_method/ void, rand, walk, grow, min
namelist /structure/ num_structures,stoichiometry
namelist /distribution/ cutoff_min, cutoff_max, width, sigma
Expand Down Expand Up @@ -274,24 +271,24 @@ subroutine read_input_file(file_name)
end if
read(unit,NML=structure,iostat=iostat)
if(.not.is_iostat_end(iostat).and.iostat.ne.0)then
call stop_program( &
"THERE WAS AN ERROR IN READING STRUCTURE SETTINGS" &
)
return
call stop_program( &
"THERE WAS AN ERROR IN READING STRUCTURE SETTINGS" &
)
return
end if
read(unit,NML=distribution,iostat=iostat)
if(.not.is_iostat_end(iostat).and.iostat.ne.0)then
call stop_program( &
"THERE WAS AN ERROR IN READING DISTRIBUTION SETTINGS" &
)
return
call stop_program( &
"THERE WAS AN ERROR IN READING DISTRIBUTION SETTINGS" &
)
return
end if
read(unit,NML=element_info,iostat=iostat)
if(.not.is_iostat_end(iostat).and.iostat.ne.0)then
call stop_program( &
"THERE WAS AN ERROR IN READING ELEMENT_INFO SETTINGS" &
)
return
call stop_program( &
"THERE WAS AN ERROR IN READING ELEMENT_INFO SETTINGS" &
)
return
end if


Expand All @@ -303,19 +300,19 @@ subroutine read_input_file(file_name)
read(database,*) database_list
l_pos = 0
do i = 1, size(database_list)
read(database(l_pos+1:),'(A)') buffer
r_pos = scan(buffer,",")
if(r_pos.eq.0) r_pos = len_trim(buffer)
read(buffer(:r_pos-1),'(A)') database_list(i)
l_pos = scan(database(l_pos+1:),",") + l_pos
end do
read(database(l_pos+1:),'(A)') buffer
r_pos = scan(buffer,",")
if(r_pos.eq.0) r_pos = len_trim(buffer)
read(buffer(:r_pos-1),'(A)') database_list(i)
l_pos = scan(database(l_pos+1:),",") + l_pos
end do
end if

method_probab = [void, rand, walk, grow, min]
if(all(abs(method_probab).lt.1.E-6))then
method_probab = &
[1._real32, 0.1_real32, 0.5_real32, 0.5_real32, 1._real32]
end if
end if

if(trim(stoichiometry).ne."")then
num_species = icount(stoichiometry,",")
Expand All @@ -335,17 +332,17 @@ subroutine read_input_file(file_name)


if(trim(energies).ne."")then
num_species = icount(energies,",")
allocate(element_symbols(num_species))
allocate(element_energies(num_species))
l_pos = scan(energies,"{")
r_pos = scan(energies,"}", back=.true.)
do i = 1, num_species
read(energies(l_pos+1:r_pos-1),'(A)') buffer
read(buffer(:scan(buffer,":")-1),*) element_symbols(i)
read(buffer(scan(buffer,":")+1:),*) element_energies(i)
l_pos = scan(energies(l_pos+1:),",") + l_pos
end do
num_species = icount(energies,",")
allocate(element_symbols(num_species))
allocate(element_energies(num_species))
l_pos = scan(energies,"{")
r_pos = scan(energies,"}", back=.true.)
do i = 1, num_species
read(energies(l_pos+1:r_pos-1),'(A)') buffer
read(buffer(:scan(buffer,":")-1),*) element_symbols(i)
read(buffer(scan(buffer,":")+1:),*) element_energies(i)
l_pos = scan(energies(l_pos+1:),",") + l_pos
end do
else
call stop_program("No element energies specified")
return
Expand Down
4 changes: 2 additions & 2 deletions app/main.f90
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ subroutine get_next_directory(prefix, num, next_dir)
open( newunit=unit, file='iter_count.txt', &
status='old', action='read', iostat=ierror)
if (ierror .ne. 0) then
call stop_program('Opening pipe to list directories')
return
call stop_program('Opening pipe to list directories')
return
end if

! Read the output of the command and get number of directories
Expand Down
36 changes: 20 additions & 16 deletions app/mod_read_structures.f90
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,16 @@ function get_gdfs_from_data(input_dir, &
structure_list = [ get_structure_list( dir_ptr, ifile_format ) ]
rank(1)
do i = 1, size(dir_ptr)
if(i.eq.1)then
structure_list = [ &
get_structure_list( dir_ptr(i), ifile_format ) &
]
else
structure_list = [ &
structure_list, &
get_structure_list( dir_ptr(i), ifile_format ) &
]
end if
if(i.eq.1)then
structure_list = [ &
get_structure_list( dir_ptr(i), ifile_format ) &
]
else
structure_list = [ &
structure_list, &
get_structure_list( dir_ptr(i), ifile_format ) &
]
end if
end do
end select

Expand Down Expand Up @@ -173,13 +173,17 @@ function get_gdfs_from_data(input_dir, &
call geom_read(unit, basis)

num_structures = num_structures + 1
write(format,'("(""Found structure: "",I4,"" with energy: "",&
&F13.7,"" and formula:"",",I0,"(1X,A,I0))")') basis%nspec
write(format,'&
&("(""Found structure: "",I4,"" with energy: "",&
&F13.7,"" and formula:"",",I0,"(1X,A,I0))")' &
) basis%nspec
write(*,format) &
num_structures, &
basis%energy, &
( trim(basis%spec(j)%name), basis%spec(j)%num, &
j=1, basis%nspec )
( &
trim(basis%spec(j)%name), basis%spec(j)%num, &
j=1, basis%nspec &
)
call distribs_container%add(basis)
end do
cycle
Expand Down Expand Up @@ -268,8 +272,8 @@ function get_structure_list(input_dir, ifile_format) result(structure_list)

if(.not.structures_found) then
write(stop_msg,'("No structures found in directory: """,A, &
&""" with format: ",I0)') &
trim(input_dir), ifile_format
&""" with format: ",I0)' &
) trim(input_dir), ifile_format
call stop_program(stop_msg)
return
end if
Expand Down
6 changes: 3 additions & 3 deletions app/mod_rw_vasprun.f90
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module rw_vasprun
!###############################################################################
recursive subroutine find_section( &
unit, section, found, name, end_section, depth &
)
)
!! Find a section in a vasprun.xml file.
!!
!! This subroutine reads a vasprun.xml file and searches for an embedded
Expand Down Expand Up @@ -79,7 +79,7 @@ recursive subroutine find_section( &
if(trim(name_(1)).ne."")then
name_string = ' name="'//trim(adjustl(name_(1)))//'" >'
else
name_string = ">"
name_string = ">"
end if


Expand All @@ -102,7 +102,7 @@ recursive subroutine find_section( &
if(is_iostat_end(ierror)) exit
if(ierror .ne. 0) then
call stop_program( &
'Issue encountered when reading vasprun.xml' &
'Issue encountered when reading vasprun.xml' &
)
return
end if
Expand Down
5 changes: 2 additions & 3 deletions src/fortran/lib/mod_dist_calcs.f90
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function get_min_dist(basis,loc,lignore_close,axis,labove,lreal,tol, &
min_bond=huge(0._real32)
output = 0._real32
do js = 1, basis%nspec
atmloop: do ja=1,basis%spec(js)%num
atmloop: do ja = 1, basis%spec(js)%num
if(present(ignore_list))then
do i = 1, size(ignore_list,1), 1
if(all(ignore_list(i,:).eq.[js,ja])) cycle atmloop
Expand Down Expand Up @@ -118,8 +118,7 @@ end function get_min_dist


!###############################################################################
pure function get_min_dist_between_point_and_atom(basis,loc,atom) &
result(dist)
pure function get_min_dist_between_point_and_atom(basis,loc,atom) result(dist)
!! Return the minimum distance between a point and an atom in a cell.
!!
!! This function returns the minimum distance between a point and an atom
Expand Down
Loading