本文整理汇总了Python中ase.md.verlet.VelocityVerlet.set_qm_update_func方法的典型用法代码示例。如果您正苦于以下问题:Python VelocityVerlet.set_qm_update_func方法的具体用法?Python VelocityVerlet.set_qm_update_func怎么用?Python VelocityVerlet.set_qm_update_func使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ase.md.verlet.VelocityVerlet
的用法示例。
在下文中一共展示了VelocityVerlet.set_qm_update_func方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open
# 需要导入模块: from ase.md.verlet import VelocityVerlet [as 别名]
# 或者: from ase.md.verlet.VelocityVerlet import set_qm_update_func [as 别名]
if args.check_force:
pred_corr_logfile = open('pred-corr-error.txt','w')
dynamics.attach(log_pred_corr_errors, 1, dynamics, pred_corr_logfile)
# array to store time averaged stress field
avg_sigma = np.zeros((len(atoms), 3, 3))
def update_qm_region(atoms):
crack_pos = find_crack_tip_stress_field(atoms, calc=mm_pot, avg_sigma=avg_sigma)
qm_list = qmmm_pot.get_qm_atoms(atoms)
qm_list = update_hysteretic_qm_region(atoms, qm_list, crack_pos,
qm_inner_radius, qm_outer_radius)
qmmm_pot.set_qm_atoms(qm_list, atoms)
print "Initialising Dynamics"
dynamics.set_qm_update_func(update_qm_region)
def print_context(ats=atoms, dyn=dynamics):
print 'steps, T', dyn.nsteps, ats.get_kinetic_energy()/(1.5*units.kB*len(ats))
print 'G', get_energy_release_rate(ats)/(units.J/units.m**2)
print 'strain', get_strain(ats)
print 'state', dynamics.state
def write_slab(dynamics=dynamics):
if dynamics.state == LOTFDynamics.Interpolation:
dynamics.atoms.set_array('avg_sigma', avg_sigma.reshape((len(atoms), 9)))
write_xyz('crack_slab.xyz', dynamics.atoms, append=True)
dynamics.attach(print_context, interval=1)
dynamics.attach(write_slab, interval=1)
print 'Running Dynamics'
示例2: LOTFDynamics
# 需要导入模块: from ase.md.verlet import VelocityVerlet [as 别名]
# 或者: from ase.md.verlet.VelocityVerlet import set_qm_update_func [as 别名]
else:
print 'Initializing LOTF Dynamics'
dynamics = LOTFDynamics(atoms, timestep,
extrapolate_steps,
check_force_error=check_force_error)
system_timer('init_dynamics')
# Function to update the QM region at the beginning of each extrapolation cycle
if not check_force_error:
if extrapolate_steps == 1:
if not classical:
dynamics.attach(update_qm_region, 1, dynamics.atoms)
else:
# Choose appropriate update function for defects or crack or grainboundary
print 'Setting Update Function'
if geom =='disloc':
dynamics.set_qm_update_func(update_qm_region)
elif geom =='crack':
if quantumregion == 'Crack':
dynamics.set_qm_update_func(update_qm_region_crack)
elif quantumregion =='Hydrogen':
dynamics.set_qm_update_func(set_qm_H(h_list))
else:
sys.exit("No quantum region chosen")
else:
print 'No geometry chosen', 1/0
if check_force_error:
pred_corr_logfile = open(os.path.join(rundir, 'pred-corr-error.txt'), 'w')
dynamics.attach(log_pred_corr_errors, 1, dynamics, pred_corr_logfile)
dynamics.attach(traj_writer, traj_interval, dynamics)