Constructor for structure representations
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(structure_type), | intent(out) | :: | self |
Instance of the structure representation |
||
integer, | intent(in) | :: | num(:) |
Atomic numbers |
||
character(len=*), | intent(in) | :: | sym(:) |
Element symbols |
||
real(kind=wp), | intent(in) | :: | xyz(:,:) |
Cartesian coordinates |
||
real(kind=wp), | intent(in), | optional | :: | charge |
Total charge |
|
integer, | intent(in), | optional | :: | uhf |
Number of unpaired electrons |
|
real(kind=wp), | intent(in), | optional | :: | lattice(:,:) |
Lattice parameters |
|
logical, | intent(in), | optional | :: | periodic(:) |
Periodic directions |
|
type(structure_info), | intent(in), | optional | :: | info |
Vendor specific structure information |
|
integer, | intent(in), | optional | :: | bond(:,:) |
Bond topology of the system |
subroutine new_structure(self, num, sym, xyz, charge, uhf, lattice, periodic, & & info, bond) !> Instance of the structure representation type(structure_type), intent(out) :: self !> Atomic numbers integer, intent(in) :: num(:) !> Element symbols character(len=*), intent(in) :: sym(:) !> Cartesian coordinates real(wp), intent(in) :: xyz(:, :) !> Total charge real(wp), intent(in), optional :: charge !> Number of unpaired electrons integer, intent(in), optional :: uhf !> Lattice parameters real(wp), intent(in), optional :: lattice(:, :) !> Periodic directions logical, intent(in), optional :: periodic(:) !> Vendor specific structure information type(structure_info), intent(in), optional :: info !> Bond topology of the system integer, intent(in), optional :: bond(:, :) integer :: ndim, iid integer, allocatable :: map(:) ndim = min(size(num, 1), size(xyz, 2), size(sym, 1)) self%nat = ndim allocate(self%id(ndim)) allocate(self%xyz(3, ndim)) if (present(lattice)) then self%lattice = lattice else allocate(self%lattice(0, 0)) end if if (present(periodic)) then self%periodic = periodic else if (present(lattice)) then allocate(self%periodic(3)) self%periodic(:) = .true. else allocate(self%periodic(1)) self%periodic(:) = .false. end if end if call get_identity(self%nid, self%id, sym) allocate(map(self%nid)) call collect_identical(self%id, map) allocate(self%num(self%nid)) allocate(self%sym(self%nid)) do iid = 1, self%nid self%num(iid) = num(map(iid)) self%sym(iid) = sym(map(iid)) end do self%xyz(:, :) = xyz(:, :ndim) if (present(charge)) then self%charge = charge else self%charge = 0.0_wp end if if (present(uhf)) then self%uhf = uhf else self%uhf = 0 end if if (present(info)) then self%info = info else self%info = structure_info() end if if (present(bond)) then self%nbd = size(bond, 2) self%bond = bond end if end subroutine new_structure