-
Notifications
You must be signed in to change notification settings - Fork 0
/
program p3amph:NaCl
1278 lines (1145 loc) · 31.5 KB
/
program p3amph:NaCl
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 p3amph/NaCl
c ************************************************************************
c Unit cell of a polythiophene amphiphile 3-substituted on the upper side
c with an alkyl and on the lower side with a -(CH2-CH2-O-)n- oxanoyl chain.
c A slab of water molecules is created, and positioned so that the oxanoyl
c side chains and the polythiophene rings are 'submerged' in the water,
c but the alkyl chains are extended away from the water surface.
c Convert some water molecules into Na+ and Cl- ions. The salt concentration
c is decided by specifying a minimum distance between ions. The smaller
c this distance, the greater the concentration of the NaCl.
c The bithiophene repeat unit for the octyl and pentaoxanoyl substituted
c polymer contains 70 atoms.
c ************************************************************************
character title*20,line*80,atom1*2,atom2*2
character*12 plf,glpf,dlpf
character*1 aplt,agulp,hand,ator,aq,aris,adop,a1,actff
character*4 at,ata,ad,adp,atd0,atd,tempa,ae,at1,aw,asoln
character*2 w,u
dimension c1(9999,3),q1(9999),at1(9999)
common/rarrays/ c(9999,3),ca(100,3),ce(100,3),cw(19999,3),
1 label(19999)
common/aarrays/ at(9999),ata(100),ae(100),aw(19999)
common/iscalars/ nc,naa,ntbnds,nscats,ncells,nalks,nae,naw,nlr,
1 nna,nnb,mma,mmb,nmw
common/rscalars/ pi,raddeg,degrad,tau,th,scp,alayer,depth,surf,
1 bed,dens
common/char/ title
common/blockdat/ bb,x,z
pi=4.0*atan(1.0)
raddeg=180.0/pi
degrad=pi/180.0
disc=1d-5
iscell=1
nna=1
nnb=1
nnc=1
c Molecular geometry:
c Kitaigorodsky, Molecular Crystals & Molecules (AP 1973).
rcc=1.535
rch=1.1
theta1=112.2*degrad
theta2=106.3*degrad
theta3=107.7*degrad
th1=theta1/2.0
th2=theta2/2.0
th3=theta3/2.0
12 na=14
c
open(8,file='pol_coords',status='unknown')
open(9,file='c.dat',status='unknown')
open(10,file='mol_data',status='unknown')
open(11,file='water.dat',status='unknown')
open(12,file='s.dat',status='unknown')
open(13,file='config',status='unknown')
open(14,file='test',status='unknown')
1 write(*,2000)nc
write(10,2000)nc
c Initially the polymer main chain is along z and the sidechains
c are constructed in the xz plane. Main chain stacking is along b.
c Generate the alkyl chain in the z direction ...
call alkyl
c ... and attach it to position 3 of the dithiophene unit.
do iaa=1,naa
ii=na+iaa
do j=1,3
c(ii,j)=ca(iaa,j)+c(3,j)
enddo
at(ii)=ata(iaa)
enddo
nii=ii
c Calculate the angle (ph) through which the alkyl chain is to be rotated,
z0=c(7,3)-c(3,3)
x0=c(7,1)-c(3,1)
angle0=atan(x0/z0)
z1=c(na+1,3)-c(3,3)
x1=c(na+1,1)-c(3,1)
angle1=atan(x1/z1)
ph=angle1-angle0
c ... and rotate through ph.
do iaa=1,naa
ii=na+iaa
cx=c(ii,1)-c(3,1)
cz=c(ii,3)-c(3,3)
call rot1(cz,cx,-ph)
c(ii,1)=cx+c(3,1)
c(ii,3)=cz+c(3,3)
enddo
c Attach the oxanoyl chain to position 10 of the dithiophene unit ...
call oxanoyl
do iaa=1,nae
ce(iaa,1)=-ce(iaa,1)
ii=nii+iaa
do j=1,3
c(ii,j)=ce(iaa,j)+c(10,j)
enddo
at(ii)=ae(iaa)
enddo
niii=ii
nat=niii-2
c ... and rotate it.
do iaa=1,nae
ii=nii+iaa
cx=c(ii,1)-c(10,1)
cz=c(ii,3)-c(10,3)
call rot1(cz,cx,+ph)
c(ii,1)=cx+c(10,1)
c(ii,3)=cz+c(10,3)
enddo
c Eliminate the H atoms originally at positions 3 and 10 (atoms 7 & 13).
do i=7,12
do j=1,3
c(i,j)=c(i+1,j)
enddo
at(i)=at(i+1)
enddo
do i=13,nat
do j=1,3
c(i,j)=c(i+2,j)
enddo
at(i)=at(i+2)
enddo
na=na-2
c Orient the polymer chain with the alkyl chains up and the oxanoyl
c chains down.
do i=1,nat
c(i,1)=-c(i,1)
enddo
c Repeat distance along polymer main chain
czz=c(7,3)-c(4,3)
cc=c(10,3)-c(1,3)+czz
c At this point,
c nc = no. of C atoms in alkyl side-chain.
c na = no. of atoms in each of the 2-ring pth C4SH-C4SH segments
c in the unit cell (not including the side-chains).
c naa = no. of atoms in alkyl side-chain CnH2n+1.
c nae = no. of atoms in oxanoyl side-chain.
c nat = total no. of polymer atoms in chain within the unit cell.
c [nat = na + naa+nae].
write(*,2010)nc,naa,nae,nat
write(10,2010)nc,naa,nae,nat
c Apply 180 degree torsions to make cis CH2-CH2 segments in the oxanoyl bonds.
phi=180.0
call rot(9,12+naa+1,12+naa+2,nat,phi)
c Suppress the next 6 lines if the oxanoyl chains are to be all trans.
c n1=12+naa+5
c n2=nat-7
c do i=n1,n2,7
c phi=172.0
c call rot(i,i+3,i+4,nat,phi)
c enddo
c Reassign cartesian components so that the main polymer chain is
c along x, the sidechains (if fully extended) approximately along
c z and the polymer main chain is stacked along y. This means
c interchanging x and z.
do i=1,nat
ct3=c(i,1)
ct1=c(i,3)
c(i,3)=ct3
c(i,1)=ct1
enddo
aa=cc
c Renumber the atoms so that the numbers of each side chain starts
c immediately after the last atom of the thiophene ring to which
c it is attached.
c Ring 1
do i=1,6
do j=1,3
c1(i,j)=c(i,j)
enddo
at1(i)=at(i)
enddo
c Alkyl chain
do i=1,naa
do j=1,3
c1(6+i,j)=c(12+i,j)
enddo
at1(6+i)=at(12+i)
enddo
c Ring 2
do i=1,6
do j=1,3
c1(6+naa+i,j)=c(6+i,j)
enddo
at1(6+naa+i)=at(6+i)
enddo
c Ether chain
do i=12+naa+1,nat
do j=1,3
c1(i,j)=c(i,j)
enddo
at1(i)=at(i)
enddo
do i=1,nat
do j=1,3
c(i,j)=c1(i,j)
enddo
at(i)=at1(i)
enddo
c Shift origin of z axis to the position of the upper set of S atoms
z0=c(6+naa+5,3)
do i=1,nat
c(i,3)=c(i,3)-z0
enddo
c Height of alkyl chains and depth of oxanoyl chains
hmx=c(1,3)
dmx=c(1,3)
do i=1,nat
if(((at(i).eq.'C3').or.(at(i).eq.'H3')).
1 and.(c(i,3).gt.hmx))hmx=c(i,3)
if((at(i).eq.'H4').and.(c(i,3).lt.dmx))dmx=c(i,3)
enddo
c Overall thickness of monolayer
tmn=c(1,3)
tmx=c(1,3)
do i=1,nat
if(c(i,3).lt.tmn)tmn=c(i,3)
if(c(i,3).gt.tmx)tmx=c(i,3)
enddo
thkns=tmx-tmn
c Supercell formation
c nna=4
c nnb=4
nna=6
nnb=6
k=nat
npatc=nat*nna
nchc=2*nnb
write(*,2040)aa,bb,2*nat*nna*nnb
write(10,2040)aa,bb,2*nat*nna*nnb
do ia=1,nna-1
do i=1,nat
k=k+1
c(k,1)=c(i,1)+ia*aa
c(k,2)=c(i,2)
c(k,3)=c(i,3)
at(k)=at(i)
enddo
enddo
nat=k
do ib=1,nnb-1
do i=1,nat
k=k+1
c(k,1)=c(i,1)
c(k,2)=c(i,2)+ib*bb
c(k,3)=c(i,3)
at(k)=at(i)
enddo
enddo
nat=k
c Create another chain at y=b/2 displaced by a/2 along a.
do i=1,nat
c(i+nat,1)=c(i,1)+0.5*aa
c(i+nat,2)=c(i,2)+0.5*bb
c(i+nat,3)=c(i,3)
at(i+nat)=at(i)
enddo
nscats=2*nat
c Keep the dimension of the basic cell as scp, the square cell parameter
c to be used to construct the water slab in subr. water.
scp=aa
aa=nna*aa
bb=nnb*bb
cc=90.0 ! dummy lattice vector along z
call water
c print*
if(3*(naw/3).ne.naw)then
print*,'No. of atoms in water layer = ',k
print*,'Not a multiple of 3. STOP.'
stop
endif
c Extent of monolayer/water system along c axis
zmax=0.0
do i=1,nscats
if(c(i,3).gt.zmax)zmax=c(i,3)
enddo
zmin=0.0
do i=1,nscats
if(cw(i,3).lt.zmin)zmin=cw(i,3)
enddo
cc1=zmax-zmin
nats=nscats+naw
write(*,2020)nna,nnb,mma,mmb,thkns,hmx,dmx,aa,bb,cc,dens,cc1,nscats
1 ,nmw,naw,nats
write(10,2020)nna,nnb,mma,mmb,thkns,hmx,dmx,aa,bb,cc,dens,cc1,nscats
1 ,nmw,naw,nats
c Loop through the atoms of the polymer and solvent sublattices. If any
c atom-pair separation between water and polymer is less than a declared
c distance, eliminate the offending water molecule.
k=0
elpar=0.5
iel=0
do iw=1,nmw
do i3=1,3
ia=(iw-1)*3+i3
a1=aw(ia)
if(a1.eq.'H')riw=0.5
if(a1.eq.'O')riw=1.0
do ip=1,nscats
a1=at(ip)
if(a1.eq.'H')rip=0.5
if(a1.eq.'C')rip=1.0
if(a1.eq.'S')rip=1.0
disc=riw+rip+elpar
r2=0.0
do j=1,3
r2=r2+(cw(ia,j)-c(ip,j))**2
enddo
s2p=(cw(ia,1)-c(ip,1)-aa)**2
s2m=(cw(ia,1)-c(ip,1)+aa)**2
do j=2,3
s2p=s2p+(cw(ia,j)-c(ip,j))**2
s2m=s2m+(cw(ia,j)-c(ip,j))**2
enddo
t2=(cw(ia,1)-c(ip,1))**2
t2=t2+(cw(ia,3)-c(ip,3))**2
t2p=t2+(cw(ia,2)-c(ip,2)-bb)**2
t2m=t2+(cw(ia,2)-c(ip,2)+bb)**2
r2=sqrt(r2)
s2p=sqrt(s2p)
s2m=sqrt(s2m)
t2p=sqrt(t2p)
t2m=sqrt(t2m)
if((r2.lt.disc).or.(s2p.lt.disc).or.(s2m.lt.disc)
1 .or.(t2p.lt.disc).or.(t2m.lt.disc))then
iel=iel+1
goto 50
endif
enddo ! ip
enddo ! i3
do ia=1,3
ii=(iw-1)*3+ia
k=k+1
do j=1,3
cw(k,j)=cw(ii,j)
enddo
aw(k)=aw(ii)
enddo
50 continue
enddo ! iw
naw=k
if(3*(naw/3).ne.naw)then
print*,'New no. of atoms in water layer = ',naw
print*,'This is not a multiple of 3. STOP.'
stop
endif
nmw=naw/3
nats=nscats+naw
write(*,2050)iel
write(10,2050)iel
c Extent of monolayer/water system along c axis
zmax=0.0
do i=1,nscats
if(c(i,3).gt.zmax)zmax=c(i,3)
enddo
zmin=0.0
do i=1,nscats
if(cw(i,3).lt.zmin)zmin=cw(i,3)
enddo
cc1=zmax-zmin
write(*,2021)nmw,naw,nats
write(10,2021)nmw,naw,nats
c Convert some water molecules into Na+ and Cl- ions. The salt concentration
c is decided by specifying a minimum distance between ions. The smaller
c this distance, the greater the concentration of the NaCl.
c
c First label with 'Z' the 1st atom in each H2O molecule which
c cannot be converted.
c goto 120
rmin=6.75
c print*
c print*,'Minimum distance between ions?'
c read*,rmin
do i=1,nmw
k1=(i-1)*3+1
if(aw(k1).eq.'Z')goto 70
do j=1,nmw
if(i.eq.j) goto 60
k2=(j-1)*3+1
if(aw(k2).eq.'Z')goto 60
rr=dist(k1,k2)
c if((rr.lt.rmin).or.(cw(k2,3).lt.dmx-3.0))then
if(rr.lt.rmin)then
aw(k2)='Z'
endif
60 continue
enddo
70 continue
enddo
c Then turn the rest into 'Na' or 'Cl' and restore the 'Z' to 'OW'
nion=0
np=0
nm=0
nx=0
do i=1,nmw
k=3*i-2
if(aw(k).eq.'Z')then
aw(k)='OW'
else
nion=nion+1
aw(k+1)='X'
aw(k+2)='X'
nx=nx+2
if(2*(nion/2).eq.nion)then
aw(k)='Na'
np=np+1
kp=k
else
aw(k)='Cl'
nm=nm+1
km=k
endif
endif
enddo
nion=np+nm
nmw=nmw-nion
c The no. (nmw) of water molecules is less than before. The rest (nion)
c have been turned into ions.
write(*,2030)rmin,np,nm,nion
write(10,2030)rmin,np,nm,nion
if(abs(np-nm).eq.1)then
print*
print*,'One ion will be deleted to equalize ion numbers'
elseif(abs(np-nm).gt.1)then
print*
print*,'ERROR: Charge difference exceeds unity'
stop
endif
c Eliminate 'X' atoms
ielm=0
k=0
do i=1,naw
80 k=k+1
if(aw(k).ne.'X')then
aw(i)=aw(k)
do j=1,3
cw(i,j)=cw(k,j)
enddo
else
ielm=ielm+1
goto 80
endif
enddo
naw=naw-nion*2
c 'naw' is currently the no. of atoms in the aqueous layer including
c the ions.
c Copy the 'Na' and 'Cl' atoms so they appear directly after the H2O list.
np=0
do i=1,naw
if(aw(i).eq.'Na')then
np=np+1
aw(naw+np)=aw(i)
do j=1,3
cw(naw+np,j)=cw(i,j)
enddo
endif
enddo
nm=0
do i=1,naw
if(aw(i).eq.'Cl')then
nm=nm+1
aw(naw+np+nm)=aw(i)
do j=1,3
cw(naw+np+nm,j)=cw(i,j)
enddo
endif
enddo
nnn=naw+np+nm
c Delete the 'Na' and 'Cl' atoms from their former positions in the H2O list
nion2=0
k=1
do i=1,naw
if((aw(i).eq.'Na').or.(aw(i).eq.'Cl'))then
nion2=nion2+1
goto 90
else
aw(k)=aw(i)
do j=1,3
cw(k,j)=cw(i,j)
enddo
endif
k=k+1
90 continue
enddo
if(nion2.ne.nion)then
print*,'ERROR: nion2 is not equal to nion'
stop
endif
naw=k-1
c naw is now the actual number of water molecules.
do i=1,nion
aw(naw+i)=aw(naw+nion+i)
do j=1,3
cw(naw+i,j)=cw(naw+i+nion,j)
enddo
k=naw+i
enddo
c do i=1,naw+nion
c write(14,2214)i,aw(i),(cw(i,j),j=1,3)
c enddo
c Address any inequality of positive and negative ion numbers.
if(np.eq.nm+1)then
do i=naw+np,naw+nion
aw(i)=aw(i+1)
do j=1,3
cw(i,j)=cw(i+1,j)
enddo
enddo
nion=nion-1
np=np-1
endif
if(np.eq.nm-1)then
nm=nm-1
nion=nion-1
endif
do i=1,naw+nion
write(14,2214)i,aw(i),(cw(i,j),j=1,3)
enddo
c Molarity of stmol moles NaCl in 55.5084 moles (1 litre) H2O = stmol
c Molarity of smxtmol moles NaCl in svmol moles H2O = stmol*55.5084/svmol
stmol=float(nion/2) ! No. of mols of NaCl
svmol=float(nmw) ! No. of mols of H2O
frmol=stmol/svmol ! Mol fraction
cmoly=stmol*55.5084/svmol
write(*,2070)nmw, nion/2,frmol,cmoly
write(10,2070)nmw, nion/2,frmol,cmoly
c Create a charge imbalance between the polymer and water layers.
print*
print*,'There are ',np,' Na+ ions and ',nm,' Cl- ions in the '
x ,'water layer.'
print*,'Create a charge imbalance in the water layer.'
c print*,'naw+np, aw(naw+np):',naw+np, aw(naw+np)
c print*,'naw+np+1, aw(naw+np)+1:',naw+np+1, aw(naw+np+1)
print*
print*,'How many Cl- ions are to be converted into Na+ ions?'
read*,mm
do i=1,mm
aw(naw+np+i)='Na'
enddo
np=np+mm
nm=nm-mm
naw=naw+nion
c naw is again the total no. of atoms in water layer
c write(14,1234)naw
c do i=1,naw
c write(14,2214)i,aw(i),(cw(i,j),j=1,3)
c enddo
fi=100.0*abs(np-nm)/abs(np+nm)
write(10,2090)nchc,npatc,nmw,np,nm,fi
write(*,2090)nchc,npatc,nmw,np,nm,fi
c Write out an input (CONFIG) file for DL_POLY.
120 write(13,2140)nna,nnb,nnc,nc,nats,aa,bb,cc
do i=1,nscats
a1=at(i)
if(a1.ne.'O')then
write(13,2175)at(i),i
else
write(13,2173)at(i),i
endif
write(13,2174)(c(i,j),j=1,3)
enddo
do i=1,naw
write(13,2173)aw(i),i
write(13,2174)(cw(i,j),j=1,3)
enddo
c For SCHAKAL
write(12,2202)nna,nnb,nnc,nats,aa,cc,bb
write(9,2201)
nsch=0
do i=1,nscats
write(12,2212)at(i),c(i,1)/aa,c(i,3)/cc,c(i,2)/bb
write(9,2212)at(i),c(i,1),c(i,3),c(i,2)
nsch=nsch+1
enddo
do i=1,naw
asoln=aw(i)
if(asoln.eq.'OW')asoln='O'
if(asoln.eq.'HW')asoln='H'
c write(12,2212)asoln,cw(i,1)/aa,cw(i,2)/bb,cw(i,3)/cc
write(12,2212)asoln,cw(i,1)/aa,cw(i,3)/cc,cw(i,2)/bb
write(9,2212)asoln,cw(i,1),cw(i,3),cw(i,2)
nsch=nsch+1
enddo
write(12,2213)
write(9,2213)
write(*,2060)
1030 format(a1)
1000 format(a20)
1010 format(a12)
1020 format(a4,4f11.0)
1234 format(/'After charge imbalance. Total no. atoms naw =',i6)
1235 format(/'After purging. Total no. atoms naw =',i6)
1236 format(/'After charge creation. Before imbalance'
x /'Total no. atoms inc ions naw =',i6)
2000 format( /15x,'*******************************************'
x /15x,'Generation of the atoms in the unit cell of'
x /15x,'a poly(3-alkyl, 3-pentaoxanoylthiophene)'
x /15x,'monolayer on a water surface'
x /15x,'*******************************************'/
x /'Unit cell of polythiophene containing two kinds of side-'
x /'chain in ring position 3. Alkyl (up) and pentaoxanoyl (down)'
x /'groups alternate between the rings along the main chain.'
x /'In this calculation each alkyl group has ',i2,' carbon atoms.')
2010 format(/'No. of C atoms in alkyl chain =',i3/
1 'No. of atoms in alkyl chain =',i3/
2 'No. of atoms in oxanoyl chain =',i3/
3 'No. atoms in bith. repeat unit =',i3)
2020 format(/'Before water elimination'
x /i2,' x',i2,' monolayer supercell'
x /i2,' x',i2,' water supercell'
x /10x,'Thickness of monolayer =',f9.4
x /10x,'Max. height of monolayer =',f9.4
x /10x,'Max. depth of monolayer =',f9.4
x /10x,'a (polymer direction) =',f9.4
x /10x,'b (stacking direction) =',f9.4
x /10x,'c (normal to interface) =',f9.4
x /10x,'Density of water in water layer =',f9.4
x /10x,'Extent of system along c axis =',f9.4
x /10x,'No. of pol atoms in cell =',i6
x /10x,'No. of water mols. =',i6
x /10x,'No. of water atoms =',i6
x /10x,'Total no. of atoms in cell =',i6)
2021 format(/'After water elimination'
x /10x,'No. of water mols. =',i6
x /10x,'No. of water atoms =',i6
x /10x,'Total no. of atoms in cell =',i6)
2030 format(/'Minimum ion-ion distance =',f9.4//
x 'No. of pos. ions created =',i4/
x 'No. of neg. ions created =',i4/
x 'Total no. of ions =',i4)
2040 format(/'Basic (structural) unit cell:'/
x 'Rpt. dist. along pol. backbone (lattice a) =',f10.6/
x 'Rpt. dist. for chain stacking (lattice b) =',f10.6/
x 'Supercell:'/
x 'No. of polymer atoms in supercell =',i6)
2050 format(/'No. of mols. eliminated from water sub-lattice =',i4)
2060 format(//5x,' ***********************************************',
x '*********'/
x 5x,' * * * The i/p file for DL_POLY is config'
x ,' * * *'/
x 5x,' * * * The i/p file for SCHAKAL is s.dat'
x ,' * * *'/
x 5x,' * * * (Cartesian SCHAKAL file: c.dat) '
x ,' * * *'/
x 5x,' * * * Water file for SCHAKAL is water.dat'
x ,' * * *'/
x 5x,' * * * Screen data can be found in "mol_data"'
x ,' * * *'/
x 5x,' ***********************************************'
x ,'*********'/)
2070 format(/'No. of water molecules =',i6/
x 'No. of NaCl units =',i6/
x 'Mol. fraction of NaCl =',f8.4/
x 'Molarity of NaCl aq. soln. =',f8.4)
2090 format( /'For FIELD:'
x /'No. of polymer chains in cell =',i5,
x /'No. of atoms in polymer chain =',i5,
x /'No. of molecules of water =',i5,
x /'No. of Na ions =',i5,
x /'No. of Cl ions =',i5,
x /'% ion imbalance =',f6.2)
2101 format(/'After water - ion conversion.'/
x 'naw is the total no. of atoms =',i5)
2140 format(3i2,' cell alk=',i2,1x,i6,' atoms'/9x,'0',9x,'2'
2 /f20.6,2(12x,'0.000000')
3 /12x,'0.000000',f20.6,12x,'0.000000',
4 /2(12x,'0.000000'),f20.6)
2173 format(6x,a2,i10)
2174 format(3f20.6)
2175 format(7x,a1,i10)
2200 format('title'/ 'cell ',3f9.4,' 90 90 90')
2201 format('title'/ 'cell 1.0 1.0 1.0 90 90 90')
2202 format('supercell ',i2,' *',i2,' *',i2,i12,' atoms'
1 / 'cell',3f12.4,' 90 90 90')
2210 format('atom ',a4,5x,3f15.6)
2211 format('atom ',a2,7x,3f15.6)
2212 format('atom ',a4,5x,3f15.6)
2213 format('end')
2214 format(i5,3x,a4,3x,3f15.6)
2219 format(i6,2x,'atom ',a4,5x,3f15.6)
2250 format('pack 0 2 0 1 0 1'/'end')
2251 format('pack 0 1 0 1 0 1'/'end')
end
subroutine alkyl
character*4 at,ata,atd0,atd,ae
common/rarrays/ c(9999,3),ca(100,3),ce(100,3),cw(19999,3),
1 label(19999)
common/aarrays/ at(9999),ata(100),ae(100),aw(19999)
common/iscalars/ nc,naa,ntbnds,nscats,ncells,nalks,nae,naw,nlr,
1 nna,nnb,mma,mmb,nmw
common/rscalars/ pi,raddeg,degrad,tau,th,scp,alayer,depth,surf,
1 bed,dens
c Molecular geometry:
c Kitaigorodsky, Molecular Crystals & Molecules (AP 1973)
rcc=1.535
rch=1.1
theta1=112.2*degrad
theta2=106.3*degrad
theta3=107.7*degrad
th1=theta1/2.0
th2=theta2/2.0
th3=theta3/2.0
if(nc.lt.1)then
ca(1,1)=rch*cos(th1)
ca(1,2)=0.0
ca(1,3)=rch*sin(th1)
ata(1)='H3'
naa=1
return
endif
do 50 ic=1,nc
ip=ic-2*(ic/2)
i=3*ic-2
ca(i,1)=ip*rcc*cos(th1)
ca(i,2)=0.0
ca(i,3)=ic*rcc*sin(th1)
ata(i)='C3'
ca(i+1,1)=ca(i,1)-(-1)**ip*rch*cos(th2)
ca(i+1,2)=rch*sin(th2)
ca(i+1,3)=ca(i,3)
ata(i+1)='H3'
ca(i+2,1)=ca(i+1,1)
ca(i+2,2)=-rch*sin(th2)
ca(i+2,3)=ca(i,3)
ata(i+2)='H3'
50 continue
ip=nc-2*(nc/2)
ca(i+3,1)=ca(i,1)+(-1)**ip*rch*cos(th3)
ca(i+3,2)=0.0
ca(i+3,3)=ca(i,3)+rch*sin(th3)
ata(i+3)='H3'
naa=i+3
return
end
subroutine oxanoyl
character*4 at,ata,ad,adp,atd0,atd,tempa,ae
common/rarrays/ c(9999,3),ca(100,3),ce(100,3),cw(19999,3),
1 label(19999)
common/aarrays/ at(9999),ata(100),ae(100),aw(19999)
common/iscalars/ nc,naa,ntbnds,nscats,ncells,nalks,nae,naw,nlr,
1 nna,nnb,mma,mmb,nmw
common/rscalars/ pi,raddeg,degrad,tau,th,scp,alayer,depth,surf,
1 bed,dens
rcc=1.492
rco=1.435
rch=1.1
cco=111.0*degrad
occ=111.0*degrad
coc=111.0*degrad
coh=109.0*degrad
hch=106.3*degrad
pcc=0.5*(2*pi-occ)
ccp=pcc
qo=0.0
qc=0.0
qh=0.0
proj=rch*cos(0.5*hch)
hght=rch*sin(0.5*hch)
nae=33
do i=1,nae
ce(i,2)=0.0
ae(i)='H4'
enddo
do i=1,nae-1
i1=7*((i+3)/7)-3
if(i.eq.i1)then
ae(i)='O4'
ae(i-3)='C4'
ae(i+1)='C4'
ae(4)='O1'
ae(11)='O2'
ae(18)='O3'
ae(25)='O4'
ae(32)='O5'
if(i.eq.nae-1)then
ae(i+1)='H4'
endif
endif
enddo
ce(1,1)=-rcc*cos(pcc)
ce(1,3)=rcc*sin(pcc)
ce(2,1)=ce(1,1)+proj*cos(pcc)
ce(2,3)=ce(1,3)+proj*sin(pcc)
ce(2,2)=+hght
ce(3,1)=ce(1,1)+proj*cos(pcc)
ce(3,3)=ce(1,3)+proj*sin(pcc)
ce(3,2)=-hght
ce(4,1)=ce(1,1)+rco
ce(4,3)=ce(1,3)
ce(5,1)=ce(4,1)-rco*cos(coc)
ce(5,3)=ce(4,3)+rco*sin(coc)
ce(6,1)=ce(5,1)+proj*cos(pcc)
ce(6,3)=ce(5,3)+proj*sin(pcc)
ce(6,2)=+hght
ce(7,1)=ce(5,1)+proj*cos(pcc)
ce(7,3)=ce(5,3)+proj*sin(pcc)
ce(7,2)=-hght
ce(8,1)=ce(5,1)+rcc
ce(8,3)=ce(5,3)
ce(9,1)=ce(8,1)-proj*cos(pcc)
ce(9,3)=ce(8,3)-proj*sin(pcc)
ce(9,2)=+hght
ce(10,1)=ce(8,1)-proj*cos(pcc)
ce(10,3)=ce(8,3)-proj*sin(pcc)
ce(10,2)=-hght
ce(11,1)=ce(8,1)-rcc*cos(cco)
ce(11,3)=ce(8,3)+rcc*sin(cco)
ce(12,1)=ce(11,1)+rco
ce(12,3)=ce(11,3)
ce(13,1)=ce(12,1)-proj*cos(pcc)
ce(13,3)=ce(12,3)-proj*sin(pcc)
ce(13,2)=+hght
ce(14,1)=ce(12,1)-proj*cos(pcc)
ce(14,3)=ce(12,3)-proj*sin(pcc)
ce(14,2)=-hght
ce(15,1)=ce(12,1)-rcc*cos(cco)
ce(15,3)=ce(12,3)+rcc*sin(cco)
ce(16,1)=ce(15,1)+proj*cos(pcc)
ce(16,3)=ce(15,3)+proj*sin(pcc)
ce(16,2)=+hght
ce(17,1)=ce(15,1)+proj*cos(pcc)
ce(17,3)=ce(15,3)+proj*sin(pcc)
ce(17,2)=-hght
ce(18,1)=ce(15,1)+rco
ce(18,3)=ce(15,3)
ce(19,1)=ce(18,1)-rco*cos(coc)
ce(19,3)=ce(18,3)+rco*sin(coc)
ce(20,1)=ce(19,1)+proj*cos(pcc)
ce(20,3)=ce(19,3)+proj*sin(pcc)
ce(20,2)=+hght
ce(21,1)=ce(19,1)+proj*cos(pcc)
ce(21,3)=ce(19,3)+proj*sin(pcc)
ce(21,2)=-hght
ce(22,1)=ce(19,1)+rcc
ce(22,3)=ce(19,3)
ce(23,1)=ce(22,1)-proj*cos(pcc)
ce(23,3)=ce(22,3)-proj*sin(pcc)
ce(23,2)=+hght
ce(24,1)=ce(22,1)-proj*cos(pcc)
ce(24,3)=ce(22,3)-proj*sin(pcc)
ce(24,2)=-hght
ce(25,1)=ce(22,1)-rco*cos(cco)
ce(25,3)=ce(22,3)+rco*sin(cco)
ce(26,1)=ce(25,1)+rco
ce(26,3)=ce(25,3)
ce(27,1)=ce(26,1)-proj*cos(pcc)
ce(27,3)=ce(26,3)-proj*sin(pcc)
ce(27,2)=+hght
ce(28,1)=ce(26,1)-proj*cos(pcc)
ce(28,3)=ce(26,3)-proj*sin(pcc)
ce(28,2)=-hght
ce(29,1)=ce(26,1)-rcc*cos(occ)
ce(29,3)=ce(26,3)+rcc*sin(occ)
ce(30,1)=ce(29,1)+proj*cos(pcc)
ce(30,3)=ce(29,3)+proj*sin(pcc)
ce(30,2)=+hght
ce(31,1)=ce(29,1)+proj*cos(pcc)
ce(31,3)=ce(29,3)+proj*sin(pcc)
ce(31,2)=-hght
ce(32,1)=ce(29,1)+rco
ce(32,3)=ce(29,3)
ce(33,1)=ce(32,1)-cos(coh)
ce(33,3)=ce(32,3)+sin(coh)
c open(19,file='oxanoyl.dat',status='unknown')
c write(19,1234)
c do i=1,nae
c write(19,2345)ae(i),(ce(i,j),j=1,3)
c enddo
c write(19,3456)
1234 format('title'/'cell 1.0 1.0 1.0 90.0 90.0 90.0')
2345 format('atom',4x,a4,5x,3f15.6)
3456 format('end')
return
end
subroutine rot1(c1,c2,ph)
c rotation of coordinates (c1,c2) by angle ph in their projected plane
g1=c1*cos(ph)-c2*sin(ph)
g2=c2*cos(ph)+c1*sin(ph)
c1=g1
c2=g2
return
end
subroutine rot(ir,is,i1,i2,phi)
c Rotation of the coordinates of atoms i1 to i2 by an
c angle phi around the bond between atoms ir and is.
common/rarrays/ c(9999,3),ca(100,3),ce(100,3),cw(19999,3),
1 label(19999)
common/iscalars/ nc,naa,ntbnds,nscats,ncells,nalks,nae,naw,nlr,
1 nna,nnb,mma,mmb,nmw
common/rscalars/ pi,raddeg,degrad,tau,th,scp,alayer,depth,surf,
1 bed,dens
c Consider the bond |ir-is| as a vector V with components (dx,dy,dz).
c Its projection on the xz plane, rxz, makes an angle th1 with the z axis,
c and there is an angle th2 between the vector V and its component rxz.
c print*,'At start of "rot":'
c print*,ir,(c(ir,j),j=1,3)
c print*,is,(c(is,j),j=1,3)
c print*
dx=c(is,1)-c(ir,1)
dy=c(is,2)-c(ir,2)