mirror of https://github.com/lammps/lammps.git
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@5713 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
parent
49b72ac36e
commit
faf9b4f21b
|
@ -0,0 +1,74 @@
|
|||
Info="""
|
||||
Module name: bohr2ang.py
|
||||
|
||||
Author: (c) Andres Jaramillo-Botero
|
||||
California Institute of Technology
|
||||
ajaramil@caltech.edu
|
||||
Project: pEFF
|
||||
Version: August 2009
|
||||
|
||||
Usage: python bohr2ang.py
|
||||
>>Name of data file (bohr): [datafile]
|
||||
|
||||
Results:
|
||||
creates a datafile with extension .ang in real units
|
||||
|
||||
"""
|
||||
import os
|
||||
|
||||
currdir=os.getcwd()
|
||||
datafile=raw_input("Name of data file (bohr): ")
|
||||
bohr2ang=0.529177249
|
||||
bperatu2angperfs=0.512396271120794
|
||||
f=open(currdir+'/'+datafile,'r')
|
||||
w=open(currdir+'/'+datafile+'.ang','w')
|
||||
lines=f.readlines()
|
||||
atom_flag=False
|
||||
vel_flag=False
|
||||
for line in lines:
|
||||
if line.find("xlo") > 0:
|
||||
parse=line.split()
|
||||
w.write("%f %f xlo xhi\n"%(float(parse[0])*bohr2ang,float(parse[1])*bohr2ang))
|
||||
elif line.find("ylo") > 0:
|
||||
parse=line.split()
|
||||
w.write("%f %f ylo yhi\n"%(float(parse[0])*bohr2ang,float(parse[1])*bohr2ang))
|
||||
elif line.find("zlo") > 0:
|
||||
parse=line.split()
|
||||
w.write("%f %f zlo zhi\n"%(float(parse[0])*bohr2ang,float(parse[1])*bohr2ang))
|
||||
elif line.find("xy") >= 0:
|
||||
parse=line.split()
|
||||
w.write("%f %f %f xy xz yz\n"%(float(parse[0])*bohr2ang,float(parse[1])*bohr2ang,float(parse[2])*bohr2ang))
|
||||
elif atom_flag and line.strip():
|
||||
parse=line.split()
|
||||
id=parse[0]
|
||||
type=parse[1]
|
||||
q=parse[2]
|
||||
spin=parse[3]
|
||||
eradius=float(parse[4])*bohr2ang
|
||||
x=float(parse[5])*bohr2ang
|
||||
y=float(parse[6])*bohr2ang
|
||||
z=float(parse[7])*bohr2ang
|
||||
rest=" ".join(parse[8:])
|
||||
w.write("%s %s %s %s %f %f %f %f %s\n"%(id,type,q,spin,eradius,x,y,z,rest))
|
||||
elif line.find("Atoms") >= 0:
|
||||
w.write(line)
|
||||
atom_flag=True
|
||||
continue
|
||||
elif vel_flag and line != "\n":
|
||||
parse=line.split()
|
||||
id=parse[0]
|
||||
vx=float(parse[1])*bperatu2angperfs
|
||||
vy=float(parse[2])*bperatu2angperfs
|
||||
vz=float(parse[3])*bperatu2angperfs
|
||||
erv=float(parse[4])*bperatu2angperfs
|
||||
w.write("%s %f %f %f\n"%(id,vx,vy,vz,erv))
|
||||
elif line.find("Velocities") >= 0:
|
||||
w.write(line)
|
||||
atom_flag=False
|
||||
vel_flag=True
|
||||
continue
|
||||
else:
|
||||
w.write(line)
|
||||
|
||||
f.close()
|
||||
w.close()
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,92 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# Usage: Li-solid.pl <nx> <ny> <nz> > data.Li
|
||||
#
|
||||
# Generates a lithium solid LAMMPS data input file
|
||||
# with FCC nuclear positions and interstitial electron positions.
|
||||
|
||||
$nx = shift(@ARGV);
|
||||
$ny = shift(@ARGV);
|
||||
$nz = shift(@ARGV);
|
||||
|
||||
$L = 4.419688383648; # eFF optimized (8.32 expt)
|
||||
|
||||
# This part changes for different lattices
|
||||
@xunit = (0, 0.2645886245, 0, 0.2645886245, 0.2645886245, 0, 0, 0.2645886245);
|
||||
@yunit = (0, 0.2645886245, 0.2645886245, 0, 0, 0.2645886245, 0, 0.2645886245);
|
||||
@zunit = (0, 0, 0.2645886245, 0.2645886245, 0, 0, 0.2645886245, 0.2645886245);
|
||||
|
||||
$r_elec = 0.3704240743;
|
||||
$r_elec2 = 1.587531747;
|
||||
|
||||
$Lx = $L;
|
||||
$Ly = $L;
|
||||
$Lz = $L;
|
||||
|
||||
$idx = 0;
|
||||
for ($x = 0; $x < $nx; $x++)
|
||||
{
|
||||
for ($y = 0; $y < $ny; $y++)
|
||||
{
|
||||
for ($z = 0; $z < $nz; $z++)
|
||||
{
|
||||
for ($i = 0; $i <= $#xunit; $i++)
|
||||
{
|
||||
$xnuc[$idx] = $x * $Lx + $xunit[$i] * $L + 0.2645886245 * $L;
|
||||
$ynuc[$idx] = $y * $Ly + $yunit[$i] * $L + 0.2645886245 * $L;
|
||||
$znuc[$idx] = $z * $Lz + $zunit[$i] * $L + 0.2645886245 * $L;
|
||||
$idx++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$numnuc = $idx;
|
||||
|
||||
# Print length of supercell
|
||||
|
||||
printf("Created by AJB\n\n");
|
||||
printf("%d atoms\n",2*$numnuc);
|
||||
printf("2 atom types\n\n");
|
||||
printf("%f %f xlo xhi\n", 0, $Lx * $nx);
|
||||
printf("%f %f ylo yhi\n", 0, $Ly * $ny);
|
||||
printf("%f %f zlo zhi\n\n", 0, $Lz * $nz);
|
||||
printf("Masses\n\n");
|
||||
printf("1 6.941000\n");
|
||||
printf("2 1.000000\n\n");
|
||||
printf("Atoms\n\n");
|
||||
|
||||
$j = 0;
|
||||
# Print out the nuclei
|
||||
for ($i = 0; $i < $numnuc; $i += 8)
|
||||
{
|
||||
printf("%i %i %f %i %f %f %f %f\n", $j+=1,1,3.0, 0, 0.0,$xnuc[$i], $ynuc[$i], $znuc[$i]);
|
||||
printf("%i %i %f %i %f %f %f %f\n", $j+=1,1,3.0, 0, 0.0,$xnuc[$i+1], $ynuc[$i+1], $znuc[$i+1]);
|
||||
printf("%i %i %f %i %f %f %f %f\n", $j+=1,1,3.0, 0, 0.0,$xnuc[$i+2], $ynuc[$i+2], $znuc[$i+2]);
|
||||
printf("%i %i %f %i %f %f %f %f\n", $j+=1,1,3.0, 0, 0.0,$xnuc[$i+3], $ynuc[$i+3], $znuc[$i+3]);
|
||||
}
|
||||
|
||||
# Print out the core electrons
|
||||
for ($i = 0; $i < $numnuc; $i += 8)
|
||||
{
|
||||
printf("%i %i %f %i %f %f %f %f\n", $j+=1, 2, 0.0, 1, $r_elec,$xnuc[$i ], $ynuc[$i ], $znuc[$i ]);
|
||||
printf("%i %i %f %i %f %f %f %f\n", $j+=1, 2, 0.0, -1, $r_elec,$xnuc[$i ], $ynuc[$i ], $znuc[$i ]);
|
||||
printf("%i %i %f %i %f %f %f %f\n", $j+=1, 2, 0.0, 1, $r_elec,$xnuc[$i+1], $ynuc[$i+1], $znuc[$i+1]);
|
||||
printf("%i %i %f %i %f %f %f %f\n", $j+=1, 2, 0.0, -1, $r_elec,$xnuc[$i+1], $ynuc[$i+1], $znuc[$i+1]);
|
||||
printf("%i %i %f %i %f %f %f %f\n", $j+=1, 2, 0.0, 1, $r_elec,$xnuc[$i+2], $ynuc[$i+2], $znuc[$i+2]);
|
||||
printf("%i %i %f %i %f %f %f %f\n", $j+=1, 2, 0.0, -1, $r_elec,$xnuc[$i+2], $ynuc[$i+2], $znuc[$i+2]);
|
||||
printf("%i %i %f %i %f %f %f %f\n", $j+=1, 2, 0.0, 1, $r_elec,$xnuc[$i+3], $ynuc[$i+3], $znuc[$i+3]);
|
||||
printf("%i %i %f %i %f %f %f %f\n", $j+=1, 2, 0.0, -1, $r_elec,$xnuc[$i+3], $ynuc[$i+3], $znuc[$i+3]);
|
||||
}
|
||||
|
||||
# Print out the valence electrons
|
||||
for ($i = 0; $i < $numnuc; $i += 8)
|
||||
{
|
||||
if (rand() < .5) {$spin = 1;} else {$spin = -1;}
|
||||
printf("%i %i %f %i %f %f %f %f\n", $j+=1, 2, 0.0, $spin, $r_elec2,$xnuc[$i+4], $ynuc[$i+4], $znuc[$i+4]);
|
||||
printf("%i %i %f %i %f %f %f %f\n", $j+=1, 2, 0.0, -$spin, $r_elec2,$xnuc[$i+5], $ynuc[$i+5], $znuc[$i+5]);
|
||||
if (rand() < .5) {$spin = 1;} else {$spin = -1;}
|
||||
printf("%i %i %f %i %f %f %f %f\n", $j+=1, 2, 0.0, $spin, $r_elec2,$xnuc[$i+6], $ynuc[$i+6], $znuc[$i+6]);
|
||||
printf("%i %i %f %i %f %f %f %f\n", $j+=1, 2, 0.0, -$spin, $r_elec2,$xnuc[$i+7], $ynuc[$i+7], $znuc[$i+7]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue