Skip to content

Commit

Permalink
Fix manual override of charge for pdb files. (#881)
Browse files Browse the repository at this point in the history
* Fix manual override of charge for pdb files.

Signed-off-by: MtoLStoN <70513124+MtoLStoN@users.noreply.github.com>
  • Loading branch information
MtoLStoN authored Oct 4, 2023
1 parent b15c487 commit d140d40
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/gfnff/gfnff_ini.f90
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ integer function itabrow6(i)
write(env%unit,*) 'dEes :',dum1-dum2
write(env%unit,*) 'charge 1/2:',topo%qfrag(1:2)
endif
else if (allocated(mol%pdb)) then ! frag_charges_known
else if (allocated(mol%pdb).and.qloop_count.eq.0) then ! frag_charges_known
write(env%unit,'(10x,"#fragments for EEQ constrain from pdb file: ",i0)') topo%nfrag
frag_charges_known=.true.
endif
Expand Down
7 changes: 5 additions & 2 deletions src/gfnff/gfnff_setup.f90
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module xtb_gfnff_setup
use xtb_gfnff_topology, only : TGFFTopology
use xtb_gfnff_generator, only : TGFFGenerator
implicit none
character(len=*), parameter :: source = 'gfnff_setup'
private
public :: gfnff_setup, gfnff_input

Expand All @@ -33,7 +34,6 @@ subroutine gfnff_setup(env,verbose,restart,mol,gen,param,topo,accuracy,version)
use xtb_gfnff_param, only : ini, gfnff_set_param
use xtb_setparam, only : set
implicit none
character(len=*), parameter :: source = 'gfnff_setup'
! Dummy
!integer,intent(in) :: ich
type(TGFFTopology), intent(inout) :: topo
Expand Down Expand Up @@ -148,8 +148,11 @@ subroutine gfnff_input(env, mol, topo)
write(env%unit,'(10x,"charge from pdb residues: ",i0)') &
& nint(sum(topo%qfrag(1:topo%nfrag)))
else
! ignore fragment charges if they are not consistent with the total charge
call env%warning("Fragment charges from PDB file are not consistent with the total charge (is this a manual override?)", source)
if (allocated(topo%qpdb)) deallocate(topo%qpdb)
topo%qfrag(1:topo%nfrag) = 0.0_wp
topo%qfrag(1) = mol%chrg
topo%qfrag(2:topo%nfrag) = 0.0_wp
topo%nfrag = 0
end if
!--------------------------------------------------------------------
Expand Down

0 comments on commit d140d40

Please sign in to comment.