Skip to content

Commit 380d8c6

Browse files
committed
Only write groups in Turbomole output if necessary
1 parent 3d0e921 commit 380d8c6

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/mctc/io/write/turbomole.f90

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,25 @@ subroutine write_coord(mol, unit)
2828
class(structure_type), intent(in) :: mol
2929
integer, intent(in) :: unit
3030
integer :: iat, ilt, npbc
31+
logical :: expo
3132

3233
write(unit, '(a)') "$coord"
33-
do iat = 1, mol%nat
34-
write(unit, '(3es24.14, 6x, a)') mol%xyz(:, iat), trim(mol%sym(mol%id(iat)))
35-
end do
36-
write(unit, '(a, *(1x, a, "=", i0))') &
37-
"$eht", "charge", nint(mol%charge), "unpaired", mol%uhf
38-
write(unit, '(a, 1x, i0)') "$periodic", count(mol%periodic)
34+
expo = maxval(self%xyz) > 1.0e+5 .or. minval(self%xyz) < -1.0e+5
35+
if (expo) then
36+
do iat = 1, mol%nat
37+
write(unit, '(3es24.14, 6x, a)') mol%xyz(:, iat), trim(mol%sym(mol%id(iat)))
38+
end do
39+
else
40+
do iat = 1, mol%nat
41+
write(unit, '(3f24.14, 6x, a)') mol%xyz(:, iat), trim(mol%sym(mol%id(iat)))
42+
end do
43+
end if
44+
if (any([nint(mol%charge), mol%uhf] /= 0)) then
45+
write(unit, '(a, *(1x, a, "=", i0))') &
46+
"$eht", "charge", nint(mol%charge), "unpaired", mol%uhf
47+
end if
3948
if (any(mol%periodic)) then
49+
write(unit, '(a, 1x, i0)') "$periodic", count(mol%periodic)
4050
npbc = count(mol%periodic)
4151
if (size(mol%lattice, 2) == 3) then
4252
write(unit, '(a)') "$lattice bohr"

0 commit comments

Comments
 (0)