-
Notifications
You must be signed in to change notification settings - Fork 0
/
cofima.f
4188 lines (4130 loc) · 170 KB
/
cofima.f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
program cofima
! this program manipulates coordinate files. Usage: cofima [options] [file(s)]
! for a list of options, type "cofima --help".
use defs
use for_lammps
use for_mbpp
use for_gulp
use for_dlpoly
use misc
use postproc
use crysanpero
use transform
use mult
use convert
use cutmod
use distri
use aver
use md
use replace
use cluster
use readcoords
use writecoords
use gaussians
use madelung
use deriv
use integr
use ipol
use help
use symmetry, only : latsys
use linalg, only : quickhull, quickhull2, get_dfh, fdet3, &
& get_mateigs, rotate_matrix, polyhedral_volume, &
& matmul_fortran
implicit none
! variables for the command line options
character(len=*), parameter :: version = '3.4.0'
character(len=64) :: arg
character(len=8) :: date
character(len=10) :: time
character(len=40) :: inputfile
character(len=40) :: outputfile
character(len=40) :: fincoords
character(len=40) :: foutcoords
!character(len=40) :: finform ! format of input coordinate file
character(len=40) :: foutform ! format of output coordinate file
integer :: i ! command line argument index
! used by "convert":
character(len=256) :: convfile1 ! input filename
character(len=256) :: convfile2 ! output filename
character(len=256) :: convformat1 ! format of input file
character(len=256) :: convformat2 ! format of outputfile
! used by "transform":
integer :: nsc(1:3)
character(len=10) :: trans,transoption
character(len=20) :: matchar,vecchar,intchar
double precision matrix(1:3,1:3),shift(1:3),tol(1:3),tol1,tol2(2)
double precision inmat(1:3,1:3),outmat(1:3,1:3),outimat(1:3,1:3)
double precision invecs(1:3,1:3),outvecs(1:3,1:3)
! used by ansg2borh, bohr2angs:
double precision numinbohr,numinangs,numin,numout
! used by "av":
integer firststep, step, laststep
! used by coord:
double precision coordmean
integer coordmin,coordmax
! used by "cut":
integer axisint
double precision cuthere,hdist
character*20 cutinfile,cutoutfile,cutinform,cutoutform,abovechar,
& axischar,cutchar
! used by nicecluster:
double precision coordminpar,coordmeanpar,dipolepar ! thresholds for acceptance of a cluster (see below)
! used by "dist" and "rdf":
!integer axisint
double precision binwidth,broad,rmax,rcut
character*20 distinfile,distinform,
& distchar
! used by dipole
double precision dipole(1:3)
!used by divide:
double precision number1,number2,fnum,fnum2
! used by ecoulomb
double precision ecoul
! used by help
character*20 morehelpon
! used by lmpthermo
character lmplog*40
! used by mbppnebana and nebchain:
integer nimg
! used by "mdana":
!integer :: j,k,nsc(1:3)
character(len=10) :: bndrychar
character(len=40) :: trjfile,trjatomfile,trjformat
double precision trjbndry(1:3)
! used by traj:
integer thenumber
character thespecies*8,nnana*20,nnatom*20
double precision nndist
! used by replace
character theotherspecies*8
! used by rmeqv:
character symmformat*40
! other variables
character line*100
double precision t_start,t_end,add,angle,radius,radius0,afloat
integer intnum,intnum2,intnum3,intnum4,intnum5
integer :: j,k,iatom,step2
integer, allocatable :: intvec(:),intvec2(:),intvec3(:),intvec4(:)
logical cmdlonly,test ! command-line-only mode, test-mode
character infile*1024,infile2*1024,informat*1024,outfile*1024,
& outformat*1024,charac*1024,charac2*1024,charac3*1024
character format1*1024,format2*40,format3*40,
& filename1*1024,filename2*80,filename3*80
character thetype*20, lattice*7
!character FMT1*1024,FMT2*1024
logical isopen12 ! checks if an output file is open
type(atom), allocatable :: atoms(:),atoms2(:),atoms3(:),atoms4(:), &
& atoms5(:)
type(element), allocatable :: species(:),species2(:),species3(:),
& species4(:),species5(:)
integer natoms,natoms2,natoms3,nspecies,nspecies2
double precision vecs(1:3,1:3),vecs2(1:3,1:3),origin(1:3), &
& vector(1:3),vector2(1:3),epsil,energy
double precision charge
double precision, allocatable :: allovec1(:), allovec2(:)
double precision, allocatable :: allomat1(:,:),allomat2(:,:)
double precision, allocatable :: allomat3(:,:)
logical lnum,lnum1
c---------------------------------------------------------------------
! Initializing...
call cpu_time(t_start)
nerr=0 ! error counter
nwarn=0 ! error counter
ncomm=0 ! error counter
inputfile='INPUT.COFIMA' ! default input file
outputfile='OUTPUT.COFIMA' ! DEFAULT OUTPUT FILE
cmdlonly=.false. ! default: command-line only mode off.
talk=.true. ! default: the program talks a lot.
! print*,'***************************************************'
! print '(" * This is cofima, v ",A,
! & ". *")', version
! print*,'* *'
! print*,'* New capabilities/changes: *'
! print*,'* -compatible with gfortran since v 3.4.0 *'
! print*,'* -new option "sphere" for the cut command *'
! print*,'* -new format for coordinate files: "abinit" *'
! print*,'* (abinit output file) *'
! print*,'***************************************************'
print*,'***************************************************'
! print '(" * This is cofima, v ",A,
! & ". *")', version
! print*,'* *'
! print*,'* New capabilities/changes: see file CHANGES *'
print '(" * This is cofima, the beta version *")'
print*,'***************************************************'
! read command line options
i=1
do while (i.le.command_argument_count())
call get_command_argument(i, arg)
!print '(8x,"command: ",A128)',arg
select case (arg)
case ('--add')
! adds a number to another number
i=i+1
call get_command_argument(i,charac)
read(charac,*) number1
i=i+1
call get_command_argument(i,charac)
read(charac,*) number2
! print '(8x,"Your result: ",F)',number1+number2
!print '(8x,"Your result: ",1p,e12.3)',number1+number2
!print '(8x,"Your result: ",1p,e12.6)',number1+number2
print fnumexp,number1+number2
case("--addatoms")
! add atoms of one species
i=i+1
call get_command_argument(i,infile)
i=i+1
call get_command_argument(i,informat)
i=i+1
call get_command_argument(i,thespecies)
i=i+1
call get_command_argument(i,charac)
read(charac,*) thenumber
i=i+1
call get_command_argument(i,outfile)
allocate(allomat1(1:thenumber,1:3))
do j=1,thenumber
do k=1,3
i=i+1
call get_command_argument(i,charac)
read(charac,*) allomat1(j,k)
end do ! k=cartesian coordinate
end do ! j=atom number
call add_atoms(infile,informat,thespecies,thenumber,
& allomat1,outfile)
case("--addeqv")
! add atoms to a set of irreducible atoms by applying
! symmetries read from a file
i=i+1
call get_command_argument(i,infile)
i=i+1
call get_command_argument(i,informat)
i=i+1
call get_command_argument(i,symmformat)
i=i+1
call get_command_argument(i,outfile)
tol1=1.0D-5
do while (i+1.le.command_argument_count())
i=i+1
call get_command_argument(i,charac)
read(charac,*) tol1
end do
call addeqv(infile,informat,symmformat,outfile,tol1)
case ("--angs2bohr")
! converts between Angstrom and Bohr
i=i+1
call get_command_argument(i,charac)
read(charac,*) numinangs
numinbohr=numinangs/bohr
! print '(8x,"Your number in Bohr: ",F)',numinbohr
print '(8x,"Your number in Bohr: ",1p,e12.6)',numinbohr
case("--av")
! average lattice parameters
i=i+1
call get_command_argument(i,infile)
i=i+1
call get_command_argument(i,informat)
i=i+1
call get_command_argument(i,charac)
read(charac(1:20),*) firststep
i=i+1
call get_command_argument(i,charac)
read(charac(1:20),*) step
i=i+1
call get_command_argument(i,charac)
read(charac(1:20),*) laststep
call av(infile,informat,
& firststep,step,laststep)
case ("--bandgap")
! reads the bandgap from a DFT output file
i=i+1
call get_command_argument(i,infile)
i=i+1
call get_command_argument(i,informat)
call bandgap(infile,informat)
case ("--basis4fiesta")
! creates an auxiliary basis (el2.ion) to be read by
! fiesta, where el is an element. Input: element name,
! zetamin, zetamax, nzeta, lmax. E.g.:
! cofima --basis4fiesta He 0.8 4.0 8 2
i=i+1
call get_command_argument(i,charac)
read(charac,*) thespecies! element name
i=i+1
call get_command_argument(i,charac)
read(charac,*) number1 ! zetamin
i=i+1
call get_command_argument(i,charac)
read(charac,*) number2 ! zetamax
i=i+1
call get_command_argument(i,charac)
read(charac,*) intnum ! nzeta
i=i+1
call get_command_argument(i,charac)
read(charac,*) intnum2 ! lmax
rmax=20.0d0 ! default
intnum3=10000 ! npoints, default
do while (i+1.le.command_argument_count())
i=i+1
call get_command_argument(i,charac)
select case(charac)
case('rmax')
i=i+1
call get_command_argument(i,charac2)
read(charac2,*) rmax ! rmax
case('npoints')
i=i+1
call get_command_argument(i,charac2)
read(charac2,*) intnum3 ! npoints
case default
end select
end do
call basis4fiesta(thespecies,number1,number2,intnum,
& intnum2,rmax,intnum3)
case ("--bohr2angs")
! converts between Bohr and Angstrom
i=i+1
call get_command_argument(i,charac)
read(charac,*) numinbohr
numinangs=numinbohr*bohr
! print '(8x,"Your number in Angstrom: ",F)',numinangs
print '(8x,"Your number in Angsstrom: ",1p,e12.3)',
& numinangs
case ("--broaden")
! applies a gaussian broadening to a distribution read
! from a file
!
! filename:
i=i+1
call get_command_argument(i,infile)
!
! column with x values:
i=i+1
call get_command_argument(i,charac)
read(charac,*) intnum
!
! column with function values:
i=i+1
call get_command_argument(i,charac)
read(charac,*) intnum2
!
! periodic?:
i=i+1
call get_command_argument(i,charac)
read(charac,*) lnum
!
! periodicity length (any number will do if not
! periodic):
i=i+1
call get_command_argument(i,charac)
read(charac,*) afloat
!
! broadening to be applied:
i=i+1
call get_command_argument(i,charac)
read(charac,*) broad
!
! if present, read lcontinuous
lnum1=.false. ! continuous distribution?
if (i+1.le.command_argument_count()) then
i=i+1
call get_command_argument(i,charac)
read(charac,*) lnum1
end if
call broaden_dist(infile,intnum,intnum2,lnum, &
& afloat,broad,lnum1)
!
! case ("--broaden_continuous")
! ! applies a gaussian broadening to a distribution read
! ! from a file
! !
! ! filename:
! i=i+1
! call get_command_argument(i,infile)
! !
! ! column with x values:
! i=i+1
! call get_command_argument(i,charac)
! read(charac,*) intnum
! !
! ! column with function values:
! i=i+1
! call get_command_argument(i,charac)
! read(charac,*) intnum2
! !
! ! periodic?:
! i=i+1
! call get_command_argument(i,charac)
! read(charac,*) lnum
! !
! ! periodicity length (any number will do if not
! ! periodic):
! i=i+1
! call get_command_argument(i,charac)
! read(charac,*) afloat
! !
! ! broadening to be applied:
! i=i+1
! call get_command_argument(i,charac)
! read(charac,*) broad
! !
! call broaden_continuous_dist(infile,intnum,intnum2, &
! & lnum,afloat,broad)
case ("--broaden_lin")
! applies a gaussian broadening to a distribution read
! from a file. Broadening changes linearly
!
! filename:
i=i+1
call get_command_argument(i,infile)
!
! column with x values:
i=i+1
call get_command_argument(i,charac)
read(charac,*) intnum
!
! column with function values:
i=i+1
call get_command_argument(i,charac)
read(charac,*) intnum2
!
! periodic?:
i=i+1
call get_command_argument(i,charac)
read(charac,*) lnum
!
! periodicity length (any number will do if not
! periodic):
i=i+1
call get_command_argument(i,charac)
read(charac,*) afloat
!
! broadening to be applied:
i=i+1
call get_command_argument(i,charac)
read(charac,*) broad
i=i+1
call get_command_argument(i,charac)
read(charac,*) fnum
!
! if present, read lcontinuous
lnum1=.false. ! continuous distribution?
if (i+1.le.command_argument_count()) then
i=i+1
call get_command_argument(i,charac)
read(charac,*) lnum1
end if
call broaden_lin_dist(infile,intnum,intnum2,lnum, &
& afloat,broad,fnum,lnum1)
! case ("--broaden_lin_continuous")
! ! applies a gaussian broadening to a continuous distribution read
! ! from a file. Broadening changes linearly
! !
! ! filename:
! i=i+1
! call get_command_argument(i,infile)
! !
! ! column with x values:
! i=i+1
! call get_command_argument(i,charac)
! read(charac,*) intnum
! !
! ! column with function values:
! i=i+1
! call get_command_argument(i,charac)
! read(charac,*) intnum2
! !
! ! periodic?:
! i=i+1
! call get_command_argument(i,charac)
! read(charac,*) lnum
! !
! ! periodicity length (any number will do if not
! ! periodic):
! i=i+1
! call get_command_argument(i,charac)
! read(charac,*) afloat
! !
! ! broadening to be applied:
! i=i+1
! call get_command_argument(i,charac)
! read(charac,*) broad
! i=i+1
! call get_command_argument(i,charac)
! read(charac,*) fnum
! !
! call broaden_lin_continuous_dist(infile,intnum,intnum2, &
! & lnum, afloat,broad,fnum)
! !
! !
case ("--broaden_quad")
! applies a gaussian broadening to a distribution read
! from a file. Broadening changes quadratically
!
! filename:
i=i+1
call get_command_argument(i,infile)
!
! column with x values:
i=i+1
call get_command_argument(i,charac)
read(charac,*) intnum
!
! column with function values:
i=i+1
call get_command_argument(i,charac)
read(charac,*) intnum2
!
! periodic?:
i=i+1
call get_command_argument(i,charac)
read(charac,*) lnum
!
! periodicity length (any number will do if not
! periodic):
i=i+1
call get_command_argument(i,charac)
read(charac,*) afloat
!
! broadening to be applied:
i=i+1
call get_command_argument(i,charac)
read(charac,*) broad
i=i+1
call get_command_argument(i,charac)
read(charac,*) fnum
!
! if present, read lcontinuous
lnum1=.false. ! continuous distribution?
if (i+1.le.command_argument_count()) then
i=i+1
call get_command_argument(i,charac)
read(charac,*) lnum1
end if
!
call broaden_quad_dist(infile,intnum, &
& intnum2,lnum, afloat,broad,fnum,lnum1)
!
!
case ("--cageZnO")
! creates a cage-like cluster of n ZnO units. n is read from the command line
i=i+1
call get_command_argument(i,charac)
read(charac,*) intnum
call cageZnO(intnum)
case ('--cmdlonly')
cmdlonly=.true.
case ('--com','--COM')
! calculate the Center Of the Molecule
i=i+1
call get_command_argument(i,infile)
i=i+1
call get_command_argument(i,informat)
call get_com(infile,informat)
case ('--comass','--COMASS')
! calculate the Center Of Mass
i=i+1
call get_command_argument(i,infile)
i=i+1
call get_command_argument(i,informat)
call get_comass(infile,informat)
case ('--compare','--overlaps')
! compare two 1d fields by calculating their overlap
! Ov=<f1|f2> / (|f1| * |f2| )
i=i+1
call get_command_argument(i,filename1)
i=i+1
call get_command_argument(i,filename2)
call compare(filename1,filename2)
case ('--convert')
i=i+1
call get_command_argument(i,convfile1)
i=i+1
call get_command_argument(i, convfile2)
i=i+1
call get_command_argument(i,convformat1)
i=i+1
call get_command_argument(i, convformat2)
if(talk) print '(8x,"File ",A," will be converted to file ", &
& A,".")',trim(convfile1),trim(convfile2)
! fake lattice vectors in case they are not included in the
! input coordinate file
vecs=0.0D0
vecs(1,1)=1.0D0
vecs(2,2)=1.0D0
vecs(3,3)=1.0D0
! read lattice vectors, if needed
select case(convformat1)
case("coorat","COORAT",'nwchem','NWCHEM','xyz','XYZ')
if (i+9.le.command_argument_count()) then
do j=1,3
i=i+1
call get_command_argument(i,vecchar)
read(vecchar(1:20),*)vecs(j,1)
i=i+1
call get_command_argument(i,vecchar)
read(vecchar(1:20),*)vecs(j,2)
i=i+1
call get_command_argument(i,vecchar)
read(vecchar(1:20),*)vecs(j,3)
end do
else
ncomm=ncomm+1
print fcomm, "Missing lattice vectors. The final coordin &
&ates may be wrong"
end if
case default
end select
call conv(convfile1,convfile2,convformat1,
& convformat2,vecs)
case ('--coord')
! determine the coordination numbers of the atoms in a file
! and print min, max, av
i=i+1
call get_command_argument(i,infile)
i=i+1
call get_command_argument(i, informat)
vecs=vecs_def
! read lattice vectors, if needed
select case(informat)
case("coorat","COORAT",'nwchem','NWCHEM','xyz','XYZ')
if (i+9.le.command_argument_count()) then
do j=1,3
i=i+1
call get_command_argument(i,vecchar)
read(vecchar(1:20),*)vecs(j,1)
i=i+1
call get_command_argument(i,vecchar)
read(vecchar(1:20),*)vecs(j,2)
i=i+1
call get_command_argument(i,vecchar)
read(vecchar(1:20),*)vecs(j,3)
end do
else
call error_stop('Please provide lattice vectors after fo &
&rmat, or use a format that contains lattice vectors')
end if
case default
end select
nndist=nndist_def
if (i+1.lt.command_argument_count()) then
i=i+1
call get_command_argument(i,charac)
select case(charac)
case('-cutoff')
i=i+1
call get_command_argument(i,charac)
read(charac,*) nndist
case default
call error_stop('unknown option')
end select
!
end if ! i+1.lt.command_argument_count()
call read_coords(infile,informat,atoms,natoms,species,
& nspecies,vecs)
call coord(atoms,vecs,nndist,coordmin,coordmax,
& coordmean)
print '(8x,"min, max, av coord. num.: ",2(I6),F10.6)',
& coordmin,coordmax,coordmean
open(51,file="COORDINATION",status='replace')
do iatom=1,size(atoms)
write(51,*) atoms(iatom)%name,atoms(iatom)%coord
end do ! iatom
close(51)
open(51,file="COORDINATION_DETAILED",status='replace')
do iatom=1,size(atoms)
if (1.lt.atoms(iatom)%coord) then
write(51,*) atoms(iatom)%name,atoms(iatom)%coord, &
& (atoms(iatom)%neighbors(j),' ',j=1,atoms(iatom)%coord), &
& (atoms(iatom)%bondlengths(j),' ',j=1,atoms(iatom)%coord), &
& size(atoms(iatom)%bondangles), &
& (atoms(iatom)%bondangles(j),' ',j=1, &
& size(atoms(iatom)%bondangles))
else
if (1.eq.atoms(iatom)%coord) then
write(51,*) atoms(iatom)%name,atoms(iatom)%coord, &
& (atoms(iatom)%neighbors(j),' ',j=1,atoms(iatom)%coord), &
& (atoms(iatom)%bondlengths(j),' ',j=1,atoms(iatom)%coord)
else
write(51,*) atoms(iatom)%name,atoms(iatom)%coord
end if
end if
end do ! iatom
close(51)
! begin print coordinates of neighbors
open(51,file="COORDINATION_NEIGHBOR_COORDS", &
& status='replace')
do iatom=1,natoms
if (1.lt.atoms(iatom)%coord) then
write(51,*) atoms(iatom)%name,atoms(iatom)%where, &
& atoms(iatom)%abswhere,atoms(iatom)%coord, &
& (atoms(iatom)%neighbors(j),' ',j=1,atoms(iatom)%coord), &
& (atoms(iatom)%neighborcoords(j,1:3),' ', &
& j=1,atoms(iatom)%coord)
else
if (1.eq.atoms(iatom)%coord) then
write(51,*) atoms(iatom)%name,atoms(iatom)%where, &
& atoms(iatom)%abswhere,atoms(iatom)%coord, &
& (atoms(iatom)%neighbors(j),' ',j=1,atoms(iatom)%coord), &
& (atoms(iatom)%neighborcoords(j,1:3),' ', &
& j=1,atoms(iatom)%coord)
else
write(51,*) atoms(iatom)%name,atoms(iatom)%coord
end if
end if
end do ! iatom
close(51)
! end print coordinates of neighbors
case('--corr0')
i=i+1
call get_command_argument(i,infile)
i=i+1
call get_command_argument(i,thespecies)
i=i+1
call get_command_argument(i,charac)
read(charac,*) thenumber
i=i+1
call get_command_argument(i,thetype)
i=i+1
call get_command_argument(i,charac)
read(charac,*) rmax
binwidth=0.2D0
if (i+1.le.command_argument_count()) then
i=i+1
call get_command_argument(i,charac)
read(charac,*) binwidth
end if
call propcorr0(infile,thespecies,thenumber,thetype,
& rmax,binwidth)
case('--corr')
i=i+1
call get_command_argument(i,infile)
i=i+1
call get_command_argument(i,thespecies)
i=i+1
call get_command_argument(i,charac)
read(charac,*) thenumber
i=i+1
call get_command_argument(i,thetype)
i=i+1
call get_command_argument(i,charac)
read(charac,*) rcut
! read an additive constant (optional) to be added to
! the property that interests you
add=0.0D0
if (i+1.le.command_argument_count()) then
i=i+1
call get_command_argument(i,charac)
if (charac.eq."add") then
i=i+1
call get_command_argument(i,charac)
read(charac,*) add
else
i=i-1
end if
end if
! read binwidth, maximum distance for which the
! correlation function is calculated, and the gaussian
! broadening (optional)
binwidth=0.2D0
rmax=20.0D0
broad=0.2D0
if (i+1.le.command_argument_count()) then
i=i+1
call get_command_argument(i,charac)
read(charac,*) binwidth
end if
if (i+1.le.command_argument_count()) then
i=i+1
call get_command_argument(i,charac)
read(charac,*) rmax
end if
if (i+1.le.command_argument_count()) then
i=i+1
call get_command_argument(i,charac)
read(charac,*) broad
end if
call propcorr(infile,thespecies,thenumber,thetype,
& rcut,add,binwidth,rmax,broad)
case('--create_neb_chain')
! read two coordinate files with starting and end
! coordinates and create linearly interpolated chain of
! coordinates
i=i+1
call get_command_argument(i,filename1)
i=i+1
call get_command_argument(i,filename2)
i=i+1
call get_command_argument(i,format1)
nimg=10 ! default
if (i+1.le.command_argument_count()) then
i=i+1
call get_command_argument(i,charac)
read(charac,*) nimg
end if
if(talk) print '(8x,"NEB chain with ",I0, "images will &
&be created between files ",A," and ",A)',nimg,trim(filename1), &
& trim(filename2)
! fake lattice vectors in case they are not included in the
! input coordinate file
vecs=0.0D0
vecs(1,1)=1.0D0
vecs(2,2)=1.0D0
vecs(3,3)=1.0D0
vecs2=0.0D0
vecs2(1,1)=1.0D0
vecs2(2,2)=1.0D0
vecs2(3,3)=1.0D0
! read lattice vectors, if needed
select case(format1)
case("coorat","COORAT",'nwchem','NWCHEM','xyz','XYZ')
if (i+18.le.command_argument_count()) then
do j=1,3
i=i+1
call get_command_argument(i,vecchar)
read(vecchar(1:20),*)vecs(j,1)
i=i+1
call get_command_argument(i,vecchar)
read(vecchar(1:20),*)vecs(j,2)
i=i+1
call get_command_argument(i,vecchar)
read(vecchar(1:20),*)vecs(j,3)
end do
do j=1,3
i=i+1
call get_command_argument(i,vecchar)
read(vecchar(1:20),*)vecs2(j,1)
i=i+1
call get_command_argument(i,vecchar)
read(vecchar(1:20),*)vecs2(j,2)
i=i+1
call get_command_argument(i,vecchar)
read(vecchar(1:20),*)vecs2(j,3)
end do
else
ncomm=ncomm+1
print fcomm, "Missing lattice vectors. The final co &
&ordinates may be wrong"
end if
case default
end select
call create_neb_chain(filename1,filename2,format1,vecs, &
& vecs2,nimg)
case ("--cross_product")
! calculates the cross product of two 3D vectors
do j=1,3
i=i+1
call get_command_argument(i,charac)
read(charac,*) vector(j)
end do
do j=1,3
i=i+1
call get_command_argument(i,charac)
read(charac,*) vector2(j)
end do
print '(8x,"cross product= ",3(F15.9,x))', &
& cross_product(vector,vector2)
case ('--crysanpero')
call scrysanpero()
case("--cut")
! remove atoms above/below x/y/z=number
! or inside/outside a sphere
i=i+1
call get_command_argument(i,infile)
i=i+1
call get_command_argument(i,outfile)
i=i+1
call get_command_argument(i,cutinform)
i=i+1
call get_command_argument(i,cutoutform)
i=i+1
call get_command_argument(i,abovechar)
i=i+1
call get_command_argument(i,axischar)
i=i+1
read(axischar(1:20),*) axisint
call get_command_argument(i,cutchar)
read(cutchar(1:20),*) cuthere
if(abovechar.eq."sphere".or.abovechar.eq.'SPHERE'.or. &
& abovechar.eq."plane".or.abovechar.eq."PLANE".or. &
& abovechar.eq."dirplane".or.abovechar.eq."DIRPLANE".or. &
& abovechar.eq."hklplane".or.abovechar.eq."HKLPLANE") &
& then
i=i+1
call get_command_argument(i,cutchar)
read(cutchar(1:20),*) shift(1)
i=i+1
call get_command_argument(i,cutchar)
read(cutchar(1:20),*) shift(2)
i=i+1
call get_command_argument(i,cutchar)
read(cutchar(1:20),*) shift(3)
end if
! nearest neighbor distance (used for hydrogenation)
!nndist=3.0d0 ! default value in Angstrom
nndist=nndist_def ! default value in Angstrom
if (i+1.le.command_argument_count()) then
i=i+1
call get_command_argument(i,charac)
read(charac,*) nndist
end if
! distance along broken in which to place H
!hdist=1.25d0 ! default: 1.25 Angstrom
hdist=hdist_def ! default: 1.25 Angstrom
if (i+1.le.command_argument_count()) then
i=i+1
call get_command_argument(i,charac)
read(charac,*) hdist
end if
if (i+1.le.command_argument_count()) then
i=i+1
call get_command_argument(i,charac)
select case(charac)
case('-hydr')
lnum=.true.
case default
end select
end if
if(talk)
& print '(4x,"Using as H-bond length:",F10.6)', hdist
call cut(infile,outfile,cutinform,cutoutform,
& abovechar,axisint,cuthere,shift,nndist,hdist,lnum)
case ('--dfh','--DFH')
! calculate distance from hull
!
! read dimension:
i=i+1
call get_command_argument(i,charac)
read(charac,*) k
!
! read point:
if (allocated(allovec1)) deallocate(allovec1)
allocate(allovec1(k))
do j=1,k
i=i+1
call get_command_argument(i,charac)
read(charac,*) allovec1(j)
end do
!
! read direction:
if (allocated(allovec2)) deallocate(allovec2)
allocate(allovec2(k))
do j=1,k
i=i+1
call get_command_argument(i,charac)
read(charac,*) allovec2(j)
end do
!
call get_dfh(k,allovec1,allovec2)
!
do while (i+1.le.command_argument_count())
i=i+1
ncomm=ncomm+1
print fcomm,'addit. comm. line options found and ignored'
end do
!
case ('--diffatoms')
! determine which atoms are common and which differ between
! two files
i=i+1
call get_command_argument(i,infile)
i=i+1
call get_command_argument(i,infile2)
i=i+1
call get_command_argument(i, informat)
vecs=vecs_def
! read lattice vectors, if needed
select case(informat)
case("coorat","COORAT",'nwchem','NWCHEM','xyz','XYZ')
if (i+9.le.command_argument_count()) then
do j=1,3
i=i+1
call get_command_argument(i,vecchar)
read(vecchar(1:20),*)vecs(j,1)
i=i+1
call get_command_argument(i,vecchar)
read(vecchar(1:20),*)vecs(j,2)
i=i+1
call get_command_argument(i,vecchar)
read(vecchar(1:20),*)vecs(j,3)
end do
else
nwarn=nwarn+1
print fwarn, "Missing lattice vectors. The final
& coordinates may be wrong."
end if
case default
end select
! tolerance for "equal" positions
tol1=0.01d0
if (i+2.le.command_argument_count()) then
i=i+1
call get_command_argument(i,charac)
select case (charac)
case ("-tol")
i=i+1
call get_command_argument(i,charac)
read(charac,*) tol1
case default
end select
end if