17 integer,
parameter ::
dp = kind(1.0d0)
33 integer,
allocatable :: hindex(:,:)
36 type(bml_matrix_t) :: ham
39 type(bml_matrix_t) :: hamaux
42 type(bml_matrix_t) :: ham0
45 type(bml_matrix_t) :: oham
48 type(bml_matrix_t) :: ohamaux
51 type(bml_matrix_t) :: over
54 type(bml_matrix_t) :: rho
57 type(bml_matrix_t) :: orho
60 type(bml_matrix_t) :: zmat
63 type(bml_matrix_t) :: evects
66 type(bml_matrix_t) :: mat
69 type(bml_matrix_t) :: mataux
72 real(
dp),
allocatable :: coul_pot_r(:)
75 real(
dp),
allocatable :: coul_pot_k(:)
78 real(
dp),
allocatable :: skforce(:,:)
81 real(
dp),
allocatable :: fpul(:,:)
84 real(
dp),
allocatable :: fscoul(:,:)
87 real(
dp),
allocatable :: aux(:,:)
90 real(
dp),
allocatable :: evals(:)
93 real(
dp),
allocatable :: dvals(:)
96 real(
dp),
allocatable :: ker(:,:)
99 integer :: norbsincore
118 character(2),
allocatable :: symbol(:)
121 integer,
allocatable :: atomic_number(:)
126 real(
dp),
allocatable :: coordinate(:,:)
131 real(
dp),
allocatable :: velocity(:,:)
136 real(
dp),
allocatable :: force(:,:)
141 real(
dp),
allocatable :: net_charge(:)
148 real(
dp),
allocatable :: mass(:)
158 real(
dp),
allocatable :: lattice_vector(:,:)
166 real(
dp),
allocatable :: recip_vector(:,:)
189 integer,
allocatable :: spindex(:)
197 character(2),
allocatable :: splist(:)
204 integer,
allocatable :: spatnum(:)
210 real(
dp),
allocatable :: spmass(:)
213 real(
dp),
allocatable :: userdef(:)
216 integer,
allocatable :: resindex(:)
219 character(3),
allocatable :: resname(:)
222 character(3),
allocatable :: atomname(:)
246 character(len=*),
intent(in) :: fullfilename
247 character(50),
intent(inout) :: filename
248 character(3),
intent(inout) :: ext
249 character(1),
allocatable :: tempc(:)
250 character(len=30) :: tempcflex
253 lenc=len(adjustl(trim(fullfilename)))
254 if(.not.
allocated(tempc))
allocate(tempc(lenc))
255 tempcflex = adjustl(trim(fullfilename))
256 filename = adjustl(trim(tempcflex(1:lenc-4)))
257 ext = adjustl(trim(tempcflex(lenc-2:lenc+1)))
269 character(1) :: onechar
270 character(10) :: dummyc(10)
271 character(2) :: possiblenewsymbol, twochar
272 character(2),
allocatable :: sptempsymbols(:)
273 character(3),
optional,
intent(in) :: extin
274 character(3) :: extension
275 character(30) :: dummy
276 character(50) :: io_name, nametmp
277 character(60) :: pdbformat
278 character(len=*) :: filename
279 integer :: dummyi(10), header_lines, i, io_unit
280 integer :: ios, itemp, j, lines_to_lattice
281 integer :: max_lines, nats, nsp, verbose
282 integer :: lines_to_masses, lines_to_atom
284 real(
dp) :: abc_angles(2,3), dummyr(10), lbx1
285 real(
dp) :: lbx2, lby1, lby2, lbz1
286 real(
dp) :: lbz2, max_x, max_y, max_z
287 real(
dp) :: min_x, min_y, min_z, scfactor
293 max_x = 0.0_dp; max_y = 0.0_dp; max_z = 0.0_dp;
294 min_x = 0.0_dp; min_y = 0.0_dp; min_z = 0.0_dp;
296 if(
allocated(system%symbol)) stop
"ERROR: System already allocated"
298 if(.not.
present(extin))
then
302 nametmp = trim(adjustl(filename))
305 select case(extension)
310 io_name=trim(adjustl(nametmp))//
".xyz"
315 allocate(system%symbol(nats))
316 allocate(system%atomic_number(nats))
317 allocate(system%coordinate(3,nats))
318 allocate(system%mass(nats))
319 allocate(system%lattice_vector(3,3))
321 system%lattice_vector = 0.0_dp
324 read(io_unit,*)system%symbol(i),system%coordinate(1,i),system%coordinate(2,i),system%coordinate(3,i)
327 max_x = max(max_x,system%coordinate(1,i))
328 min_x = min(min_x,system%coordinate(1,i))
329 max_y = max(max_y,system%coordinate(2,i))
330 min_y = min(min_y,system%coordinate(2,i))
331 max_z = max(max_z,system%coordinate(3,i))
332 min_z = min(min_z,system%coordinate(3,i))
338 read(io_unit,*,iostat=ios)dummy
339 if(dummy.eq.
"#lattice")
then
340 if(verbose.eq.1)
write(*,*)
"There is a lattice ..."
341 read(io_unit,*)system%lattice_vector(1,1),system%lattice_vector(1,2),system%lattice_vector(1,3)
342 read(io_unit,*)system%lattice_vector(2,1),system%lattice_vector(2,2),system%lattice_vector(2,3)
343 read(io_unit,*)system%lattice_vector(3,1),system%lattice_vector(3,2),system%lattice_vector(3,3)
347 system%lattice_vector = 0.0_dp
348 system%lattice_vector(1,1) = max_x - min_x + 10.0_dp
349 system%lattice_vector(2,2) = max_y - min_y + 10.0_dp
350 system%lattice_vector(3,3) = max_z - min_z + 10.0_dp
358 io_name=trim(adjustl(nametmp))//
".pdb"
367 if(dummy.eq.
"ATOM".or.dummy.eq.
"HETATM")
then
370 header_lines = header_lines + 1
371 if(dummy.eq.
"CRYST1")
then
372 lines_to_lattice = header_lines
381 if(dummy.eq.
"ATOM".or.dummy.eq.
"HETATM")
then
391 if(i.eq.lines_to_lattice)
then
392 read(io_unit,*)dummy,abc_angles(1,1),abc_angles(1,2),abc_angles(1,3)&
393 ,abc_angles(2,1),abc_angles(2,2),abc_angles(2,3)
400 allocate(system%symbol(nats))
401 allocate(system%atomic_number(nats))
402 allocate(system%coordinate(3,nats))
403 allocate(system%mass(nats))
404 allocate(system%lattice_vector(3,3))
405 allocate(system%resname(nats))
406 allocate(system%resindex(nats))
407 allocate(system%atomname(nats))
409 system%lattice_vector = 0.0_dp
411 pdbformat=
'(A6,I5,1X,A4,A1,A3,1X,A1,I4,A1,3X,3F8.3,2F6.2,10X,A2,A2)'
414 read(io_unit,pdbformat)dummyc(1),dummyi(1), &
415 system%atomname(i),dummyc(3),system%resname(i),dummyc(4),system%resindex(i),dummyc(5),&
416 system%coordinate(1,i),system%coordinate(2,i),system%coordinate(3,i),&
417 dummyr(1),dummyr(2),system%symbol(i),dummyc(10)
420 if(dummyc(4).ne.
"".and.system%symbol(i).eq.
"")
then
421 onechar=adjustl(trim(dummyc(4)))
422 if(onechar.ne.
"H".and. &
423 onechar.ne.
"B".and. &
424 onechar.ne.
"C".and. &
425 onechar.ne.
"N".and. &
426 onechar.ne.
"O".and. &
427 onechar.ne.
"F".and. &
428 onechar.ne.
"P".and. &
429 onechar.ne.
"S".and. &
431 twochar=adjustl(trim(dummyc(4)))
432 system%symbol(i)=twochar
434 system%symbol(i)=onechar
446 max_x = max(max_x,system%coordinate(1,i))
447 min_x = min(min_x,system%coordinate(1,i))
448 max_y = max(max_y,system%coordinate(2,i))
449 min_y = min(min_y,system%coordinate(2,i))
450 max_z = max(max_z,system%coordinate(3,i))
451 min_z = min(min_z,system%coordinate(3,i))
460 system%lattice_vector = 0.0_dp
461 system%lattice_vector(1,1) = max_x - min_x + 10.0_dp
462 system%lattice_vector(2,2) = max_y - min_y + 10.0_dp
463 system%lattice_vector(3,3) = max_z - min_z + 10.0_dp
471 io_name=trim(adjustl(nametmp))//
".ltt"
473 read(io_unit,*)dummy, nats
474 read(io_unit,*)scfactor
476 allocate(system%symbol(nats))
477 allocate(system%atomic_number(nats))
478 allocate(system%coordinate(3,nats))
479 allocate(system%mass(nats))
480 allocate(system%lattice_vector(3,3))
483 read(io_unit,*)lbx1,lbx2,lby1,lby2,lbz1,lbz2
484 system%lattice_vector = 0.0_dp
485 system%lattice_vector(1,1) = (lbx2-lbx1)*scfactor
486 system%lattice_vector(2,2) = (lby2-lby1)*scfactor
487 system%lattice_vector(3,3) = (lbz2-lbz1)*scfactor
490 read(io_unit,*)system%symbol(i),system%coordinate(1,i)&
491 ,system%coordinate(2,i),system%coordinate(3,i)
492 system%coordinate(1,i)= system%coordinate(1,i)*scfactor
493 system%coordinate(2,i)= system%coordinate(2,i)*scfactor
494 system%coordinate(3,i)= system%coordinate(3,i)*scfactor
504 io_name=trim(adjustl(nametmp))//
".dat"
508 allocate(system%symbol(nats))
509 allocate(system%atomic_number(nats))
510 allocate(system%coordinate(3,nats))
511 allocate(system%mass(nats))
512 allocate(system%lattice_vector(3,3))
515 system%lattice_vector = 0.0_dp
516 read(io_unit,*)system%lattice_vector(1,1),system%lattice_vector(1,2),system%lattice_vector(1,3)
517 read(io_unit,*)system%lattice_vector(2,1),system%lattice_vector(2,2),system%lattice_vector(2,3)
518 read(io_unit,*)system%lattice_vector(3,1),system%lattice_vector(3,2),system%lattice_vector(3,3)
521 read(io_unit,*)system%symbol(i),system%coordinate(1,i)&
522 ,system%coordinate(2,i),system%coordinate(3,i)
523 system%coordinate(1,i)= system%coordinate(1,i)
524 system%coordinate(2,i)= system%coordinate(2,i)
525 system%coordinate(3,i)= system%coordinate(3,i)
534 stop
"gen format is not implemented for reading yet"
540 io_name=adjustl(trim(nametmp))//
".lmp"
542 read(io_unit,*)dummyc(1)
543 read(io_unit,*)system%nats
546 read(io_unit,*)dummyc(1),dummyc(2)
548 if(adjustl(trim(dummyc(2))) ==
"atom")
then
549 lines_to_atom = i + 2
551 if(adjustl(trim(dummyc(1))) ==
"Masses")
then
552 lines_to_masses = i + 2
560 do i=1,lines_to_atom-1
561 read(io_unit,*)dummyc(1)
564 read(io_unit,*)system%nsp
566 do i=1,lines_to_masses - lines_to_atom - 4
567 read(io_unit,*)dummyc(1)
570 read(io_unit,*)min_x, max_x
571 read(io_unit,*)min_y, max_y
572 read(io_unit,*)min_z, max_z
574 allocate(system%lattice_vector(3,3))
575 system%lattice_vector = 0.0_dp
576 system%lattice_vector(1,1) = max_x - min_x
577 system%lattice_vector(2,2) = max_y - min_y
578 system%lattice_vector(3,3) = max_z - min_z
580 read(io_unit,*)dummyc(1)
582 allocate(system%spmass(system%nsp))
583 allocate(system%splist(system%nsp))
586 read(io_unit,*)dummyi(1),system%spmass(i)
599 read(io_unit,*)dummyc(1)
600 if(dummyc(1) ==
"Atoms")
exit
603 allocate(system%spindex(system%nats))
604 allocate(system%coordinate(3,system%nats))
605 allocate(system%symbol(system%nats))
608 read(io_unit,*)dummyi(1),dummyi(2),system%spindex(i),dummyr(1),system%coordinate(1,i)&
609 ,system%coordinate(2,i),system%coordinate(3,i)
610 write(*,*)dummyi(1),dummyi(2),system%spindex(i),dummyr(1),system%coordinate(1,i)&
611 ,system%coordinate(2,i),system%coordinate(3,i)
612 system%symbol(i) = system%splist(system%spindex(i))
619 stop
"The file extension is not valid. Only xyz, lmp, dat and pdb formats are implemented"
626 allocate(sptempsymbols(150))
627 sptempsymbols(1)=system%Symbol(1)
629 if(.not.
allocated(system%spindex))
allocate(system%spindex(nats))
634 if(trim(system%symbol(i)).ne.trim(sptempsymbols(j)))
then
636 possiblenewsymbol = system%symbol(i)
641 sptempsymbols(nsp)=possiblenewsymbol
645 if(
allocated(system%splist))
deallocate(system%splist)
646 if(
allocated(system%spmass))
deallocate(system%spmass)
648 allocate(system%splist(nsp))
649 allocate(system%spmass(nsp))
650 allocate(system%spatnum(nsp))
653 system%splist(i) = sptempsymbols(i)
658 deallocate(sptempsymbols)
665 if(trim(system%symbol(i)).eq.trim(system%splist(j)))
then
681 if(
allocated(sy%symbol))
deallocate(sy%symbol)
682 if(
allocated(sy%atomic_number))
deallocate(sy%atomic_number)
683 if(
allocated(sy%coordinate))
deallocate(sy%coordinate)
684 if(
allocated(sy%velocity))
deallocate(sy%velocity)
685 if(
allocated(sy%force))
deallocate(sy%force)
686 if(
allocated(sy%net_charge))
deallocate(sy%net_charge)
687 if(
allocated(sy%mass))
deallocate(sy%mass)
688 if(
allocated(sy%lattice_vector))
deallocate(sy%lattice_vector)
689 if(
allocated(sy%recip_vector))
deallocate(sy%recip_vector)
690 if(
allocated(sy%spindex))
deallocate(sy%spindex)
691 if(
allocated(sy%splist))
deallocate(sy%splist)
692 if(
allocated(sy%spatnum))
deallocate(sy%spatnum)
693 if(
allocated(sy%spmass))
deallocate(sy%spmass)
694 if(
allocated(sy%userdef))
deallocate(sy%userdef)
695 if(
allocated(sy%resindex))
deallocate(sy%resindex)
696 if(
allocated(sy%resname))
deallocate(sy%resname)
697 if(
allocated(sy%atomname))
deallocate(sy%atomname)
708 if(
allocated(estr%hindex))
deallocate(estr%hindex)
709 if(bml_allocated(estr%ham))
call bml_deallocate(estr%ham)
710 if(bml_allocated(estr%hamAux))
call bml_deallocate(estr%hamAux)
711 if(bml_allocated(estr%ham0))
call bml_deallocate(estr%ham0)
712 if(bml_allocated(estr%oham))
call bml_deallocate(estr%oham)
713 if(bml_allocated(estr%ohamAux))
call bml_deallocate(estr%ohamAux)
714 if(bml_allocated(estr%over))
call bml_deallocate(estr%over)
715 if(bml_allocated(estr%rho))
call bml_deallocate(estr%rho)
716 if(bml_allocated(estr%evects))
call bml_deallocate(estr%evects)
717 if(bml_allocated(estr%matAux))
call bml_deallocate(estr%matAux)
718 if(bml_allocated(estr%zmat))
call bml_deallocate(estr%zmat)
719 if(
allocated(estr%coul_pot_r))
deallocate(estr%coul_pot_r)
720 if(
allocated(estr%coul_pot_k))
deallocate(estr%coul_pot_k)
721 if(
allocated(estr%skforce))
deallocate(estr%skforce)
722 if(
allocated(estr%fpul))
deallocate(estr%fpul)
723 if(
allocated(estr%fscoul))
deallocate(estr%fscoul)
724 if(
allocated(estr%aux))
deallocate(estr%aux)
725 if(
allocated(estr%evals))
deallocate(estr%evals)
726 if(
allocated(estr%dvals))
deallocate(estr%dvals)
727 if(
allocated(estr%ker))
deallocate(estr%ker)
739 character(len=*) :: filename
740 character(10) :: dummyc(10)
741 character(34) :: xyzformat
742 character(3),
optional,
intent(in) :: extin
743 character(3) :: extension
744 character(50) :: io_name, nametmp
745 character(60) :: pdbformat
746 character(100) :: io_message
747 integer :: dummyi(10), i, io_unit, nats
748 real(
dp) :: abc_angles(2,3), dummyr(10), origin(3)
753 if(.not.
present(extin))
then
757 nametmp = trim(filename)
760 select case(extension)
764 io_name=trim(nametmp)//
".xyz"
767 io_message = trim(adjustl(io_name))//
" Generated by the PROGRESS library"
768 write(io_unit,*)trim(adjustl(io_message))
769 xyzformat =
'(A2,A2,1F10.5,A2,1F10.5,A2,1F10.5)'
771 write(io_unit,xyzformat)system%symbol(i),
" ",system%coordinate(1,i),
" ",system%coordinate(2,i),
" ",system%coordinate(3,i)
776 write(io_unit,*)
"#lattice vectors"
777 write(io_unit,
"(3F20.5)")system%lattice_vector(1,1),system%lattice_vector(1,2),system%lattice_vector(1,3)
778 write(io_unit,
"(3F20.5)")system%lattice_vector(2,1),system%lattice_vector(2,2),system%lattice_vector(2,3)
779 write(io_unit,
"(3F20.5)")system%lattice_vector(3,1),system%lattice_vector(3,2),system%lattice_vector(3,3)
790 io_name=trim(nametmp)//
".pdb"
793 write(io_unit,
'(A6,1X,A50)')
"REMARK",
"Generated by PROGRESS library"
794 write(io_unit,
'(A5,1X,A20)')
"TITLE",io_name
796 if(
allocated(system%lattice_vector))
then
798 write(io_unit,
'(A6,3F9.3,3F7.2,A16)')
"CRYST1",abc_angles(1,1),abc_angles(1,2),abc_angles(1,3)&
799 ,abc_angles(2,1),abc_angles(2,2),abc_angles(2,3),
" P 1 1"
802 write(io_unit,
'(A5,A20)')
"MODEL",
" 1"
804 pdbformat=
'(A4,A2,I5,1X,A4,A1,A3,1X,A1,I4,A1,3X,3F8.3,2F6.2,10X,A2,A2 )'
806 if(.not.
allocated(system%resindex))
then
807 allocate(system%resindex(nats))
811 if(.not.
allocated(system%resname))
then
812 allocate(system%resname(nats))
813 system%resname =
"MOL"
816 if(.not.
allocated(system%atomname))
then
817 allocate(system%atomname(nats))
818 system%atomname = system%symbol
821 if(
allocated(system%net_charge))
then
823 write(io_unit,pdbformat)dummyc(1),dummyc(2),i, &
824 system%atomname(i),dummyc(5),system%resname(i),dummyc(7),system%resindex(i),dummyc(8),&
825 system%coordinate(1,i),system%coordinate(2,i),system%coordinate(3,i),&
826 dummyr(1),system%net_charge(i),system%symbol(i),dummyc(10)
830 write(io_unit,pdbformat)dummyc(1),dummyc(2),i, &
831 system%atomname(i),dummyc(5),system%resname(i),dummyc(7),system%resindex(i),dummyc(8),&
832 system%coordinate(1,i),system%coordinate(2,i),system%coordinate(3,i),&
833 dummyr(1),dummyr(2),system%symbol(i),dummyc(10)
837 write(io_unit,
'(A3)')
"TER"
838 write(io_unit,
'(A3)')
"ENDMDL"
845 io_name=trim(nametmp)//
".ltt"
847 write(io_unit,*)
"NATS= ", system%nats
850 write(io_unit,*)
"1.0",
" Generated by the PROGRESS library"
853 write(io_unit,
"(6F10.5)")0.0,system%lattice_vector(1,1),0.0,system%lattice_vector(2,2)&
854 ,0.0,system%lattice_vector(3,3)
857 write(io_unit,
"(A2,3F10.5)")system%symbol(i),system%coordinate(1,i)&
858 ,system%coordinate(2,i),system%coordinate(3,i)
866 io_name=trim(nametmp)//
".dat"
868 write(io_unit,*)system%nats
871 write(io_unit,
"(3F10.5)")system%lattice_vector(1,1),system%lattice_vector(1,2),system%lattice_vector(1,3)
872 write(io_unit,
"(3F10.5)")system%lattice_vector(2,1),system%lattice_vector(2,2),system%lattice_vector(2,3)
873 write(io_unit,
"(3F10.5)")system%lattice_vector(3,1),system%lattice_vector(3,2),system%lattice_vector(3,3)
876 write(io_unit,
"(A2,3F10.5)")system%symbol(i),system%coordinate(1,i)&
877 ,system%coordinate(2,i),system%coordinate(3,i)
885 io_name=trim(nametmp)//
".gen"
887 write(io_unit,*)system%nats,
"S"
888 write(io_unit,
'(103A3)')(system%splist(i),i=1,system%nsp)
890 write(io_unit,
"(I10,I10,3F10.5)")i,system%spindex(i),system%coordinate(1,i)&
891 ,system%coordinate(2,i),system%coordinate(3,i)
893 write(io_unit,*)
"0.0 0.0 0.0"
894 write(io_unit,
'(3F10.5)')system%lattice_vector(1,1),system%lattice_vector(1,2),system%lattice_vector(1,3)
895 write(io_unit,
'(3F10.5)')system%lattice_vector(2,1),system%lattice_vector(2,2),system%lattice_vector(2,3)
896 write(io_unit,
'(3F10.5)')system%lattice_vector(3,1),system%lattice_vector(3,2),system%lattice_vector(3,3)
904 io_name= adjustl(trim(nametmp))//
".lmp"
906 write(io_unit,*)
"LAMMPS Description"
908 write(io_unit,*)system%nats,
"atoms"
910 write(io_unit,*)system%nsp,
"atom types"
912 write(io_unit,*)0.0_dp,system%lattice_vector(1,1),
"xlo xhi"
913 write(io_unit,*)0.0_dp,system%lattice_vector(2,2),
"ylo yhi"
914 write(io_unit,*)0.0_dp,system%lattice_vector(3,3),
"zlo zhi"
915 write(io_unit,*)system%lattice_vector(2,1),system%lattice_vector(3,1), &
916 &system%lattice_vector(3,2),
"xy xz yz"
919 write(io_unit,*)
"Masses"
922 write(io_unit,*)
" ",i,system%spmass(i)
925 write(io_unit,*)
"Atoms"
928 write(io_unit,
'(3I5,A6,3F10.5)')i,1,system%spindex(i),
" 0.0",system%coordinate(1,i)&
929 ,system%coordinate(2,i),system%coordinate(3,i)
936 stop
"The file extension is not valid. Only xyz, dat, lmp, pdb or gen formats are implemented"
951 character(len=*) :: filename
952 character(10) :: dummyc(10)
953 character(11) :: xyzformat
954 character(20) :: io_name
955 character(3) :: extension
956 character(60) :: pdbformat
957 integer :: dummyi(10), i, io_unit, nats
958 integer,
intent(in) :: iter, each
959 integer,
allocatable :: resindex(:)
960 real(
dp) :: abc_angles(2,3), dummyr(10)
961 real(
dp),
intent(in) :: prg_deltat
964 if(mod(iter,each).eq.0.or.iter.eq.0.or.iter.eq.1)
then
967 select case(extension)
971 io_name=trim(filename)//
".xyz"
974 if(iter.eq.0.or.iter.eq.1)
then
975 open(unit=io_unit,file=io_name,status=
'unknown')
977 open(unit=io_unit,file=io_name,position =
'append',status=
'old')
980 write(io_unit,*)system%nats
981 write(io_unit,*)
"frame", iter
982 if(
allocated(system%net_charge))
then
984 write(io_unit,*)system%symbol(i),system%coordinate(1,i),system%coordinate(2,i),system%coordinate(3,i),&
989 write(io_unit,*)system%symbol(i),system%coordinate(1,i),system%coordinate(2,i),system%coordinate(3,i)
1004 io_name=trim(filename)//
".pdb"
1007 if(iter.eq.0.or.iter.eq.1)
then
1008 open(unit=io_unit,file=io_name,status=
'unknown')
1010 open(unit=io_unit,file=io_name,position =
'append',status=
'old')
1013 write(io_unit,
'(A17,A4,F10.5)')
"REMARK Trajectory",
" t=",iter*prg_deltat
1014 write(io_unit,
'(A31)')
"REMARK THIS IS A SIMULATION BOX"
1015 write(io_unit,
'(A6,3F9.3,3F7.2,A16)')
"CRYST1",abc_angles(1,1),abc_angles(1,2),abc_angles(1,3)&
1016 ,abc_angles(2,1),abc_angles(2,2),abc_angles(2,3),
" P 1 1"
1017 write(io_unit,
'(A5,I6)')
"MODEL",iter
1019 pdbformat=
'(A4,A2,I5,1X,A4,A1,A3,1X,A1,I4,A1,3X,3F8.3,2F6.2,10X,A2,A2 )'
1021 if(.not.
allocated(system%resindex))
then
1022 allocate(resindex(nats))
1025 resindex = system%resindex
1029 if(
allocated(system%net_charge))
then
1031 write(io_unit,pdbformat)dummyc(1),dummyc(2),i, &
1032 system%symbol(i),dummyc(5),
"MOL",dummyc(7),resindex(i),dummyc(8),&
1033 system%coordinate(1,i),system%coordinate(2,i),system%coordinate(3,i),&
1034 dummyr(1),system%net_charge(i),system%symbol(i),dummyc(10)
1038 write(io_unit,pdbformat)dummyc(1),dummyc(2),i, &
1039 system%symbol(i),dummyc(5),
"MOL",dummyc(7),resindex(i),dummyc(8),&
1040 system%coordinate(1,i),system%coordinate(2,i),system%coordinate(3,i),&
1041 dummyr(1),dummyr(2),system%symbol(i),dummyc(10)
1045 write(io_unit,
'(A3)')
"TER"
1046 write(io_unit,
'(A6)')
"ENDMDL"
1051 write(*,*)
"write traj not implemented for dat "
1055 stop
"The file extension is not valid. Only pdb and xyz formats are implemented"
1074 character(len=*) :: filename
1075 character(10) :: dummyc(10)
1076 character(11) :: xyzformat
1077 character(20) :: io_name
1078 character(3) :: extension
1079 character(60) :: pdbformat
1080 integer :: dummyi(10), i, io_unit, nats
1081 integer,
intent(in) :: iter, each
1082 integer,
allocatable :: resindex(:)
1083 real(
dp) :: abc_angles(2,3), dummyr(10)
1084 real(
dp) :: maxprop, minprop, realtmp
1085 real(
dp),
intent(in) :: prg_deltat, scalarprop(:)
1092 if(mod(iter,each).eq.0.or.iter.eq.0.or.iter.eq.1)
then
1095 select case(extension)
1106 io_name=trim(filename)//
".pdb"
1109 if(iter.eq.0.or.iter.eq.1)
then
1110 open(unit=io_unit,file=io_name,status=
'unknown')
1112 open(unit=io_unit,file=io_name,position =
'append',status=
'old')
1115 write(io_unit,
'(A8,A4,F10.5)')
"Trajectory",
" t=",iter*prg_deltat
1116 write(io_unit,
'(A24)')
"THIS IS A SIMULATION BOX"
1117 write(io_unit,
'(A6,3F9.3,3F7.2,A16)')
"CRYST1",abc_angles(1,1),abc_angles(1,2),abc_angles(1,3)&
1118 ,abc_angles(2,1),abc_angles(2,2),abc_angles(2,3),
" P 1 1"
1119 write(io_unit,
'(A5,I6)')
"MODEL",iter
1121 pdbformat=
'(A4,A2,I5,1X,A4,A1,A3,1X,A1,I4,A1,3X,3F8.3,2F6.2,10X,A2,A2 )'
1123 if(.not.
allocated(system%resindex))
then
1124 allocate(resindex(nats))
1127 resindex = system%resindex
1132 write(io_unit,pdbformat)dummyc(1),dummyc(2),i, &
1133 system%symbol(i),dummyc(5),
"MOL",dummyc(7),resindex(i),dummyc(8),&
1134 system%coordinate(1,i),system%coordinate(2,i),system%coordinate(3,i),&
1135 dummyr(1),scalarprop(i),system%symbol(i),dummyc(10)
1138 write(io_unit,
'(A3)')
"TER"
1139 write(io_unit,
'(A3)')
"ENDMDL"
1144 io_name=trim(filename)//
".xyz"
1147 if(iter.eq.0.or.iter.eq.1)
then
1148 open(unit=io_unit,file=io_name,status=
'unknown')
1150 open(unit=io_unit,file=io_name,position =
'append',status=
'old')
1153 write(io_unit,*)system%nats
1154 write(io_unit,*)
"frame", iter
1157 write(io_unit,*)system%symbol(i),system%coordinate(1,i),system%coordinate(2,i),system%coordinate(3,i),&
1166 stop
"The file extension is not valid. Only pdb format is implemented"
1185 integer :: i, nats, seed
1186 real(
dp) :: lx, ly, lz, ran
1191 allocate(system%symbol(nats))
1192 allocate(system%atomic_number(nats))
1193 allocate(system%coordinate(3,nats))
1194 allocate(system%mass(nats))
1196 call random_seed(seed)
1200 system%atomic_number(i) = 1
1201 call random_number(ran)
1202 system%coordinate(i,1) = ran*lx
1203 call random_number(ran)
1204 system%coordinate(i,2) = ran*ly
1205 call random_number(ran)
1206 system%coordinate(i,3) = ran*lz
1213 allocate(system%lattice_vector(3,3))
1214 system%lattice_vector = 0.0_dp
1215 system%lattice_vector(1,1) = lx
1216 system%lattice_vector(2,2) = ly
1217 system%lattice_vector(3,3) = lz
1230 real(
dp) :: angle_alpha, angle_beta, angle_gamma, lattice_a
1231 real(
dp) :: lattice_b, lattice_c, pi
1232 real(
dp),
intent(in) :: abc_angles(2,3)
1233 real(
dp),
intent(out) :: lattice_vector(3,3)
1235 pi = 3.14159265358979323846264338327950_dp
1237 lattice_a = abc_angles(1,1)
1238 lattice_b = abc_angles(1,2)
1239 lattice_c = abc_angles(1,3)
1240 angle_alpha = abc_angles(2,1)
1241 angle_beta = abc_angles(2,2)
1242 angle_gamma = abc_angles(2,3)
1244 angle_alpha = 2.0_dp*pi*angle_alpha/360.0_dp
1245 angle_beta = 2.0_dp*pi*angle_beta/360.0_dp
1246 angle_gamma = 2.0_dp*pi*angle_gamma/360.0_dp
1248 lattice_vector(1,1) = lattice_a
1249 lattice_vector(1,2)=0
1250 lattice_vector(1,3)=0
1252 lattice_vector(2,1)=lattice_b*cos(angle_gamma)
1253 lattice_vector(2,2)=lattice_b*sin(angle_gamma)
1254 lattice_vector(2,3)=0
1256 lattice_vector(3,1)=lattice_c*cos(angle_beta)
1257 lattice_vector(3,2)=lattice_c*( cos(angle_alpha)-cos(angle_gamma)* &
1258 cos(angle_beta) )/sin(angle_gamma)
1259 lattice_vector(3,3)=sqrt(lattice_c**2 - lattice_vector(3,1)**2 - lattice_vector(3,2)**2)
1272 real(
dp) :: angle_alpha, angle_beta, angle_gamma, lattice_a
1273 real(
dp) :: lattice_b, lattice_c, pi
1274 real(
dp),
intent(in) :: lattice_vector(3,3)
1275 real(
dp),
intent(out) :: abc_angles(2,3)
1277 pi = 3.14159265358979323846264338327950_dp
1279 lattice_a = sqrt(lattice_vector(1,1)**2+lattice_vector(1,2)**2+lattice_vector(1,3)**2)
1280 lattice_b = sqrt(lattice_vector(2,1)**2+lattice_vector(2,2)**2+lattice_vector(2,3)**2)
1281 lattice_c = sqrt(lattice_vector(3,1)**2+lattice_vector(3,2)**2+lattice_vector(3,3)**2)
1283 angle_gamma = dot_product(lattice_vector(1,:),lattice_vector(2,:))/(lattice_a*lattice_b)
1284 angle_beta = dot_product(lattice_vector(1,:),lattice_vector(3,:))/(lattice_a*lattice_c)
1285 angle_alpha = dot_product(lattice_vector(2,:),lattice_vector(3,:))/(lattice_b*lattice_c)
1288 angle_alpha = 360.0_dp*acos(angle_alpha)/(2.0_dp*pi)
1289 angle_beta = 360.0_dp*acos(angle_beta)/(2.0_dp*pi)
1290 angle_gamma = 360.0_dp*acos(angle_gamma)/(2.0_dp*pi)
1292 abc_angles(1,1) = lattice_a
1293 abc_angles(1,2) = lattice_b
1294 abc_angles(1,3) = lattice_c
1296 abc_angles(2,1) = angle_alpha
1297 abc_angles(2,2) = angle_beta
1298 abc_angles(2,3) = angle_gamma
1309 real(
dp) :: max_x, max_y, max_z, min_x
1310 real(
dp) :: min_y, min_z
1311 real(
dp),
allocatable,
intent(inout) :: origin(:)
1312 real(
dp),
intent(in) :: coords(:,:)
1314 if(.not.
allocated(origin))
allocate(origin(3))
1316 max_x = -1.0d5 ; max_y = -1.0d5 ; max_z = -1.0d5 ;
1317 min_x = 1.0d5 ; min_y = 1.0d5 ; min_z = 1.0d5 ;
1320 do i=1,
size(coords,dim=2)
1321 max_x = max(max_x,coords(1,i))
1322 min_x = min(min_x,coords(1,i))
1323 max_y = max(max_y,coords(2,i))
1324 min_y = min(min_y,coords(2,i))
1325 max_z = max(max_z,coords(3,i))
1326 min_z = min(min_z,coords(3,i))
1343 real(
dp),
intent(in) :: coords(:,:)
1344 real(
dp),
intent(out),
allocatable :: dmat(:,:)
1346 nats =
size(coords,dim=2)
1347 if(.not.
allocated(dmat))
allocate(dmat(nats,nats))
1352 dmat(i,j) =
prg_norm2(coords(:,i)-coords(:,j))
1367 integer,
intent(in),
optional :: verbose
1368 real(
dp) :: max_x, max_y, max_z, min_x
1369 real(
dp) :: min_y, min_z
1370 real(
dp),
allocatable,
intent(inout) :: origin(:),coords(:,:)
1371 real(
dp),
intent(in) :: lattice_vectors(:,:)
1373 if(
present(verbose))
then
1374 if(verbose >= 1)
write(*,*)
"In prg_translateandfoldtobox ..."
1377 if(.not.
allocated(origin))
allocate(origin(3))
1379 max_x = -1.0d5 ; max_y = -1.0d5 ; max_z = -1.0d5 ;
1380 min_x = 1.0d5 ; min_y = 1.0d5 ; min_z = 1.0d5 ;
1383 do i=1,
size(coords,dim=2)
1384 max_x = max(max_x,coords(1,i))
1385 min_x = min(min_x,coords(1,i))
1386 max_y = max(max_y,coords(2,i))
1387 min_y = min(min_y,coords(2,i))
1388 max_z = max(max_z,coords(3,i))
1389 min_z = min(min_z,coords(3,i))
1396 coords(1,:) = coords(1,:) - origin(1)
1397 coords(2,:) = coords(2,:) - origin(2)
1398 coords(3,:) = coords(3,:) - origin(3)
1400 coords(1,:) = mod(coords(1,:)*1000000,1000000*lattice_vectors(1,1))/1000000;
1401 coords(2,:) = mod(coords(2,:)*1000000,1000000*lattice_vectors(2,2))/1000000;
1402 coords(3,:) = mod(coords(3,:)*1000000,1000000*lattice_vectors(3,3))/1000000;
1407 origin(1) = -1.0d-1 ; origin(2) = -1.0d-1; origin(3) = -1.0d-1
1420 integer,
intent(in),
optional :: verbose
1422 real(
dp),
allocatable,
intent(inout) :: coords(:,:)
1423 real(
dp),
intent(in) :: lattice_vectors(:,:)
1425 if(
present(verbose))
then
1426 if(verbose >= 1)
write(*,*)
"In prg_centeratbox ..."
1429 nats=
size(coords,dim=2)
1446 coords(1,i) = coords(1,i) + lattice_vectors(1,1)/2.0d0 - gc(1)
1447 coords(2,i) = coords(2,i) + lattice_vectors(2,2)/2.0d0 - gc(2)
1448 coords(3,i) = coords(3,i) + lattice_vectors(3,3)/2.0d0 - gc(3)
1462 integer,
intent(in) :: index
1463 integer,
intent(in),
optional :: verbose
1464 real(
dp),
allocatable,
intent(inout) :: coords(:,:)
1465 real(
dp),
allocatable :: origin(:)
1466 real(
dp),
intent(in) :: lattice_vectors(:,:)
1468 if(
present(verbose))
then
1469 if(verbose >= 1)
write(*,*)
"In prg_wraparound ..."
1472 if(.not.
allocated(origin))
allocate(origin(3))
1474 nats=
size(coords,dim=2)
1476 origin(1) = -coords(1,index) + lattice_vectors(1,1)/2.0_dp
1477 origin(2) = -coords(2,index) + lattice_vectors(2,2)/2.0_dp
1478 origin(3) = -coords(3,index) + lattice_vectors(3,3)/2.0_dp
1480 coords(1,:) = coords(1,:) + origin(1)
1481 coords(2,:) = coords(2,:) + origin(2)
1482 coords(3,:) = coords(3,:) + origin(3)
1487 if(coords(1,i) > lattice_vectors(1,1))coords(1,i)=coords(1,i)-lattice_vectors(1,1)
1488 if(coords(2,i) > lattice_vectors(2,2))coords(2,i)=coords(2,i)-lattice_vectors(2,2)
1489 if(coords(3,i) > lattice_vectors(3,3))coords(3,i)=coords(3,i)-lattice_vectors(3,3)
1490 if(coords(1,i) < 0.0_dp)coords(1,i)=coords(1,i)+lattice_vectors(1,1)
1491 if(coords(2,i) < 0.0_dp)coords(2,i)=coords(2,i)+lattice_vectors(2,2)
1492 if(coords(3,i) < 0.0_dp)coords(3,i)=coords(3,i)+lattice_vectors(3,3)
1507 real(
dp),
allocatable,
intent(inout) :: origin(:),coords(:,:)
1508 real(
dp),
intent(in) :: lattice_vectors(:,:)
1509 real(
dp) :: geomc(3)
1511 if(.not.
allocated(origin))
allocate(origin(3))
1514 do i=1,
size(coords,dim=2)
1515 geomc = geomc + coords(:,i)
1518 geomc = geomc/
size(coords,dim=2)
1520 coords(1,:) = coords(1,:) - geomc(1)
1521 coords(2,:) = coords(2,:) - geomc(2)
1522 coords(3,:) = coords(3,:) - geomc(3)
1524 coords(1,:) = mod(coords(1,:)*1000000,1000000*lattice_vectors(1,1))/1000000;
1525 coords(2,:) = mod(coords(2,:)*1000000,1000000*lattice_vectors(2,2))/1000000;
1526 coords(3,:) = mod(coords(3,:)*1000000,1000000*lattice_vectors(3,3))/1000000;
1531 origin(1) = -1.0d-1 ; origin(2) = -1.0d-1; origin(3) = -1.0d-1
1545 integer :: i, j, k, l
1546 integer :: m, fnats, nats
1547 integer,
intent(in) :: nx, ny,
nz
1548 character(2),
allocatable,
intent(inout) :: symbols(:)
1549 character(2),
allocatable :: rsymbols(:)
1550 real(
dp),
allocatable,
intent(inout) :: coords(:,:)
1551 real(
dp),
intent(inout) :: lattice_vectors(:,:)
1552 real(
dp),
allocatable :: r(:,:)
1554 nats =
size(coords,dim=2)
1555 fnats = nx*ny*
nz*nats
1557 allocate(r(3,fnats))
1558 allocate(rsymbols(fnats))
1566 r(1,m)=i*lattice_vectors(1,1) + j*lattice_vectors(1,2) + k*lattice_vectors(1,3)
1567 r(1,m)=r(1,m) + coords(1,l)
1568 r(2,m)=i*lattice_vectors(2,1) + j*lattice_vectors(2,2) + k*lattice_vectors(2,3)
1569 r(2,m)=r(2,m) + coords(2,l)
1570 r(3,m)=i*lattice_vectors(3,1) + j*lattice_vectors(3,2) + k*lattice_vectors(3,3)
1571 r(3,m)=r(3,m) + coords(3,l)
1572 rsymbols(m) = symbols(l)
1578 deallocate(coords,symbols)
1579 allocate(coords(3,fnats))
1580 allocate(symbols(fnats))
1582 lattice_vectors(1,:) = nx*lattice_vectors(1,:)
1583 lattice_vectors(2,:) = ny*lattice_vectors(2,:)
1584 lattice_vectors(3,:) =
nz*lattice_vectors(3,:)
1588 deallocate(r,rsymbols)
1602 integer :: i, j, k, l
1603 integer :: ini, fin, cont, ii
1604 integer,
intent(in) :: nx, ny,
nz
1608 if(.not.
allocated(sy%coordinate))
then
1609 write(*,*)
"ERROR: System does not have coordinate"
1612 if(.not.
allocated(sy%symbol))
then
1613 write(*,*)
"ERROR: System does not have atomic symbols"
1616 syf%nats = sy%nats*nx*ny*
nz
1617 allocate(syf%coordinate(3,syf%nats))
1618 allocate(syf%symbol(syf%nats))
1619 allocate(syf%resindex(syf%nats))
1620 allocate(syf%atomname(syf%nats))
1621 allocate(syf%atomic_number(syf%nats))
1622 allocate(syf%spindex(syf%nats))
1630 syf%coordinate(1,cont) = sy%coordinate(1,ii) + &
1631 & sy%lattice_vector(1,1)*i + sy%lattice_vector(2,1)*i + sy%lattice_vector(3,1)*i
1632 syf%coordinate(2,cont) = sy%coordinate(2,ii) + &
1633 & sy%lattice_vector(1,2)*j + sy%lattice_vector(2,2)*j + sy%lattice_vector(3,2)*j
1634 syf%coordinate(3,cont) = sy%coordinate(3,ii) + &
1635 & sy%lattice_vector(1,3)*k + sy%lattice_vector(2,3)*k + sy%lattice_vector(3,3)*k
1636 syf%symbol(cont) = sy%symbol(ii)
1642 if(
allocated(sy%resindex))
then
1644 ini = (i - 1)*sy%nats + 1
1646 syf%resindex(ini:fin) = sy%resindex(:)
1652 if(
allocated(sy%atomname))
then
1654 ini = (i - 1)*sy%nats + 1
1656 syf%atomname(ini:fin) = sy%atomname(:)
1662 if(
allocated(sy%atomic_number))
then
1664 ini = (i - 1)*sy%nats + 1
1666 syf%atomic_number(ini:fin) = sy%atomic_number(:)
1669 if(
allocated(sy%spindex))
then
1671 ini = (i - 1)*sy%nats + 1
1673 syf%spindex(ini:fin) = sy%spindex(:)
1677 allocate(syf%lattice_vector(3,3))
1678 syf%lattice_vector(1,:) = nx*sy%lattice_vector(1,:)
1679 syf%lattice_vector(2,:) = ny*sy%lattice_vector(2,:)
1680 syf%lattice_vector(3,:) =
nz*sy%lattice_vector(3,:)
1682 if(
allocated(sy%splist))
then
1684 allocate(syf%splist(syf%nsp))
1685 syf%splist = sy%splist
1699 integer :: i, natstmp, l, count, j, count1
1700 integer,
intent(inout) :: nats
1701 integer,
intent(in),
optional :: verbose
1703 real(
dp),
allocatable,
intent(inout) :: coords(:,:)
1704 real(
dp),
allocatable :: coordstmp(:,:)
1705 character(len=*),
allocatable,
intent(inout) :: symbols(:)
1706 character(2),
allocatable :: symbolstmp(:)
1708 if(
present(verbose))
then
1709 if(verbose >= 1)
write(*,*)
"In prg_cleanuprepeatedatoms ..."
1714 allocate(coordstmp(3,nats))
1715 allocate(symbolstmp(nats))
1717 coordstmp(1,1)=coords(1,1)
1718 coordstmp(2,1)=coords(2,1)
1719 coordstmp(3,1)=coords(3,1)
1722 symbolstmp(1)=symbols(1)
1728 d=sqrt((coords(1,j)-coordstmp(1,i))**2+(coords(2,j)-coordstmp(2,i))**2+&
1729 &(coords(3,j)-coordstmp(3,i))**2)
1739 write(*,*)
"Problem at iteration",j
1744 coordstmp(1,l)=coords(1,j)
1745 coordstmp(2,l)=coords(2,j)
1746 coordstmp(3,l)=coords(3,j)
1747 symbolstmp(l)=symbols(j)
1754 allocate(symbols(nats))
1755 allocate(coords(3,nats))
1758 symbols(i) = symbolstmp(i)
1759 coords(:,i) = coordstmp(:,i)
1762 deallocate(coordstmp)
1763 deallocate(symbolstmp)
1780 real(
dp) :: a1xa2(3), a2xa3(3), a3xa1(3), b2xb3(3)
1782 real(
dp),
allocatable,
intent(inout) :: recip_vectors(:,:)
1783 real(
dp),
intent(in) :: lattice_vectors(:,:)
1784 real(
dp),
intent(inout) :: volk, volr
1786 if(.not.
allocated(recip_vectors))
allocate(recip_vectors(3,3))
1787 volr=0.0_dp; volk=0.0_dp
1789 pi = 3.14159265358979323846264338327950_dp
1791 a1xa2(1) = lattice_vectors(1,2)*lattice_vectors(2,3) - lattice_vectors(1,3)*lattice_vectors(2,2)
1792 a1xa2(2) = -lattice_vectors(1,1)*lattice_vectors(2,3) + lattice_vectors(1,3)*lattice_vectors(2,1)
1793 a1xa2(3) = lattice_vectors(1,1)*lattice_vectors(2,2) - lattice_vectors(1,2)*lattice_vectors(2,1)
1795 a2xa3(1) = lattice_vectors(2,2)*lattice_vectors(3,3) - lattice_vectors(2,3)*lattice_vectors(3,2)
1796 a2xa3(2) = -lattice_vectors(2,1)*lattice_vectors(3,3) + lattice_vectors(2,3)*lattice_vectors(3,1)
1797 a2xa3(3) = lattice_vectors(2,1)*lattice_vectors(3,2) - lattice_vectors(2,2)*lattice_vectors(3,1)
1799 a3xa1(1) = lattice_vectors(3,2)*lattice_vectors(1,3) - lattice_vectors(3,3)*lattice_vectors(1,2)
1800 a3xa1(2) = -lattice_vectors(3,1)*lattice_vectors(1,3) + lattice_vectors(3,3)*lattice_vectors(1,1)
1801 a3xa1(3) = lattice_vectors(3,1)*lattice_vectors(1,2) - lattice_vectors(3,2)*lattice_vectors(1,1)
1804 volr = lattice_vectors(1,1)*a2xa3(1)+ lattice_vectors(1,2)*a2xa3(2)+lattice_vectors(1,3)*a2xa3(3)
1807 recip_vectors(1,:) = 2.0_dp*pi*a2xa3(:)/volr
1808 recip_vectors(2,:) = 2.0_dp*pi*a3xa1(:)/volr
1809 recip_vectors(3,:) = 2.0_dp*pi*a1xa2(:)/volr
1811 b2xb3(1) = recip_vectors(2,2)*recip_vectors(3,3) - recip_vectors(2,3)*recip_vectors(3,2)
1812 b2xb3(2) = -recip_vectors(2,1)*recip_vectors(3,3) + recip_vectors(2,3)*recip_vectors(3,1)
1813 b2xb3(3) = recip_vectors(2,1)*recip_vectors(3,2) - recip_vectors(2,2)*recip_vectors(3,1)
1815 volk = recip_vectors(1,1)*b2xb3(1)+ recip_vectors(1,2)*b2xb3(2)+recip_vectors(1,3)*b2xb3(3)
1829 real(
dp) :: mv1, mv2, v1(3), v2(3)
1830 real(
dp) :: dotprod, cosdir, v2xv20(3), v1xv10(3)
1831 real(
dp) :: v10(3),v20(3), cprod(3), normcprod, sindir
1832 real(
dp),
intent(in) :: coords(:,:)
1833 real(
dp),
intent(out) :: dihedral
1835 integer,
intent(in) :: id1,id2,id3,id4
1836 character(2) :: index1, index2, index3, index4
1838 v1=coords(:,id4) - coords(:,id3)
1839 v10=coords(:,id2) - coords(:,id3)
1840 v2=coords(:,id1) - coords(:,id2)
1841 v20=coords(:,id3) - coords(:,id2)
1843 v1xv10(1)=v1(2)*v10(3)-v1(3)*v10(2)
1844 v1xv10(2)=-(v1(1)*v10(3)-v1(3)*v10(1))
1845 v1xv10(3)=v1(1)*v10(2)-v1(2)*v10(1)
1847 v2xv20(1)=v2(2)*v20(3)-v2(3)*v20(2)
1848 v2xv20(2)=-(v2(1)*v20(3)-v2(3)*v20(1))
1849 v2xv20(3)=v2(1)*v20(2)-v2(2)*v20(1)
1851 dotprod = v1xv10(1)*v2xv20(1) + v1xv10(2)*v2xv20(2) + v1xv10(3)*v2xv20(3)
1853 cprod(1)=v1xv10(2)*v2xv20(3)-v1xv10(3)*v2xv20(2)
1854 cprod(2)=-(v1xv10(1)*v2xv20(3)-v1xv10(3)*v2xv20(1))
1855 cprod(3)=v1xv10(1)*v2xv20(2)-v1xv10(2)*v2xv20(1)
1857 normcprod=sqrt(cprod(1)*cprod(1) + cprod(2)*cprod(2) + cprod(3)*cprod(3))
1859 mv1= sqrt(v1xv10(1)*v1xv10(1) + v1xv10(2)*v1xv10(2) + v1xv10(3)*v1xv10(3))
1860 mv2= sqrt(v2xv20(1)*v2xv20(1) + v2xv20(2)*v2xv20(2) + v2xv20(3)*v2xv20(3))
1862 cosdir = dotprod/(mv1*mv2)
1863 sindir = normcprod/(mv1*mv2)
1866 dihedral=sign(1.0d0,sindir)*acos(-cosdir)
1867 dihedral=-360*dihedral/(2.0*3.14159265359)
1868 if(dihedral < 0)dihedral = 360 + dihedral
1884 character(20),
intent(in) :: bml_type
1885 integer :: i, j, jj, mdim
1886 integer,
intent(in) :: mdimin
1887 integer,
intent(in) :: nnstruct(:,:), nrnnstruct(:)
1888 integer,
optional,
intent(in) :: verbose
1889 real(
dp) :: d, dvdw, factor, ra(3),rb(3),rab(3)
1890 real(
dp) :: lx, ly, lz
1891 type(bml_matrix_t),
intent(inout) :: gcov_bml
1893 logical(1),
allocatable :: ispresent(:)
1895 if(bml_get_n(gcov_bml).gt.0)
call bml_deallocate(gcov_bml)
1903 call bml_zero_matrix(bml_type,bml_element_real,kind(1.0),sy%nats,mdim,gcov_bml)
1906 lx = sy%lattice_vector(1,1)
1907 ly = sy%lattice_vector(2,2)
1908 lz = sy%lattice_vector(3,3)
1910 if(
present(verbose))
then
1911 if(verbose >= 1)
then
1913 write(*,*)
"Building covalency graph ..."
1918 allocate(ispresent(sy%nats))
1921 ra = sy%coordinate(:,i)
1923 do j=1,nrnnstruct(i)
1925 if(nrnnstruct(i) <= 1)
write(*,*)
"WARNING: Atom" ,i,
"is desconnected"
1928 if(.not.ispresent(jj))
then
1929 rb = sy%coordinate(:,jj)
1931 rab(1) = modulo((rb(1) - ra(1) + lx/2.0_dp),lx) - lx/2.0_dp
1932 rab(2) = modulo((rb(2) - ra(2) + ly/2.0_dp),ly) - ly/2.0_dp
1933 rab(3) = modulo((rb(3) - ra(3) + lz/2.0_dp),lz) - lz/2.0_dp
1937 if(d == 0.0_dp .and. i .ne. jj)
write(*,*)
"WARNING: Atom" ,i,
"and atom",jj,&
1938 "are on top of each other"
1940 if(d < dvdw .and. d > 0.0_dp)
then
1941 ispresent(jj) = .true.
1944 call bml_set_element_new(gcov_bml,i,jj,1.0)
1953 deallocate(ispresent)
1960 character(20),
intent(in) :: bml_type
1961 integer :: i, j, jj, mdim
1962 integer,
intent(in) :: mdimin
1963 integer,
intent(in) :: nnStruct(:,:), nrnnstruct(:)
1964 integer,
optional,
intent(in) :: verbose
1965 real(dp) :: d, dvdw, factor
1966 real(dp),
intent(in) :: nnStructMindist(:,:)
1967 type(bml_matrix_t),
intent(inout) :: gcov_bml
1970 if(bml_get_n(gcov_bml).gt.0)
call bml_deallocate(gcov_bml)
1978 call bml_zero_matrix(bml_type,bml_element_real,dp,sy%nats,mdim,gcov_bml)
1980 if(
present(verbose))
then
1981 if(verbose >= 1)
then
1983 write(*,*)
"Building covalency graph ..."
1989 do j=1,nrnnstruct(i)
1990 if(nrnnstruct(i) <= 1)
write(*,*)
"WARNING: Atom" ,i,
"is desconnected"
1992 d = nnstructmindist(j,i)
1993 if(d == 0.0_dp .and. i .ne. jj)
write(*,*)
"WARNING: Atom" ,i,
"and atom",j,&
1994 "are on top of each other"
1996 if(d < dvdw .and. d > 0.0_dp)
then
1997 call bml_set_element_new(gcov_bml,i,jj,1.0_dp)
1998 call bml_set_element_new(gcov_bml,jj,i,1.0_dp)
2001 call bml_set_element_new(gcov_bml,i,i,1.0_dp)
2018 graph_h,mdimin,verbose)
2020 integer :: i, j, jj, ncount, mdim
2021 integer,
intent(in) :: nnstruct(:,:), nrnnstruct(:), mdimin
2022 integer,
optional,
intent(in) :: verbose
2023 real(
dp) :: d, dvdw, ra(3),rb(3),rab(3)
2024 real(
dp) :: lx, ly, lz
2025 real(
dp),
intent(in) :: rcut
2026 integer,
allocatable,
intent(inout) :: graph_h(:,:)
2036 if(.not.
allocated(graph_h))
allocate(graph_h(mdim,sy%nats))
2038 if(
present(verbose))
then
2039 if(verbose >= 1)
then
2041 write(*,*)
"Building H covalency graph ..."
2048 lx = sy%lattice_vector(1,1)
2049 ly = sy%lattice_vector(2,2)
2050 lz = sy%lattice_vector(3,3)
2057 do j=1,nrnnstruct(i)
2059 ra=sy%coordinate(:,i)
2060 rb=sy%coordinate(:,jj)
2061 rab(1) = modulo((rb(1) - ra(1) + lx/2.0_dp),lx) - lx/2.0_dp
2062 rab(2) = modulo((rb(2) - ra(2) + ly/2.0_dp),ly) - ly/2.0_dp
2063 rab(3) = modulo((rb(3) - ra(3) + lz/2.0_dp),lz) - lz/2.0_dp
2067 if(d.lt.rcut.and.d.gt.0.0_dp)
then
2069 graph_h(ncount,i) = jj
2089 integer :: i, nsptmp, prev
2090 integer,
intent(in) :: indices(:), lsize
2091 integer,
optional,
intent(in) :: verbose
2095 if(
present(verbose))
then
2096 if(verbose >= 1)
then
2098 write(*,*)
"Extracting subsystem ..."
2105 if(
allocated(sbsy%symbol))
then
2106 deallocate(sbsy%symbol)
2107 deallocate(sbsy%coordinate)
2108 deallocate(sbsy%atomic_number)
2109 deallocate(sbsy%velocity)
2110 deallocate(sbsy%force)
2111 deallocate(sbsy%net_charge)
2112 deallocate(sbsy%mass)
2113 deallocate(sbsy%lattice_vector)
2114 deallocate(sbsy%spindex)
2117 allocate(sbsy%symbol(sbsy%nats))
2118 allocate(sbsy%coordinate(3,sbsy%nats))
2119 allocate(sbsy%atomic_number(sbsy%nats))
2120 allocate(sbsy%velocity(3,sbsy%nats))
2121 allocate(sbsy%force(3,sbsy%nats))
2122 allocate(sbsy%net_charge(sbsy%nats))
2123 allocate(sbsy%mass(sbsy%nats))
2124 allocate(sbsy%lattice_vector(3,3))
2125 allocate(sbsy%spindex(sbsy%nats))
2129 sbsy%lattice_vector = sy%lattice_vector
2135 sbsy%symbol(i) = sy%symbol(indices(i)+1)
2136 sbsy%coordinate(:,i) = sy%coordinate(:,indices(i)+1)
2137 sbsy%atomic_number(i) = sy%atomic_number(indices(i)+1)
2138 sbsy%mass(i) = sy%mass(indices(i)+1)
2139 sbsy%spindex(i) = sy%spindex(indices(i)+1)
2140 if(sbsy%spindex(i).gt.nsptmp)
then
2145 if(nsptmp.lt.sy%nsp)
then
2146 write(*,*)
"WARNING: nsp = ",nsptmp
2147 write(*,*)
"The subsystem contains less species that the system ..."
2148 write(*,*)
"A generalization to parts where subsystem contains"
2149 write(*,*)
"less species that the system needs to be added ..."
2150 write(*,*)
"See prg_get_subsystem in prg_system_mod"
2156 if(
allocated(sbsy%spatnum))
then
2157 deallocate(sbsy%spatnum)
2158 deallocate(sbsy%spmass)
2161 allocate(sbsy%spatnum(sbsy%nsp))
2162 allocate(sbsy%spmass(sbsy%nsp))
2164 sbsy%spatnum = sy%spatnum
2165 sbsy%spmass = sy%spmass
2179 integer,
optional,
intent(in) :: verbose
2182 if(
present(verbose))
then
2183 if(verbose >= 1)
then
2185 write(*,*)
"Deallocating the multiple subsystem ..."
2191 if(
allocated(sbsy%symbol))
then
2192 deallocate(sbsy%symbol)
2193 deallocate(sbsy%coordinate)
2194 deallocate(sbsy%atomic_number)
2195 deallocate(sbsy%velocity)
2196 deallocate(sbsy%force)
2197 deallocate(sbsy%net_charge)
2198 deallocate(sbsy%mass)
2199 deallocate(sbsy%spindex)
2202 if(
allocated(sbsy%lattice_vector))
deallocate(sbsy%lattice_vector)
2203 if(
allocated(sbsy%resindex))
deallocate(sbsy%resindex)
2205 if(
allocated(sbsy%spatnum))
then
2206 deallocate(sbsy%spatnum)
2207 deallocate(sbsy%spmass)
2210 if(bml_get_n(sbsy%estr%ham) > 0)
call bml_deallocate(sbsy%estr%ham)
2211 if(bml_get_n(sbsy%estr%ham0) > 0)
call bml_deallocate(sbsy%estr%ham0)
2212 if(bml_get_n(sbsy%estr%oham) > 0)
call bml_deallocate(sbsy%estr%oham)
2213 if(bml_get_n(sbsy%estr%over) > 0)
call bml_deallocate(sbsy%estr%over)
2214 if(bml_get_n(sbsy%estr%rho) > 0)
call bml_deallocate(sbsy%estr%rho)
2215 if(bml_get_n(sbsy%estr%orho) > 0)
call bml_deallocate(sbsy%estr%orho)
2216 if(bml_get_n(sbsy%estr%zmat) > 0)
call bml_deallocate(sbsy%estr%zmat)
2219 if(
allocated(sbsy%estr%coul_pot_r))
deallocate(sbsy%estr%coul_pot_r)
2220 if(
allocated(sbsy%estr%coul_pot_k))
deallocate(sbsy%estr%coul_pot_k)
2221 if(
allocated(sbsy%estr%skforce))
deallocate(sbsy%estr%skforce)
2222 if(
allocated(sbsy%estr%fpul))
deallocate(sbsy%estr%fpul)
2223 if(
allocated(sbsy%estr%fscoul))
deallocate(sbsy%estr%fscoul)
2224 if(
allocated(sbsy%estr%hindex))
deallocate(sbsy%estr%hindex)
2242 character(2),
intent(in) :: hetatm
2243 integer :: cnt, i, j, jj
2244 integer :: maxparts, nmax
2245 integer,
allocatable :: core_count(:), cores(:,:), partof(:)
2246 integer,
intent(in) :: nnstruct(:,:), nrnnstruct(:)
2247 integer,
intent(inout) :: npart
2248 integer,
optional,
intent(inout) :: verbose
2249 logical,
allocatable :: inpart(:)
2251 real(
dp),
intent(in) :: nnstructmindist(:,:)
2255 if(
present(verbose))
then
2256 if(verbose >= 1)
then
2257 write(*,*)
" ";
write(*,*)
"Partitioning by molecule ...";
write(*,*)
" "
2261 if(
allocated(gp%nnodesInPart))
then
2268 allocate(core_count(maxparts))
2270 allocate(cores(nmax,maxparts))
2271 allocate(inpart(sy%nats))
2272 allocate(partof(sy%nats))
2280 if(.not.inpart(i).and.trim(sy%symbol(i)) == trim(hetatm))
then
2282 core_count(npart) = core_count(npart) + 1
2283 cores(core_count(npart),npart) = i
2285 do j=1,nrnnstruct(i)
2287 d = nnstructmindist(j,i)
2289 if(d.lt.dvdw.and.d.gt.0.001_dp)
then
2290 if(.not.inpart(jj))
then
2291 core_count(npart) = core_count(npart) + 1
2292 cores(core_count(npart),npart) = jj
2306 gp%nnodesInPartAll(i) = core_count(i)
2308 allocate(gp%sgraph(i)%nodeInPart(core_count(i)))
2309 gp%nnodesInPart(i) = core_count(i)
2314 do j=1,core_count(i)
2315 gp%sgraph(i)%nodeInPart(j) = cores(j,i) - 1
2331 character(20) :: bml_type
2332 integer :: i, ii, j, jj
2333 integer :: nch, norbs
2334 integer,
intent(in) :: hindex(:,:)
2335 integer,
optional,
intent(in) :: verbose
2336 logical :: connection
2337 logical,
allocatable :: iconnectedtoj(:)
2338 real(
dp),
allocatable :: row(:), rowat(:)
2339 real(
dp),
intent(in) :: threshold
2340 type(bml_matrix_t),
intent(in) :: rho_bml
2341 type(bml_matrix_t),
intent(inout) :: gch_bml
2343 norbs = bml_get_n(rho_bml)
2344 bml_type = bml_get_type(rho_bml)
2345 nch =
size(hindex,dim=2)
2346 allocate(rowat(nch))
2347 allocate(row(norbs))
2348 allocate(iconnectedtoj(nch))
2350 if(bml_get_n(gch_bml) > 0)
call bml_deallocate(gch_bml)
2351 call bml_zero_matrix(bml_type,bml_element_real,
dp,nch,nch,gch_bml)
2355 do ii = hindex(1,i),hindex(2,i)
2356 call bml_get_row(rho_bml,ii,row)
2357 iconnectedtoj = .false.
2359 connection = .false.
2361 if(.not.iconnectedtoj(j).and.rowat(j) == 0)
then
2362 do jj = hindex(1,j),hindex(2,j)
2363 if(abs(row(jj)) > threshold)
then
2368 if(connection) iconnectedtoj(j) = .true.
2370 if(connection) rowat(j) = 1.0_dp
2374 call bml_set_row(gch_bml,i,rowat)
2379 deallocate(iconnectedtoj)
2397 character(20) :: bml_type
2398 integer :: i, ifull, ii, j
2399 integer :: jfull, jj, nch, ncounti
2400 integer :: norbs, mdim
2401 logical(1),
allocatable :: rowatfull(:)
2402 integer,
allocatable,
intent(inout) :: graph_p(:,:)
2403 integer,
intent(in) :: chindex(:), hindex(:,:), nats, nc
2404 integer,
intent(in) :: mdimin
2405 integer,
optional,
intent(in) :: verbose
2406 logical :: connection
2407 logical,
allocatable :: iconnectedtoj(:)
2408 real(
dp),
allocatable :: row(:)
2409 real(
dp),
intent(in) :: threshold
2410 type(bml_matrix_t),
intent(in) :: rho_bml
2412 norbs = bml_get_n(rho_bml)
2413 bml_type = bml_get_type(rho_bml)
2414 nch =
size(hindex,dim=2)
2415 allocate(rowatfull(nats))
2416 allocate(row(norbs))
2417 allocate(iconnectedtoj(nch))
2425 if(.not.
allocated(graph_p))
then
2426 allocate(graph_p(mdim,nats))
2436 ifull = chindex(i) + 1
2440 do while (graph_p(ii,ifull).ne.0)
2441 rowatfull(graph_p(ii,ifull)) = .true.
2442 ncounti = ncounti + 1
2446 do ii = hindex(1,i),hindex(2,i)
2447 call bml_get_row(rho_bml,ii,row)
2448 iconnectedtoj = .false.
2451 jfull = chindex(j) + 1
2452 connection = .false.
2453 if(.not.iconnectedtoj(j).and..not.rowatfull(jfull))
then
2454 do jj = hindex(1,j),hindex(2,j)
2455 if(abs(row(jj)) > threshold)
then
2460 if(connection) iconnectedtoj(j) = .true.
2464 rowatfull(jfull) = .true.
2465 ncounti = ncounti + 1
2466 graph_p(ncounti,ifull) = jfull
2475 deallocate(rowatfull)
2476 deallocate(iconnectedtoj)
2489 integer :: i, ii, j, nats
2490 integer :: ncounti, maxnz
2491 integer,
intent(inout) :: graph_h(:,:)
2492 integer,
intent(inout) :: graph_p(:,:)
2493 logical(1),
allocatable :: rowpatfull(:)
2495 nats =
size(graph_p,dim=2)
2496 maxnz =
size(graph_p,dim=1)
2498 allocate(rowpatfull(nats))
2505 rowpatfull = .false.
2508 if(graph_p(ii,i) == 0)
exit
2509 rowpatfull(graph_p(ii,i)) = .true.
2510 ncounti = ncounti + 1
2516 if(.not.rowpatfull(j))
then
2517 ncounti = ncounti + 1
2518 graph_p(ncounti,i) = j
2525 deallocate(rowpatfull)
2540 integer :: i, ii, j, nats
2541 integer :: ncounti, ncountot
2542 integer,
allocatable,
intent(inout) :: adjncy(:), graph_h(:,:), graph_p(:,:), xadj(:)
2543 logical(1),
allocatable :: rowpatfull(:)
2545 nats =
size(graph_p,dim=2)
2546 allocate(rowpatfull(nats))
2547 allocate(xadj(nats+1))
2548 allocate(adjncy(nats*nats))
2558 rowpatfull = .false.
2560 do while (graph_p(ii,i).ne.0)
2561 rowpatfull(graph_p(ii,i)) = .true.
2562 ncounti = ncounti + 1
2567 do while (graph_h(ii,i).ne.0)
2569 if(.not.rowpatfull(j))
then
2570 ncounti = ncounti + 1
2571 ncountot = ncountot + 1
2572 graph_p(ncounti,i) = j
2588 do while (graph_p(ii,i).gt.0)
2589 ncounti = ncounti + 1
2590 ncountot = ncountot + 1
2591 adjncy(ncountot) = graph_p(ii,i)
2594 xadj(i) = ncountot - ncounti + 1
2598 xadj(nats+1) = ncountot + 1
2600 deallocate(rowpatfull)
2614 character(20),
intent(in) :: bml_type
2615 integer :: i, ii, j, nats
2616 integer,
intent(in) :: adjncy(:), xadj(:)
2617 real(
dp),
allocatable :: row(:)
2618 type(bml_matrix_t),
intent(inout) :: g_bml
2620 nats =
size(xadj,dim=1) - 1
2621 if(bml_get_n(g_bml).gt.0)
call bml_deallocate(g_bml)
2622 call bml_zero_matrix(bml_type,bml_element_real,
dp,nats,nats,g_bml)
2630 do j = xadj(i), xadj(i+1) - 1
2631 row(adjncy(j)) = 1.0_dp
2633 call bml_set_row(g_bml,i,row)
2648 character(20),
intent(in) :: bml_type
2649 integer :: i, ii, nats, mdim
2650 integer,
allocatable,
intent(inout) :: graph(:,:)
2652 real(kind(1.0)),
allocatable :: row(:)
2653 type(bml_matrix_t),
intent(inout) :: g_bml
2655 nats =
size(graph,dim=2)
2660 mdim = bml_get_m(g_bml)
2668 do while (graph(ii,i).gt.0)
2669 row(graph(ii,i)) = 1.0
2674 call bml_set_row(g_bml,i,row,0.5_dp)
2691 integer,
intent(inout) :: graph(:,:)
2692 integer,
allocatable :: vector(:)
2693 integer :: i, j, maxnz, nats, ncount
2695 nats =
size(graph,dim=2)
2696 allocate(vector(nats*maxnz))
2705 ncount = (i-1)*maxnz + j
2706 vector(ncount) = graph(j,i)
2720 integer,
intent(inout) :: graph(:,:)
2721 integer,
allocatable,
intent(inout) :: vector(:)
2722 integer :: i, j, maxnz, nats, ncount
2724 nats =
size(graph,dim=2)
2732 ncount = (i-1)*maxnz + j
2733 graph(j,i) = vector(ncount)
2748 integer,
intent(inout) :: xadj(:)
2749 integer,
allocatable,
intent(inout) :: adjncy(:)
2750 integer :: i, j, n, l, first, last, nx, irank, mintmp
2751 integer,
allocatable :: tmpvect(:), newadjncy(:)
2753 nx =
size(xadj,dim=1)
2754 allocate(tmpvect(nx))
2755 allocate(newadjncy(xadj(nx) - 1))
2762 last = xadj(i+1) - 1
2763 write(*,*)first,last
2764 n = last - first + 1
2766 tmpvect(1:n) = adjncy(first:last)
2770 if(tmpvect(j) >= tmpvect(l).and.tmpvect(l).ne.0)
then
2772 tmpvect(l) = tmpvect(j)
2778 adjncy(first:last) = tmpvect(1:n)
2779 newadjncy(first:last) = tmpvect(1:n)
2786 allocate(adjncy(xadj(nx) - 1))
2790 deallocate(newadjncy)
subroutine, public prg_initgraphpartitioning(gp, pname, np, nnodes, nnodes2)
Initialize graph partitioning.
subroutine, public prg_initsubgraph(sg, pnum, hsize)
Initialize subgraph.
subroutine, public prg_destroygraphpartitioning(gp)
Destroy graph partitioning.
Module to handle input output files for the PROGRESS lib.
integer function, public get_file_unit(io_max)
Returns a unit number that is not in use.
subroutine, public prg_open_file(io, name)
Opens a file to write.
subroutine, public prg_open_file_to_read(io, name)
Opens a file to read.
Periodic table of elements.
real(dp), dimension(nz), parameter element_covr
Covalent radius (in Angstroms)
character(2), dimension(nz), parameter element_symbol
Element symbol.
integer function, public element_atomic_number(symbol)
integer function element_atomic_number_upper(symbol)
real(dp), dimension(nz), parameter element_mass
Element mass in atomic mass units (1.66 x 10-27 kg)
A module to read and handle chemical systems.
subroutine, public prg_get_subsystem(sy, lsize, indices, sbsy, verbose)
Get a subsystem out of the total system.
subroutine, public prg_adj2bml(xadj, adjncy, bml_type, g_bml)
prg_adj2bml
subroutine, public prg_destroy_subsystems(sbsy, verbose)
Destroy allocated subsystem.
subroutine, public prg_parameters_to_vectors(abc_angles, lattice_vector)
Transforms the lattice parameters into lattice vectors.
subroutine, public prg_translatetogeomcandfoldtobox(coords, lattice_vectors, origin)
Translate to geometric center.
subroutine, public prg_replicate_system(sy, syf, nx, ny, nz)
Extend/replicate a system type along the lattice vectors.
subroutine, public prg_get_dihedral(coords, id1, id2, id3, id4, dihedral)
Get the dihedral angle given four atomic positions.
subroutine, public prg_graph2bml(graph, bml_type, g_bml)
Graph2bml.
subroutine, public prg_write_trajectory(system, iter, each, prg_deltat, filename, extension)
Write trajectory in .xyz, .dat or pdb file.
subroutine prg_get_covgraph_int(sy, nnStructMindist, nnStruct, nrnnstruct, bml_type, factor, gcov_bml, mdimin, verbose)
subroutine, public prg_molpartition(sy, npart, nnStructMindist, nnStruct, nrnnstruct, hetatm, gp, verbose)
Partition by molecule.
subroutine, public prg_make_random_system(system, nats, seed, lx, ly, lz)
Make random Xx system.
subroutine, public prg_cleanuprepeatedatoms(nats, coords, symbols, verbose)
Cleanup repeated atoms we might have in the system.
subroutine, public prg_merge_graph_adj(graph_p, graph_h, xadj, adjncy)
Get partial subgraph based on the Density matrix.
subroutine, public prg_graph2vector(graph, vector, maxnz)
Vectorize graph.
subroutine, public prg_get_covgraph(sy, nnStruct, nrnnstruct, bml_type, factor, gcov_bml, mdimin, verbose)
Get the covalency graph in bml format.
subroutine, public prg_write_trajectoryandproperty(system, iter, each, prg_deltat, scalarprop, filename, extension)
Write trajectory and atomic properties. Only pdb file.
subroutine, public prg_vector2graph(vector, graph, maxnz)
Back to graph.
subroutine, public prg_translateandfoldtobox(coords, lattice_vectors, origin, verbose)
Translate and fold to box.
subroutine, public prg_wraparound(coords, lattice_vectors, index, verbose)
Wrap around atom i using pbc.
subroutine, public prg_destroy_estr(estr)
Deallocates all the arrays within the electronic structure.
subroutine, public prg_get_covgraph_h(sy, nnStruct, nrnnstruct, rcut, graph_h, mdimin, verbose)
Get the covanlency graph.
subroutine, public prg_get_distancematrix(coords, dmat)
Get the distance matrix.
subroutine, public prg_get_nameandext(fullfilename, filename, ext)
Get the name and extension of a file.
subroutine, public prg_get_partial_atomgraph(rho_bml, hindex, gch_bml, threshold, verbose)
Get partial subgraph based on the Density matrix.
subroutine, public prg_destroy_system(sy)
Deallocates all the arrays within a system.
subroutine, public prg_parse_system(system, filename, extin)
The parser for the chemical system.
subroutine, public prg_centeratbox(coords, lattice_vectors, verbose)
Translate geometric center to the center of the box.
subroutine, public prg_vectors_to_parameters(lattice_vector, abc_angles)
Transforms the lattice vectors into lattice parameters.
subroutine, public prg_merge_graph(graph_p, graph_h)
Get partial subgraph based on the Density matrix.
subroutine, public prg_replicate(coords, symbols, lattice_vectors, nx, ny, nz)
Extend/replicate system along lattice vectors.
subroutine, public prg_write_system(system, filename, extin)
Write system in .xyz, .dat or pdb file.
subroutine, public prg_get_recip_vects(lattice_vectors, recip_vectors, volr, volk)
Get the volume of the cell and the reciprocal vectors: This soubroutine computes:
subroutine, public prg_sortadj(xadj, adjncy)
Sort adj NOTE: this might not be needed anymre since the bml_get_adj routine is sorting the values.
subroutine, public prg_get_origin(coords, origin)
Get the origin of the coordinates.
subroutine, public prg_collect_graph_p(rho_bml, nc, nats, hindex, chindex, graph_p, threshold, mdimin, verbose)
Collect the small graph to build the full graph.
Electronic structure type.