Skip to content
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

Feat: add clamped Pockels calculation capability #67

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions .cla/version1/CLA.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Contributor License Agreement

> Adapted from the [Apache Software Foundation Individual Contributor License Agreement (ICLA)](https://www.apache.org/licenses/contributor-agreements.html) [version 2.2](https://www.apache.org/licenses/icla.pdf)

You accept and agree to the following terms and conditions for Your
Contributions (present and future) that you submit to the copyright
holders (hereafter "HOLDERS", see the [`LICENSE.txt`](../../LICENSE.txt)
bundled with this software). In return, the HOLDERS shall not use
Your Contributions in a way that is contrary to the public benefit or
inconsistent with its nonprofit status and bylaws in effect at the
time of the Contribution. Except for the license granted herein to
the HOLDERS and recipients of software distributed by the HOLDERS,
You reserve all right, title, and interest in and to Your Contributions.

1. Definitions.

"You" (or "Your") shall mean the copyright owner or legal entity
authorized by the copyright owner that is making this Agreement
with the HOLDERS. For legal entities, the entity making a
Contribution and all other entities that control, are controlled
by, or are under common control with that entity are considered to
be a single Contributor. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"Contribution" shall mean any original work of authorship,
including any modifications or additions to an existing work, that
is intentionally submitted by You to the HOLDERS for inclusion
in, or documentation of, any of the products owned or managed by
the HOLDERS (the "Work"). For the purposes of this definition,
"submitted" means any form of electronic, verbal, or written
communication sent to the HOLDERS or its representatives,
including but not limited to communication on electronic mailing
lists, source code control systems, and issue tracking systems that
are managed by, or on behalf of, the HOLDERS for the purpose of
discussing and improving the Work, but excluding communication that
is conspicuously marked or otherwise designated in writing by You
as "Not a Contribution."

2. Grant of Copyright License. Subject to the terms and conditions of
this Agreement, You hereby grant to the HOLDERS and to
recipients of software distributed by the HOLDERS a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare derivative works of,
publicly display, publicly perform, sublicense, and distribute Your
Contributions and such derivative works.

3. Grant of Patent License. Subject to the terms and conditions of
this Agreement, You hereby grant to the HOLDERS and to
recipients of software distributed by the HOLDERS a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have
made, use, offer to sell, sell, import, and otherwise transfer the
Work, where such license applies only to those patent claims
licensable by You that are necessarily infringed by Your
Contribution(s) alone or by combination of Your Contribution(s)
with the Work to which such Contribution(s) was submitted. If any
entity institutes patent litigation against You or any other entity
(including a cross-claim or counterclaim in a lawsuit) alleging
that your Contribution, or the Work to which you have contributed,
constitutes direct or contributory patent infringement, then any
patent licenses granted to that entity under this Agreement for
that Contribution or Work shall terminate as of the date such
litigation is filed.

4. You represent that you are legally entitled to grant the above
license. If your employer(s) has rights to intellectual property
that you create that includes your Contributions, you represent
that you have received permission to make Contributions on behalf
of that employer, that your employer has waived such rights for
your Contributions to the HOLDERS, or that your employer has
executed a separate Corporate CLA with the HOLDERS.

5. You represent that each of Your Contributions is Your original
creation (see section 7 for submissions on behalf of others). You
represent that Your Contribution submissions include complete
details of any third-party license or other restriction (including,
but not limited to, related patents and trademarks) of which you
are personally aware and which are associated with any part of Your
Contributions.

6. You are not expected to provide support for Your Contributions,
except to the extent You desire to provide support. You may provide
support for free, for a fee, or not at all. Unless required by
applicable law or agreed to in writing, You provide Your
Contributions on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
OF ANY KIND, either express or implied, including, without
limitation, any warranties or conditions of TITLE, NON-
INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.

7. Should You wish to submit work that is not Your original creation,
You may submit it to the HOLDERS separately from any
Contribution, identifying the complete details of its source and of
any license or other restriction (including, but not limited to,
related patents, trademarks, and license agreements) of which you
are personally aware, and conspicuously marking the work as
"Submitted on behalf of a third-party: [named here]".

8. You agree to notify the HOLDERS of any facts or circumstances of
which you become aware that would make these representations
inaccurate in any respect.
20 changes: 20 additions & 0 deletions .cla/version1/signatures.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"signedContributors": [
{
"name": "bastonero",
"id": 79980269,
"comment_id": 2343829130,
"created_at": "2024-09-11T14:22:56Z",
"repoId": 390674389,
"pullRequestNo": 78
},
{
"name": "vdemestral",
"id": 114935148,
"comment_id": 2580462168,
"created_at": "2025-01-09T14:49:31Z",
"repoId": 390674389,
"pullRequestNo": 67
}
]
}
13 changes: 11 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:

