Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Xie Qingguang
committed
Jan 9, 2012
1 parent
d1500ae
commit 957de78
Showing
31 changed files
with
233,242 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
function fabs(var) { | ||
return var>0?var:-var | ||
} | ||
|
||
function isbound(atom_number, period, rem, current_npoly) { | ||
period = Nbeads + Nsolvent | ||
rem = (atom_number-1)%(period) # from 0 to period-1 | ||
current_npoly = int(atom_number/period) + 1 | ||
return (rem<Nbeads-1) && (atom_number<iatom) && (current_npoly<=Npoly) | ||
} | ||
|
||
BEGIN { | ||
inatoms=0 | ||
lo=1; hi=2 | ||
x=1; y=2; z=3 | ||
iatom=0 | ||
if (Npoly=="full") { | ||
Npoly = 1e22 | ||
} | ||
} | ||
|
||
/LAMMPS/{ | ||
next | ||
} | ||
|
||
/xlo xhi/{ | ||
box[x,lo]=$1 | ||
box[x,hi]=$1 | ||
} | ||
|
||
/ylo yhi/{ | ||
box[y,lo]=$1 | ||
box[y,hi]=$2 | ||
} | ||
|
||
/zlo zhi/{ | ||
box[z,lo]=$1 | ||
box[z,hi]=$2 | ||
} | ||
|
||
/atom types/{ | ||
print "1 bond types" | ||
print "1 angle types" | ||
next | ||
} | ||
|
||
/atoms/{ | ||
natoms=$1 | ||
printf("%s bonds\n", "_NUMBER_OF_BOUNDS_") | ||
printf("%s angles\n", "_NUMBER_OF_ANGLES_") | ||
|
||
next | ||
} | ||
|
||
(NF>0)&&($1=="Atoms"){ | ||
inatoms=1 | ||
# skip empty line | ||
getline | ||
printf "\n" | ||
next | ||
} | ||
|
||
inatoms && (NF==0) { | ||
inatoms = 0 | ||
next | ||
} | ||
|
||
inatoms{ | ||
# here I get one atom | ||
iatom++ | ||
R[x]=$4; R[y]=$5; R[z]=$6 | ||
if (iatom>1) { | ||
for (idim=1; idim<=3; idim++) { | ||
if (fabs(R[idim]- prevR[idim])>cutoff) { | ||
if (R[idim]<prevR[idim]) image[idim]++; else image[idim]-- | ||
} | ||
} | ||
} else { | ||
image[x]=0; image[y]=0; image[z]=0 | ||
} | ||
prevR[x]=R[x]; prevR[y]=R[y]; prevR[z]=R[z] | ||
# change image field | ||
$(NF-2)=image[x]; $(NF-1)=image[y]; $(NF)=image[z]; | ||
# add molecule ID | ||
# $6=$6 " 0" | ||
print $0 | ||
next | ||
} | ||
|
||
!inatoms { | ||
next | ||
} | ||
|
||
END { | ||
printf("\nBonds\n\n") | ||
ibond = 0 | ||
for (q=1; q<iatom; q++) { | ||
if (isbound(q)) { | ||
ibond++ | ||
ip = q | ||
jp = q+1 | ||
bondtype=1 | ||
print ibond, bondtype, ip, jp | ||
} | ||
} | ||
|
||
printf("\nAngles\n\n") | ||
|
||
iangle = 0 | ||
|
||
for (a=1; a<iatom; a++) { | ||
if (isbound(a+1)&&isbound(a)) { | ||
iangle++ | ||
ia = a | ||
ja = a+1 | ||
ka = a+2 | ||
angletype=1 | ||
print iangle, angletype, ia, ja, ka | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.