init_fragment Subroutine

private subroutine init_fragment(this, id, atoms)

intialize fragment

Arguments

TypeIntentOptionalAttributesName
class(fragment_type), intent(inout) :: this
integer, intent(in) :: id
type(atom_type), intent(in), dimension(:), target:: atoms

Contents

Source Code


Source Code

subroutine init_fragment(this, id, atoms)

    class(fragment_type), intent(inout) :: this
    integer, intent(in) :: id
    type(atom_type), dimension(:), target, intent(in) :: atoms

    integer :: i

    this%id = id
    this%num_atoms = size(atoms)
    this%atoms => atoms

    this%charge = 0.0_dp
    do i = 1, this%num_atoms
        this%charge = this%charge + this%atoms(i)%charge
    end do

end subroutine init_fragment