strategy:
matrix:
python-version: ['3.10']
python-version: ['3.10','3.12']

services:
rabbitmq:
Expand Down Expand Up @@ -68,4 +68,13 @@ jobs:
- name: Run pytest
env:
AIIDA_WARN_v3: 1
run: pytest -sv tests
run: pytest -sv --cov aiida_vibroscopy tests

- name: Upload to Codecov
if: matrix.python-version == 3.10
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: pytests-vibroscopy3.10
flags: pytests
fail_ci_if_error: true
55 changes: 55 additions & 0 deletions .github/workflows/cla.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: "CLA Assistant"
on:
issue_comment:
types: [created]
pull_request_target:
types: [opened, closed, synchronize]

# explicitly configure permissions, in case your GITHUB_TOKEN workflow permissions are set to read-only in repository settings
permissions:
actions: write
contents: write
pull-requests: write
statuses: write

jobs:
CLAAssistant:
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}

- uses: contributor-assistant/github-action@v2.4.0
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby accept the CLA') || github.event_name == 'pull_request_target'
env:
# the default github token does not allow github action to create & push commit,
# instead, we need to use a github app to generate a token
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
# the below token should have repo scope and must be manually added by you in the repository's secret
# This token is required only if you have configured to store the signatures in a remote repository/organization
# PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
with:
path-to-signatures: ".cla/version1/signatures.json"
path-to-document: "https://github.com/bastonero/aiida-vibroscopy/blob/main/.cla/version1/CLA.md"
# branch should not be protected
branch: "main"
allowlist: bot*

# the followings are the optional inputs - If the optional inputs are not given, then default values will be taken
#remote-organization-name: enter the remote organization name where the signatures should be stored (Default is storing the signatures in the same repository)
#remote-repository-name: enter the remote repository name where the signatures should be stored (Default is storing the signatures in the same repository)
#create-file-commit-message: 'For example: Creating file for storing CLA Signatures'
#signed-commit-message: 'For example: $contributorName has signed the CLA in $owner/$repo#$pullRequestNo'
custom-notsigned-prcomment: 'Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you accept our [Contributor License Agreement](https://github.com/bastonero/aiida-vibroscopy/blob/main/.cla/version1/CLA.md) before we can merge your contribution. You can accept the CLA by just copying the sentence below and posting it as a Pull Request Comment.'
custom-pr-sign-comment: 'I have read the CLA Document and I hereby accept the CLA'
custom-allsigned-prcomment: |
All contributors have accepted the CLA ✅

---
<sub>You might need to click the "Update/Rebase branch" button to update the pull request and rerun the GitHub actions to pass the CLA check.</sub>
#lock-pullrequest-aftermerge: false - if you don't want this bot to automatically lock the pull request after merging (default - true)
#use-dco-flag: true - If you are using DCO instead of CLA
85 changes: 85 additions & 0 deletions .github/workflows/update_changelog.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#!/bin/bash
# -*- coding: utf-8 -*-
"""Script for automatically updating the `CHANGELOG.md` based on the commits since the latest release tag."""
from pathlib import Path
import re
import subprocess

DEFAULT_CHANGELOG_SECTIONS = """
### ‼️ Breaking changes


### ✨ New features


### 🗑️ Deprecations


### 👌 Improvements


### 🐛 Bug fixes


### 📚 Documentation


### 🔧 Maintenance


### ⬆️ Update dependencies


### ♻️ Refactor

"""


def update_changelog():
"""Update the `CHANGELOG.md` for a first draft of the release."""
print('🔍 Checking the current version number')
current_changelog = Path('CHANGELOG.md').read_text(encoding='utf-8')

from aiida_vibroscopy import __version__

