示例#1
0
from run_testRun import run_testRun
from set_calc import set_calc_In2O3

testRun = False
file_name_py = basename(__file__)
file_name = file_name_py.replace('.py', '')
file_traj = file_name + '.traj'
start_file = '../In2O3_110_clean.traj'

mode = 'a'
try:
    sys = Trajectory(file_traj, 'r')[-1]
except (IOError, RuntimeError):
    print "Importing trajectory file from: %s" % start_file
    sys = read(start_file)
    sys.center(vacuum=5.0, axis=2)
else:
    print "Importing trajectory file from: %s" % file_traj

set_calc_In2O3(sys)
print "Constraints:"
print "	c1: Fix bottom two layers."
avg_z = np.mean([atom.z for atom in sys])
c1 = FixAtoms(mask=[atom.z < avg_z for atom in sys])
sys.set_constraint(c1)

if testRun == True:
    run_testRun(sys)
else:
    geo_traj = Trajectory(file_traj, mode, sys)
    dyn = LBFGS(sys, trajectory=geo_traj)
示例#2
0
from py_box.ase.set_calc import print_vasp_param, calc_dict, handle_restart

testRun = False
file_name_py = basename(__file__)
file_name = file_name_py.replace('.py', '')
file_traj = file_name + '.traj'
file_out = file_name + '.out'

mode = 'a'
try:
    sys = Trajectory(file_traj, 'r')[-1]
except (IOError, RuntimeError):
    print "Creating molecule from scratch"
    sys = molecule('H2')
    sys.set_cell(np.array([20, 21, 22]))
    sys.center()
    #sys *= (2, 3, 1)
else:
    print "Importing trajectory file from: %s" % file_traj

vasp_param = calc_dict['TiO2_step']
vasp_param['kpts'] = (1, 1, 1)
calc = Vasp(**vasp_param)
handle_restart(calc, sys)
print_vasp_param(calc)
sys.set_calculator(calc)

del sys.constraints
#print 'Constraints:'
#print '\tc1: Freezing bottom two layers (z < 15.)'
#c1 = FixAtoms(mask = [atom.z < 15 for atom in sys])