Skip to content
Snippets Groups Projects
Commit bdb2c562 authored by richard_berger's avatar richard_berger
Browse files

(RB) Added Functions:

- getPotentialJumpFromDipoleMomentPerMolecule
- addDipoleHomogeneousSystem
parent 17de7a6b
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,8 @@
#
# If you are using this software for scientific purposes, please cite it as:
# L Hoermann et al., Computer Physics Communications (2019), 143-155
import numpy as np
import matplotlib.pyplot as plt
import os
......@@ -253,6 +255,30 @@ class MixedSampleHelper:
return dipolmoment_per_Molecule_eAnstrom_i
def getPotentialJumpFromDipoleMomentPerMolecule(self, DipolePerMolecule_eA_i, geo_i, hash_i):
"""
returns potentialjump_i [eV]
DipolePerMolecule_eA_i .. the dipole moment per molecule in [e*Angstrom]
"""
AreaAngstrom_i = np.linalg.norm( np.cross(geo_i.lattice_vectors[0] ,geo_i.lattice_vectors[1]) )
Nmol_i = ( len(hash_i)-4 ) /2
potentialjump_eV_i = - 180.8 * (DipolePerMolecule_eA_i * Nmol_i) / AreaAngstrom_i
#print('Nmol_i: ',Nmol_i)
#print('AreaAngstrom_i: ', AreaAngstrom_i)
#print('potentialjump_i: ',potentialjump_i)
return potentialjump_eV_i
def addDipole2Molecules( self,
proj,
CalculationsPathsList ,
......@@ -327,6 +353,107 @@ class MixedSampleHelper:
property_key=property_key_potential_jump)
return dipole_config_set, dipole_values, potentialjump_values
def addDipoleHomogeneousSystem( self,
proj,
CalculationsPathsList ,
property_key_dipole,
property_key_potential_jump='PotentialJump'):
dipole_config_set = sample.ConfigurationSet(proj)
failcounter=0
for folder_i in CalculationsPathsList:
print('folder_i: ', folder_i)
#folder_i = all_calcpathnames[400]
aimsout_i = AIMSOutput(os.path.join(folder_i,'aims.out'))
geo_i = aimsout_i.getGeometryFile()
#geo_i.visualize()
#plt.show()
hash_i = getHashFromGeometry.getHash(geometry_file=geo_i,
geometries=proj.getLocalGeometries(),
substrate=proj.getSubstrate() )
print('hash_i: ', hash_i)
### check if isslab ##########
Nmol_i = ( len(hash_i)-4 ) /2
if Nmol_i>0:
isslab_i = False
else:
isslab_i =True
print('isslab_i: ', isslab_i)
if isslab_i == False and aimsout_i.calculationExitedNormally():
print('folder_i: ',folder_i)
# get the potential jump from aimsout file
potentialjump_i = aimsout_i.getPotentialJump()
print('potentialjump_i: ',potentialjump_i)
#get the dipolemoment per molecule
dipolmoment_per_Molecule_eAnstrom_i = \
self.getDipoleMomentPerMoleculeFromPotentialJump(potentialjump_i, geo_i, hash_i)
print('dipolmoment_per_Molecule_eAnstrom_i: ',dipolmoment_per_Molecule_eAnstrom_i)
print('')
dipole_config_set.add(hash_i)
proj.addProperty(hashes=[hash_i],
values=[dipolmoment_per_Molecule_eAnstrom_i],
property_key=property_key_dipole)
proj.addProperty(hashes=[hash_i],
values=[potentialjump_i],
property_key=property_key_potential_jump)
dipole_values = proj.getProperty(hashes=dipole_config_set.hashes(),
property_key=property_key_dipole)
potentialjump_values = proj.getProperty(hashes=dipole_config_set.hashes(),
property_key=property_key_potential_jump)
return dipole_config_set, dipole_values, potentialjump_values
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment