onetep-devel / utils-devel

Utility scripts and other resources for the ONETEP linear-scaling DFT code
4 stars 7 forks source link

Wrong formatting in pdb2dat #4

Closed iliqKichev closed 1 year ago

iliqKichev commented 1 year ago

When there is a planar molecule and the padding option is used, the lattice size in the output file in the planar dimension is set to a large negative number.

Example file: BQ.pdb

HETATM    1  C           0       0.979  -2.064   0.002                       C
HETATM    2  C           0       2.374  -2.064   0.002                       C
HETATM    3  C           0       3.071  -0.856   0.002                       C
HETATM    4  C           0       2.374   0.353   0.000                       C
HETATM    5  C           0       0.979   0.353   0.000                       C
HETATM    6  C           0       0.281  -0.856   0.001                       C
HETATM    7  H           0       0.429  -3.016   0.002                       H
HETATM    8  H           0       4.171  -0.856   0.002                       H
HETATM    9  H           0       2.924   1.305   0.000                       H
HETATM   10  H           0      -0.818  -0.855   0.001                       H
HETATM   11  O           0       0.264   1.591  -0.001                       O
HETATM   12  O           0       3.088  -3.302   0.003                       O
END
CONECT    1    2    6    7
CONECT    2    1    3   12
CONECT    3    2    4    8
CONECT    4    3    5    9
CONECT    5    4    6   11
CONECT    6    1    5   10
CONECT    7    1
CONECT    8    3
CONECT    9    4
CONECT   10    6
CONECT   11    5
CONECT   12    2

Command: BQ.dat pdb2dat -a -m -w -x 9 -y 9 -z 9 BQ.pdb

Output:

! Created by pdb2dat v2.31 from BQ.pdb on Tue Aug 22 04:27:38 PM BST 2023
! 2009.10. Jacek Dziedzic jack.erede@gmail.com

 ! Adjust this manually if your system is not neutral
 charge 0 

 cutoff_energy :  800 eV
 ngwf_threshold_orig : 0.000002
 kernel_cutoff : 1000
 xc_functional PBE
 dispersion 1

 minit_lnv 5 
 maxit_lnv 5 
 maxit_ngwf_cg 40

 output_detail VERBOSE
 do_properties T
 cube_format T
 write_denskern T
 write_tightbox_ngwfs T
 write_density_plot T
 lumo_dens_plot 0
 homo_dens_plot 0

 %block species
 H   H   1 1 8.0
 C   C   6 4 8.0
 O   O   8 4 8.0
 %endblock species

 %block species_pot
 H   H_04.recpot
 C   C_01.recpot
 O   O_02.recpot
 %endblock species_pot

 %block lattice_cart
  43.262   0.000   0.000
   0.000  34.023   0.000
   0.000   0.000 -188936.727
 %endblock lattice_cart

 %block positions_abs
C      19.34701799    17.01320600 -377890.46053692
C      19.34701799    17.01320600 -377890.46053692
C      21.62980738    17.01320600 -377890.46053692
C      23.91448649    17.00942654 -377890.46053692
C      23.91448649    17.00942654 -377890.46053692
C      21.62980738    17.01131627 -377890.46053692
H      17.54799854    17.01320600 -377890.46053692
H      21.62980738    17.01320600 -377890.46053692
H      25.71350594    17.00942654 -377890.46053692
H      21.63169710    17.01131627 -377890.46053692
O      26.25396767    17.00753682 -377890.46053692
O      17.00753682    17.01509572 -377890.46053692
 %endblock positions_abs
! Created by pdb2dat v2.31 from BQ.pdb on Tue Aug 22 04:27:38 PM BST 2023
! 2009.10. Jacek Dziedzic jack.erede@gmail.com

 ! Adjust this manually if your system is not neutral
 charge 0 

 cutoff_energy :  800 eV
 ngwf_threshold_orig : 0.000002
 kernel_cutoff : 1000
 xc_functional PBE
 dispersion 1

 minit_lnv 5 
 maxit_lnv 5 
 maxit_ngwf_cg 40

 output_detail VERBOSE
 do_properties T
 cube_format T
 write_denskern T
 write_tightbox_ngwfs T
 write_density_plot T
 lumo_dens_plot 0
 homo_dens_plot 0

 %block species
 H   H   1 1 8.0
 C   C   6 4 8.0
 O   O   8 4 8.0
 %endblock species

 %block species_pot
 H   H_04.recpot
 C   C_01.recpot
 O   O_02.recpot
 %endblock species_pot

 %block lattice_cart
  43.262   0.000   0.000
   0.000  34.023   0.000
   0.000   0.000 -188936.727
 %endblock lattice_cart

 %block positions_abs
C      19.34701799    17.01320600 -377890.46053692
C      19.34701799    17.01320600 -377890.46053692
C      21.62980738    17.01320600 -377890.46053692
C      23.91448649    17.00942654 -377890.46053692
C      23.91448649    17.00942654 -377890.46053692
C      21.62980738    17.01131627 -377890.46053692
H      17.54799854    17.01320600 -377890.46053692
H      21.62980738    17.01320600 -377890.46053692
H      25.71350594    17.00942654 -377890.46053692
H      21.63169710    17.01131627 -377890.46053692
O      26.25396767    17.00753682 -377890.46053692
O      17.00753682    17.01509572 -377890.46053692
 %endblock positions_abs
JacekDziedzic commented 1 year ago

I don't think this is a problem with pdb2dat. Your .pdb file is formatted differently from what it normally expects. If you run pdb2dat without any options, it tells you it will look from the coordinates starting from column 6. In your .pdb file they coordinates start in column 5 -- because you don't have the residue name column in your file.

To fix the problem just pass -f 5 -- it will ask the script to start looking for coordinates in column 5 rather than the default 6.