Skip to content

Commit

Permalink
Added a max_adsorbate_movement term to the local adsorption energy da…
Browse files Browse the repository at this point in the history
…tabase
  • Loading branch information
ktran9891 committed Jun 7, 2017
1 parent f1f6359 commit bdcdfe4
Showing 1 changed file with 24 additions and 13 deletions.
37 changes: 24 additions & 13 deletions gaspy_toolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -1462,18 +1462,28 @@ def angle_between(v1, v2):
angle = 0.
angle = angle/2./np.pi*360

#calculate the maximum movement of surface atoms during the relaxation
#first, calculate the number of adsorbate atoms
num_adsorbate_atoms=len(pickle.loads(self.parameters['adsorption']['adsorbates'][0]['atoms'].decode('hex')))
#get just the slab atoms of the initial and final state
slab_atoms_final=best_sys[0:-num_adsorbate_atoms]
slab_atoms_initial=mongo_doc_atoms(best_sys_pkl['slab+ads']['initial_configuration'])[0:-num_adsorbate_atoms]
#Calculate the distances for each atom
distances=slab_atoms_final.positions-slab_atoms_initial.positions
#Reduce the distances in case atoms wrapped around (the minimum image convention)
dist,Dlen=find_mic(distances,slab_atoms_final.cell,slab_atoms_final.pbc)
#Calculate the max movement of the surface atoms
max_surface_movement=np.max(Dlen)
'''
Calculate the maximum movement of surface atoms during the relaxation. then we do it again,
but for adsorbate atoms.
'''
# First, calculate the number of adsorbate atoms
num_adsorbate_atoms = len(pickle.loads(self.parameters['adsorption']['adsorbates'][0]['atoms'].decode('hex')))
# Get just the slab atoms of the initial and final state
slab_atoms_final = best_sys[0:-num_adsorbate_atoms]
slab_atoms_initial = mongo_doc_atoms(best_sys_pkl['slab+ads']['initial_configuration'])[0:-num_adsorbate_atoms]
# Calculate the distances for each atom
distances = slab_atoms_final.positions - slab_atoms_initial.positions
# Reduce the distances in case atoms wrapped around (the minimum image convention)
dist, Dlen = find_mic(distances, slab_atoms_final.cell, slab_atoms_final.pbc)
# Calculate the max movement of the surface atoms
max_surface_movement = np.max(Dlen)
# Repeat the procedure, but for adsorbates
# get just the slab atoms of the initial and final state
adsorbate_atoms_final = best_sys[-num_adsorbate_atoms:]
adsorbate_atoms_initial = mongo_doc_atoms(best_sys_pkl['slab+ads']['initial_configuration'])[-num_adsorbate_atoms:]
distances = adsorbate_atoms_final.positions - adsorbate_atoms_initial.positions
dist, Dlen = find_mic(distances, slab_atoms_final.cell, slab_atoms_final.pbc)
max_adsorbate_movement = np.max(Dlen)

# Make a dictionary of tags to add to the database
criteria = {'type':'slab+adsorbate',
Expand All @@ -1498,7 +1508,8 @@ def angle_between(v1, v2):
'slabfwid':best_sys_pkl['slab']['fwid'],
'bulkfwid':bulk[bulkmin]['fwid'],
'adsorbate_angle':angle,
'max_surface_movement':max_surface_movement}
'max_surface_movement':max_surface_movement,
'max_adsorbate_movement':max_adsorbate_movement}
# Turn the appropriate VASP tags into [str] so that ase-db may accept them.
VSP_STNGS = vasp_settings_to_str(self.parameters['adsorption']['vasp_settings'])
for key in VSP_STNGS:
Expand Down

0 comments on commit bdcdfe4

Please sign in to comment.