Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ target_compile_options(${PROJECT_NAME} PUBLIC "$<$<CONFIG:Parallel>:${OPTIMFLAGS
target_compile_options(${PROJECT_NAME} PUBLIC "$<$<CONFIG:Parallel>:${MPFLAGS}>")
target_compile_options(${PROJECT_NAME} PUBLIC "$<$<CONFIG:Dev>:${DEVFLAGS}>")
target_compile_options(${PROJECT_NAME} PUBLIC "$<$<CONFIG:Debug>:${DEBUGFLAGS}>")
target_compile_options(${PROJECT_NAME} PUBLIC "$<$<CONFIG:Debug>:${WARNFLAGS}>")
target_compile_options(${PROJECT_NAME} PUBLIC "$<$<CONFIG:Release>:${PYTHONFLAGS}>")


Expand Down
14 changes: 3 additions & 11 deletions app/inputs.f90
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,13 @@ subroutine set_global_vars()
implicit none

! Local variables
integer :: iostat
!! I/O status.
integer :: i,j
!! Loop indices.
integer :: nseed
!! Number of random seed values.
character(1024) :: pattern,buffer,flag,input_file
character(1024) :: buffer, flag, input_file
!! Character variables.
logical :: skip, empty, filefound
logical :: skip, empty
!! Logical variables.
integer, dimension(:), allocatable :: seed_arr
!! Random seed array.
Expand Down Expand Up @@ -179,11 +177,9 @@ subroutine read_input_file(file_name)
!! Number of species and bonds.
integer :: iostat, unit, l_pos, r_pos
!! I/O status, unit, left and right positions.
character(1) :: fs
!! Field separator.
character(32) :: pair
!! Pair of elements.
character(1024) :: stoichiometry, elements, database, buffer, energies, &
character(1024) :: stoichiometry, database, buffer, energies, &
bond_radii
!! Strings buffers to hold input values (usually derived types).
real(real12), dimension(3) :: width, sigma
Expand All @@ -192,10 +188,6 @@ subroutine read_input_file(file_name)
!! Placement method probabilities.
character(50), dimension(3) :: cutoff_min, cutoff_max
!! Cutoff values for distribution functions.
integer, allocatable, dimension(:) :: stoichiometry_list
!! Stoichiometry list.
character(3), allocatable, dimension(:) :: element_list
!! Element list.


!---------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion app/main.f90
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ program raffle_program
case(1)
call get_next_directory(trim(output_dir), itmp1, next_dir)
write(*,'("Running iteration ",I0,&
" of host-based random structure search for ",I0," structures")' &
&" of host-based random structure search for ",I0," structures")' &
) itmp1 + 1, num_structures
case default
call stop_program("Invalid option")
Expand Down
6 changes: 1 addition & 5 deletions app/mod_read_structures.f90
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ function get_evolved_gvectors_from_data(input_dir, &
!! Optional. The format of the input files. Default is vasprun.xml.

! Local variables
character(256) :: name
!! The name of the structure file.
integer :: i, j
!! Loop indices.
integer :: ifile_format
Expand All @@ -62,12 +60,10 @@ function get_evolved_gvectors_from_data(input_dir, &
logical :: success
!! Boolean for success of file operations.

integer :: xml_unit, unit
integer :: unit
!! File units.
integer :: iostat
!! I/O status.
integer :: num_files
!! The number of files in the input directories.
type(basis_type) :: basis
!! The basis of the structure.
character(256), dimension(:), allocatable :: structure_list
Expand Down
5 changes: 3 additions & 2 deletions src/fortran/lib/mod_atom_adder.f90
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ function add_atom_void(grid, grid_offset, basis, atom_ignore_list, viable) &
! ... largest void space
!---------------------------------------------------------------------------
viable = .false.
best_location = 0._real12
best_location_bond = -huge(1._real12)
do i = 0, grid(1) - 1, 1
do j = 0, grid(2) - 1, 1
Expand Down Expand Up @@ -209,7 +210,7 @@ function add_atom_walk( gvector_container, &
!! Random number.
real(real12), dimension(3) :: rvec1, abc
!! Random vector and lattice constants.
integer :: crude_norm
real(real12) :: crude_norm
!! Crude normalisation.
real(real12) :: site_value, test_value
!! Viability values.
Expand Down Expand Up @@ -639,7 +640,7 @@ subroutine update_gridpoints_and_viability(points, gvector_container, basis, &
!! List of atoms to ignore (i.e. indices of atoms not yet placed).

! Local variables
integer :: i, j, k, l, is, ia
integer :: i, j, is
!! Loop indices.
integer :: num_points
!! Number of gridpoints.
Expand Down
6 changes: 3 additions & 3 deletions src/fortran/lib/mod_constants.f90
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ module constants
!! library.
implicit none
integer, parameter, public :: real12 = Selected_real_kind(6,37)!(15,307)
real(real12), parameter, public :: pi = 4.D0*atan(1._real12)
real(real12), parameter, public :: c = 0.26246582250210965422D0
real(real12), parameter, public :: c_vasp = 0.262465831D0
real(real12), parameter, public :: pi = 4._real12 * atan(1._real12)
real(real12), parameter, public :: c = 0.26246582250210965422_real12
real(real12), parameter, public :: c_vasp = 0.262465831_real12
real(real12), parameter, public :: INF = huge(0._real12)
complex(real12), parameter, public :: imag=(0._real12, 1._real12)
integer, public :: verbose = 0
Expand Down
4 changes: 0 additions & 4 deletions src/fortran/lib/mod_evaluator.f90
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ function evaluate_point( gvector_container, &
!! Loop counters.
integer :: num_2body, num_3body, num_4body
!! Number of 2-, 3- and 4-body interactions.
real(real12) :: contribution
!! Contribution to the viability map
real(real12) :: viability_2body
!! Viability of the test point for 2-body interactions.
real(real12) :: viability_3body, viability_4body
Expand Down Expand Up @@ -385,8 +383,6 @@ function evaluate_4body_contributions( gvector_container, &
!! Loop indices.
integer :: bin
!! Bin for the distribution function.
real(real12) :: contribution
!! Contribution to the viability map.
integer :: num_4body_local
!! Number of 4-body interactions local to the current atom triplet.

Expand Down
47 changes: 17 additions & 30 deletions src/fortran/lib/mod_evolver.f90
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ subroutine read(this, file)
! Local variables
integer :: unit
!! File unit.
integer :: i, j
integer :: j
!! Loop indices.
integer :: iostat
!! I/O status.
Expand Down Expand Up @@ -957,8 +957,6 @@ subroutine add(this, system)
!! Loop index.
integer :: num_structures_previous
!! Number of structures in the container before adding the system.
character(128) :: buffer
!! Buffer for writing messages.
character(256) :: stop_msg
!! Error message.

Expand Down Expand Up @@ -1058,6 +1056,7 @@ subroutine set_element_info(this)
!---------------------------------------------------------------------------
! get list of species in dataset
!---------------------------------------------------------------------------
allocate(element_list(0))
element_list = [ this%system(1)%element_symbols ]
do i = 2, size(this%system),1
element_list = [ element_list, this%system(i)%element_symbols ]
Expand Down Expand Up @@ -1115,6 +1114,7 @@ subroutine update_element_info(this)
!---------------------------------------------------------------------------
! get list of species in dataset
!---------------------------------------------------------------------------
allocate(element_list(0))
element_list = [ this%system(1)%element_symbols ]
do i = 2, size(this%system),1
element_list = [ element_list, this%system(i)%element_symbols ]
Expand Down Expand Up @@ -1301,12 +1301,10 @@ subroutine set_bond_info(this)
!! Parent of the procedure. Instance of distribution functions container.

! Local variables
integer :: i, j, k, idx1, idx2
integer :: i, j
!! Loop index.
integer :: num_elements, num_pairs
!! Number of elements and pairs.
real(real12) :: radius
!! Average of covalent radii.
logical :: success
!! Success flag.

Expand Down Expand Up @@ -1366,8 +1364,6 @@ subroutine set_bond_radius_to_default(elements)
!! Index of the elements in the element database.
real(real12) :: radius, radius1, radius2
!! Average of covalent radii.
character(256) :: stop_msg
!! Error message.


write(0,*) 'WARNING: No bond data for element pair ', &
Expand Down Expand Up @@ -1444,6 +1440,7 @@ subroutine update_bond_info(this)
!----------------------------------------------------------------------------
! get list of element pairs in dataset
!----------------------------------------------------------------------------
allocate(element_list(0))
element_list = [ this%system(1)%element_symbols ]
do i = 2, size(this%system),1
element_list = [ element_list, this%system(i)%element_symbols ]
Expand Down Expand Up @@ -1896,7 +1893,6 @@ subroutine set_gvector_to_default(this, body, index)
bonds , &
this%nbins(1), eta, this%width(1), &
this%cutoff_min(1), &
( this%cutoff_max(1) - this%cutoff_min(1) ), &
scale_list = [ 1._real12 ] &
)
elseif( body .eq. 3 )then
Expand Down Expand Up @@ -1933,8 +1929,6 @@ subroutine evolve(this, system)
best_energy_pair_old, &
best_energy_per_species_old
!! Old best energies.
real(real12), dimension(:), allocatable :: height
!! Height of the g-vectors.
integer, dimension(:,:), allocatable :: idx_list
!! Index list for the element pairs in a system.
real(real12), dimension(:,:), allocatable :: tmp_df
Expand All @@ -1944,6 +1938,8 @@ subroutine evolve(this, system)
integer, dimension(:), allocatable :: host_idx_list


weight = 1._real12

!---------------------------------------------------------------------------
! if present, add the system to the container
!---------------------------------------------------------------------------
Expand Down Expand Up @@ -2231,9 +2227,9 @@ subroutine evolve(this, system)
this%num_evaluated = this%num_evaluated + num_evaluated

this%viability_3body_default = sum( this%total%df_3body ) / &
size( this%total%df_3body )
real( size( this%total%df_3body ), real12 )
this%viability_4body_default = sum( this%total%df_4body ) / &
size( this%total%df_4body )
real( size( this%total%df_4body ), real12 )

end subroutine evolve
!###############################################################################
Expand Down Expand Up @@ -2279,17 +2275,11 @@ subroutine calculate(this, basis, &
!! Tolerance for the distance between atoms for 3- and 4-body.


!! @note
!! Defaults for distribution function parametsr are randomly chosen for now.
!! @endnote

integer :: bin
!! Bin index and maximum number of steps.
integer :: i, j, b, itmp1, idx
integer :: i, b, itmp1, idx
!! Loop index.
integer :: is, js, ia, ja, ka, la
!! Loop index.
integer :: num_pairs!, num_angles
integer :: num_pairs
!! Number of pairs and angles.
real(real12) :: bondlength
!! Temporary real variables.
Expand All @@ -2299,10 +2289,8 @@ subroutine calculate(this, basis, &
!! Extended basis of the system.
type(extended_basis_type) :: neighbour_basis
!! Basis for storing neighbour data.
real(real12), dimension(3) :: eta, limit
real(real12), dimension(3) :: eta
!! Parameters for the distribution functions.
real(real12), dimension(3) :: vtmp1, vtmp2, vtmp3, diff
!! Temporary real arrays.
real(real12), allocatable, dimension(:) :: angle_list, bondlength_list, &
distance
!! Temporary real arrays.
Expand Down Expand Up @@ -2339,7 +2327,6 @@ subroutine calculate(this, basis, &
else
nbins_ = 1 + nint( (cutoff_max_ - cutoff_min_)/width_ )
end if
limit = cutoff_max_ - cutoff_min_
if(present(radius_distance_tol))then
radius_distance_tol_ = radius_distance_tol
else
Expand Down Expand Up @@ -2555,7 +2542,7 @@ subroutine calculate(this, basis, &
bondlength_list(:itmp1), &
nbins_(1), eta(1), width_(1), &
cutoff_min_(1), &
limit(1), scale_list = distance(:itmp1) &
scale_list = distance(:itmp1) &
)
this%weight_pair(pair_index(is, js)) = &
this%weight_pair(pair_index(is, js)) + &
Expand Down Expand Up @@ -2610,7 +2597,7 @@ subroutine calculate(this, basis, &
this%df_3body(:,is) = this%df_3body(:,is) + &
get_gvector( angle_list, &
nbins_(2), eta(2), width_(2), &
cutoff_min_(2), limit(2), &
cutoff_min_(2), &
scale_list = distance &
)
deallocate( angle_list, distance )
Expand Down Expand Up @@ -2652,7 +2639,7 @@ subroutine calculate(this, basis, &
this%df_4body(:,is) = this%df_4body(:,is) + &
get_gvector( angle_list, &
nbins_(3), eta(3), width_(3), &
cutoff_min_(3), limit(3), &
cutoff_min_(3), &
scale_list = distance &
)
deallocate( angle_list, distance )
Expand Down Expand Up @@ -2691,15 +2678,15 @@ end subroutine calculate


!###############################################################################
function get_gvector(value_list, nbins, eta, width, cutoff_min, limit, &
function get_gvector(value_list, nbins, eta, width, cutoff_min, &
scale_list ) result(gvector)
!! Calculate the angular distribution function for a list of values.
implicit none

! Arguments
integer, intent(in) :: nbins
!! Number of bins for the distribution functions.
real(real12), intent(in) :: eta, width, cutoff_min, limit
real(real12), intent(in) :: eta, width, cutoff_min
!! Parameters for the distribution functions.
real(real12), dimension(:), intent(in) :: value_list
!! List of angles.
Expand Down
2 changes: 1 addition & 1 deletion src/fortran/lib/mod_generator.f90
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ module function generate_structure( &
!! Verbosity level.

! Local variables
integer :: i, j, iplaced, void_ticker
integer :: iplaced, void_ticker
!! Loop counters.
integer :: num_insert_atoms
!! Number of atoms to insert.
Expand Down
11 changes: 6 additions & 5 deletions src/fortran/lib/mod_misc.f90
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ function sort_str_order(list,lcase) result(order)
!! Order of the sorted list.

charlen = len(list(1))
lcase_ = .false.
if(present(lcase))then
if(lcase)then
lcase_ = lcase
Expand All @@ -121,8 +122,6 @@ function sort_str_order(list,lcase) result(order)
list(i) = to_upper(list(i))
end do
end if
else
lcase_ = .false.
end if

allocate(torder(size(list)))
Expand Down Expand Up @@ -216,6 +215,8 @@ subroutine rsort1D(arr1,arr2,reverse)
! Local variables
integer :: i,dim,loc
!! Loop index.
integer :: ibuff
!! Buffer for swapping elements.
real(real12) :: rbuff
!! Buffer for swapping elements.
logical :: reverse_
Expand All @@ -240,9 +241,9 @@ subroutine rsort1D(arr1,arr2,reverse)
arr1(loc) = rbuff

if(present(arr2)) then
rbuff=arr2(i)
arr2(i)=arr2(loc)
arr2(loc)=rbuff
ibuff = arr2(i)
arr2(i) = arr2(loc)
arr2(loc) = ibuff
end if
end do

Expand Down
Loading