Page 371 - Handbook Of Multiphase Flow Assurance
P. 371
370 10. Research methods in flow assurance
c=c+atomdata(i,4)
if (iatomtype(i,1).eq.3) no=no+1
end do
C if charge is not exactly zero, redistribute the difference
C between all atoms and subtract the computational error from the last atom
if(abs(c).gt.1.D0) print *,' WARNING: Non-zero Total Charge'
if(c.ne.0.D0) then
delc=c/natom
c=0.D0
do i=1,natom
atomdata(i,4)=atomdata(i,4)−delc
c=c+atomdata(i,4)
end do
atomdata(natom,4)=atomdata(natom,4)−c
endif
write(*,10)no
10 Format(' Number of oxygen atoms=',I4)
print *,'Please enter the number of monomers in chain'
read (*,*)ngroups
C arrange data on atom connectivity
do i=1,natom
nbonds(i)=0
nrawatom=irawatom(i)
do j=1,nbondfound
if (irawbond(j,1).eq.nrawatom) then
nbonds(i)=nbonds(i)+1
c see what is the atom number on the other end of bond
do ii=1,natom
if(irawatom(ii).eq.irawbond(j,2))n2atom=ii
end do
ibonddata(i,nbonds(i))=n2atom
endif
if (irawbond(j,2).eq.nrawatom) then
nbonds(i)=nbonds(i)+1
c see what is the atom number on the other end of bond
do ii=1,natom
if(irawatom(ii).eq.irawbond(j,1))n2atom=ii
end do
ibonddata(i,nbonds(i))=n2atom
endif
end do
end do

