-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Coop coordination #280
Draft
juliette1996
wants to merge
12
commits into
master
Choose a base branch
from
coop_coordination
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Coop coordination #280
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
86dd213
Add elements coordination in schemas.py
juliette1996 4432fe3
Update workflow_coop.py with coordination number
juliette1996 6541d2a
Add a description of elements_coordination option
juliette1996 d19ef53
Add nano-CAT to setup.py
juliette1996 472e2e7
Variable assignment in workflow_coop.py
juliette1996 6a4c11f
fixed logger error
felipeZ 6058891
update changelog
felipeZ 133697d
Merge branch 'master' into coop_coordination
felipeZ bb0820b
Create input_test_coop_coordination.yml
juliette1996 67c44f0
Test coordination functionality of coop workflow
juliette1996 1d62551
Merge branch 'master' into coop_coordination
felipeZ c822be2
Update yml input test
juliette1996 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
"""Crystal Orbital Overlap Population calculation. | ||
The COOP is calculated between two selected elements. | ||
For each element, a specific coordination number can optionally be selected | ||
by using the "elements_coordination" key in the yaml input. | ||
|
||
Index | ||
----- | ||
|
@@ -10,12 +13,16 @@ | |
__all__ = ['workflow_crystal_orbital_overlap_population'] | ||
|
||
import logging | ||
from typing import List, Tuple | ||
from typing import List, Tuple, Union | ||
|
||
import numpy as np | ||
|
||
from scm.plams import Molecule | ||
|
||
from qmflows.parsers.xyzParser import readXYZ | ||
|
||
from nanoCAT.recipes import coordination_number | ||
|
||
from ..common import (DictConfig, MolXYZ, h2ev, | ||
number_spherical_functions_per_atom, retrieve_hdf5_data) | ||
from ..integrals.multipole_matrices import compute_matrix_multipole | ||
|
@@ -44,11 +51,16 @@ def workflow_crystal_orbital_overlap_population(config: DictConfig): | |
# Converting the xyz-file to a mol-file | ||
mol = readXYZ(config.path_traj_xyz) | ||
|
||
if config.elements_coordination is not None: | ||
geometry = Molecule(config.path_traj_xyz) | ||
else: | ||
geometry = None | ||
|
||
# Computing the indices of the atomic orbitals of the two selected | ||
# elements, and the overlap matrix that contains only elements related to | ||
# the two elements | ||
el_1_orbital_ind, el_2_orbital_ind, overlap_reduced = compute_overlap_and_atomic_orbitals( | ||
mol, config) | ||
mol, config, geometry) | ||
|
||
# Compute the crystal orbital overlap population between the two selected | ||
# elements | ||
|
@@ -83,7 +95,8 @@ def get_eigenvalues_coefficients(config: DictConfig) -> Tuple[np.ndarray, np.nda | |
|
||
|
||
def compute_overlap_and_atomic_orbitals( | ||
mol: MolXYZ, config: DictConfig) -> Tuple[List[int], List[int], List[int]]: | ||
mol: MolXYZ, config: DictConfig, | ||
geometry: Union[Molecule, None]) -> Tuple[List[int], List[int], List[int]]: | ||
"""Compute the indices of the atomic orbitals of the two selected elements. | ||
|
||
Computes the overlap matrix, containing only the elements related to those two elements. | ||
|
@@ -102,8 +115,17 @@ def compute_overlap_and_atomic_orbitals( | |
element_1 = config["coop_elements"][0] | ||
element_2 = config["coop_elements"][1] | ||
|
||
element_1_index = [i for i, s in enumerate(mol) if element_1.lower() in s] | ||
element_2_index = [i for i, s in enumerate(mol) if element_2.lower() in s] | ||
if config["elements_coordination"] is None: | ||
element_1_index = [i for i, s in enumerate(mol) if element_1.lower() in s] | ||
element_2_index = [i for i, s in enumerate(mol) if element_2.lower() in s] | ||
|
||
# For the two selected elements, only the indices corresponding to a given coordination number | ||
else: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fyi, you can also make from typing import Optional
try:
from nanoCAT import coordination_number
NANOCAT_EX: Optional[ImportError] = None
except ImportError as ex:
NANOCAT_EX = ex
def compute_overlap_and_atomic_orbitals(...):
if config["elements_coordination"] is None:
...
elif NANOCAT_EX is not None:
raise NANOCAT_EX
else:
coord = coordination_number(geometry)
... |
||
coord = coordination_number(geometry) | ||
cn_1 = config["elements_coordination"][0] | ||
cn_2 = config["elements_coordination"][1] | ||
element_1_index = [i - 1 for i in coord[element_1][cn_1]] | ||
element_2_index = [i - 1 for i in coord[element_2][cn_2]] | ||
|
||
# Making a list of the indices of the atomic orbitals for each of the two | ||
# elements | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
workflow: | ||
coop_calculation | ||
project_name: Cd33Se33 | ||
|
||
active_space: [50, 50] | ||
path_hdf5: "test/test_files/Cd33Se33.hdf5" | ||
path_traj_xyz: "test/test_files/Cd33Se33.xyz" | ||
scratch_path: "/tmp/COOP" | ||
|
||
coop_elements: ["Cd", "Se"] | ||
elements_coordination: [4, 3] | ||
|
||
cp2k_general_settings: | ||
basis: "DZVP-MOLOPT-SR-GTH" | ||
potential: "GTH-PBE" | ||
cell_parameters: 20.0 | ||
periodic: none | ||
|
||
cp2k_settings_main: | ||
specific: | ||
template: pbe_main | ||
|
||
cp2k_settings_guess: | ||
specific: | ||
template: | ||
pbe_guess |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nanoCAT must be included in the library requirements at
setup.py