if str(__version__) in current_changelog:
print('🛑 Current version already in `CHANGELOG.md`. Skipping...')
return

print('⬆️ Found updated version number, adapting `CHANGELOG.md`.')
tags = subprocess.run(['git', 'tag', '--sort=v:refname'], capture_output=True, check=True, encoding='utf-8').stdout
latest_tag = re.findall(r'(v\d\.\d\.\d)\n', tags)[-1]

print(f'🔄 Comparing with latest tag `{latest_tag}`.')
commits = subprocess.run(['git', 'log', "--pretty=format:'%h|%H|%s'", f'{latest_tag}..origin/main'],
capture_output=True,
check=True,
encoding='utf-8').stdout

pr_pattern = re.compile(r'\(\S(?P<pr_number>\d+)\)')

changelog_message = f'## v{__version__}\n' + DEFAULT_CHANGELOG_SECTIONS

for commit in commits.splitlines():

# Remove the PR number from the commit message
pr_match = pr_pattern.search(commit)

if pr_match is not None:
pr_number = pr_match.groupdict()['pr_number']
commit = commit.replace(fr'(#{pr_number})', '')

# Add the commit hash (short) to link to the changelog
commit = commit.strip("'")
hash_short, hash_long, message = commit.split('|', maxsplit=2)
message += f'[[{hash_short}](https://github.com/aiidateam/aiida-quantumespresso/commit/{hash_long})]'
changelog_message += f'\n* {message}'

with Path('CHANGELOG.md').open('w', encoding='utf8') as handle:
handle.write(changelog_message + '\n\n' + current_changelog)

print("🚀 Success! Finalise the `CHANGELOG.md` and let's get this baby released.")


if __name__ == '__main__':
update_changelog()
85 changes: 85 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
## v1.1.1

This minor release adds the new AiiDA contributor license agreement (CLA), and its GitHub bot,
along with some dependency contraints for phonopy. The latest versions of phonopy (>v2.26)
break the tests. While figuring out why, we patch this until a solution is found.

### 🐛 Bug fixes

* Deps: constrain phonopy and spglib versions [[3a3e3d1](https://github.com/aiidateam/aiida-quantumespresso/commit/3a3e3d117e34c6a66fcdc74e1e21c6263c203565)]

### 📚 Documentation

* Fix some docstrings and reports [[3ee9e7c](https://github.com/aiidateam/aiida-quantumespresso/commit/3ee9e7cbd2f5e6b8f15229dafbed58ae7ef4fa0d)]
* Update main paper reference[[504c1b7](https://github.com/aiidateam/aiida-quantumespresso/commit/504c1b7b65a8852395d0ff3ec7271cb8c05c6931)]

### 🔧 Maintenance

* CLA: update and remove old cla-bot [[32bd829](https://github.com/aiidateam/aiida-quantumespresso/commit/32bd829987751deba056b7bfa739f6c82cf89d3e)]
* @bastonero has signed the CLA in bastonero/aiida-vibroscopy#78[[e83739f](https://github.com/aiidateam/aiida-quantumespresso/commit/e83739f6aaecfcb304f8cac3da6d54b93f0fafb7)]
* Add the AiiDA CLA [[df2cade](https://github.com/aiidateam/aiida-quantumespresso/commit/df2cade1bf200b8a2dd7004a48e40b118257f134)]
* Add CLA bot [[3ba3e9e](https://github.com/aiidateam/aiida-quantumespresso/commit/3ba3e9e9f094106254b1a8ee4c97b85e66b41f85)]

### ⬆️ Update dependencies

* Deps: constrain phonopy and spglib versions [[3a3e3d1](https://github.com/aiidateam/aiida-quantumespresso/commit/3a3e3d117e34c6a66fcdc74e1e21c6263c203565)]




## v1.1.0

This minor release includes new post-processing utilities, a small breaking change in [[42503f3]](https://github.com/bastonero/aiida-vibroscopy/commit/42503f312d9a812cfc46d4c4a03a78641201e1d3) with regards to reference system for non-analytical and polarization directions. Some examples providing
a unique python script to run the `IRamanSpectraWorkChain` are also added to help new users to get started. The license terms are also updated.
A CHANEGELOG file is finally added to keep track in a pretty format of the changes among releases of the code.

The new post-processing utilities can be used directly through a `VibrationalData` node, in a similar fashion to the other methods.
For instance, to compute the complex dielectric matrix and the normal reflectivity in the infrared regime:

```python
node = load_node(PK) # PK to a VibrationalData node

complex_dielectric = node.run_complex_dielectric_function() # (3,3,num_steps) shape complex array; num_steps are the number of frequency points where the function is evaluated
reflectivity = node.run_normal_reflectivity_spectrum([0,0,1]) # (frequency points, reflectance value), [0,0,1] is the orthogonal direction index probed via q.eps.q
```

Now, the polarization and non-analytical directions in _all_ methods in aiida-vibroscopy should be given in Cartesian coordinates:

```python
node = load_node(PK) # PK to a VibrationalData node

scattering_geometry = dict(pol_incoming=[1,0,0], pol_outgoing=[1,0,0], nac_direction=[0,0,1]) # corresponding to ZXXZ scattering setup
intensities, frequencies, mode_symmetry_labels = node.run_single_crystal_raman_intensities(**scattering_geometry)
```

### ‼️ Breaking changes

* Post-processing: polarization and nac directions in Cartesian coordinates [[42503f3]](https://github.com/bastonero/aiida-vibroscopy/commit/42503f312d9a812cfc46d4c4a03a78641201e1d3)

### 👌 Improvements

* Post-processing: computation of complex dielectric function and normal reflectivity in the infrared [[42503f3]](https://github.com/bastonero/aiida-vibroscopy/commit/42503f312d9a812cfc46d4c4a03a78641201e1d3)
* `Examples`: new folder with working examples for different use cases to get new users started [[7deb31b]](https://github.com/bastonero/aiida-vibroscopy/commit/7deb31b5f547ca16e4522be960b4aa5bbe13fccf)
* CI: add codecov step [[f36e8a1]](https://github.com/bastonero/aiida-vibroscopy/commit/f36e8a10566af68843546bae428560dff393aaf1)

### 🐛 Bug Fixes

* `Docs`: fix typos [[85b1830]](https://github.com/bastonero/aiida-vibroscopy/commit/85b18305be6e7e76efce35d9e4ae4c5a3547f9bc), [[e924b3d]](https://github.com/bastonero/aiida-vibroscopy/commit/e924b3dd436a67192f6c0780ff3a318581ab1fc5)
* Post-processing: fix coordinates and units [[42503f3]](https://github.com/bastonero/aiida-vibroscopy/commit/42503f312d9a812cfc46d4c4a03a78641201e1d3)

### 📚 Documentation

* Set correct hyperlink for AiiDA paper [[c92994d]](https://github.com/bastonero/aiida-vibroscopy/commit/c92994de36c336a265ac262eea2dc8d77fb11f08)

### 🔧 Maintenance

* Adapt tests also for other changes [[be3a6b7]](https://github.com/bastonero/aiida-vibroscopy/commit/be3a6b7d67926816957634fd7b520cd021532f0f)
* Add loads of tests [[42503f3]](https://github.com/bastonero/aiida-vibroscopy/commit/42503f312d9a812cfc46d4c4a03a78641201e1d3)
* `README`: add more information and badges [[c92994d]](https://github.com/bastonero/aiida-vibroscopy/commit/c92994de36c336a265ac262eea2dc8d77fb11f08)
* Docs: Remove aiida.manage.configuration.load_documentation_profile [[f914cbb]](https://github.com/bastonero/aiida-vibroscopy/commit/f914cbb5460d4f988dd117628890a8f53f1c976a)
* DevOps: update docs dependencies [[a0d124e]](https://github.com/bastonero/aiida-vibroscopy/commit/a0d124ee24cb287f9d90583b389f38d6b6265b9e)
* Bump SSSP version to 1.3 in tests [[94c72e5]](https://github.com/bastonero/aiida-vibroscopy/commit/94c72e5183584af08d9874fe2b6fc2ad41fce1b5)

### ⬆️ Update dependencies

* DevOps: update docs dependencies [[a0d124e]](https://github.com/bastonero/aiida-vibroscopy/commit/a0d124ee24cb287f9d90583b389f38d6b6265b9e)
Loading
Loading