-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add installed `cmiclassirot` and `cmiclassirot-plot` user scripts to drive operation * Implement clean and documented examples * Performance improvements (Field) * Implement sphinx/online documentation * Start documenting the code and the module
- Loading branch information
Showing
32 changed files
with
860 additions
and
278 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
__pycache__ | ||
build/ | ||
doc/_build/ | ||
doc/generated/ | ||
public/ | ||
*.egg-info | ||
*.h5 |
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,22 @@ | ||
image: python:3.11 | ||
|
||
test: | ||
stage: test | ||
script: | ||
- pip install -U sphinx | ||
- pip install . | ||
- sphinx-build -b html doc public | ||
rules: | ||
- if: $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH | ||
|
||
pages: | ||
stage: deploy | ||
script: | ||
- pip install -U sphinx | ||
- pip install . | ||
- sphinx-build -b html doc public | ||
artifacts: | ||
paths: | ||
- public | ||
rules: | ||
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH |
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,32 @@ | ||
# .readthedocs.yaml | ||
# Read the Docs configuration file | ||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details | ||
|
||
# Required | ||
version: 2 | ||
|
||
# Set the OS, Python version and other tools you might need | ||
build: | ||
os: ubuntu-22.04 | ||
tools: | ||
python: "3.11" | ||
# You can also specify other tool versions: | ||
# nodejs: "19" | ||
# rust: "1.64" | ||
# golang: "1.19" | ||
|
||
# Build documentation in the "docs/" directory with Sphinx | ||
sphinx: | ||
configuration: docs/conf.py | ||
|
||
# Optionally build your docs in additional formats such as PDF and ePub | ||
# formats: | ||
# - epub | ||
|
||
# Optional but recommended, declare the Python requirements required | ||
# to build your documentation | ||
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html | ||
# python: | ||
# install: | ||
# - requirements: docs/requirements.txt |
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
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,49 @@ | ||
# Release guidelines | ||
|
||
This recipe might need improvements, but keep the spirit in mind and update as | ||
appropriate. | ||
|
||
* Make sure all documentation and references are updated and all tests are | ||
passed. | ||
* Update `Release Notes.md`. | ||
* Bump version (in setup.py and doc/conf.py) to reflect the new release | ||
* Copy current `develop` to `release`: | ||
``` | ||
git checkout develop@{0} # get working tree from "development", detach HEAD | ||
git reset --soft stable # reposition detached HEAD on "stable" | ||
git commit # enter the appropriate commit message | ||
git branch temp # create a temporary branch "temp" at HEAD | ||
git checkout temp # get on the new temporary branch | ||
git branch -M release # rename "temp" to "stable" | ||
``` | ||
* Tag the final release as vx.y or vx.y.z or, possibly, create a vx.y branch for | ||
the release. | ||
* go back to develop `git checkout develop` | ||
* Set the version (in setup.py) to the next development-cycle version number, | ||
e.g., `x.u-dev`. | ||
|
||
|
||
## Publish release version | ||
|
||
Push the release branch(es) and tag to github | ||
``` | ||
git push github release | ||
git push github vx.y | ||
``` | ||
|
||
|
||
## Create github release | ||
|
||
Go the the github project page and create a new release from the pushed tag | ||
vx.y. | ||
|
||
Provide a release title "Public release vx.y" and add the release notes from | ||
`Release Notes.md` as description of the github release. | ||
|
||
|
||
<!-- Put Emacs local variables into HTML comment | ||
Local Variables: | ||
coding: utf-8 | ||
fill-column: 80 | ||
End: | ||
--> |
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 @@ | ||
# CMIclassirot release notes | ||
|
||
## Future Release(s) -- past 1.0 | ||
|
||
* Provide $`\left<\cos^2\theta\right>(t)`$ trace in HDF5 files | ||
* Add examples for bionanoparticles | ||
|
||
|
||
## Release 0.9.2 | ||
|
||
* Improve documentation | ||
|
||
|
||
## Release 0.9.1 | ||
|
||
* Add installed `cmiclassirot` and `cmiclassirot-plot` user scripts to drive | ||
operation | ||
* Implement clean and documented examples | ||
* Performance improvements (Field) | ||
* Implement sphinx/online documentation | ||
* Start documenting the code and the module | ||
|
||
|
||
## Release 0.9 | ||
|
||
* Original functionality as described in arXiv:2306.05870 |
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,58 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8; fill-column: 120 -*- | ||
# | ||
# This file is part of the CMIclassirot classical-rotation alignment simulations | ||
|
||
|
||
|
||
import click | ||
import time | ||
|
||
from cmiclassirot.propagate import Propagate | ||
|
||
|
||
@click.command() # help='Filename of definiton of Ensemble and Field', | ||
@click.argument('inputfilename', required=1) | ||
@click.option('-o', '--output', 'output', default='cmiclassirot.h5', show_default=True, | ||
help='Write output to specified filename.') | ||
@click.help_option('-h', '--help') | ||
def main(inputfilename, output): | ||
"""CMIclassirot driver program: calculate the time-evolution of rigid rotors in electric fields | ||
This program reads an imputfile defining an Ensemble of Molecules and a Field and performs the calculation. | ||
Besides the options defined below, the program requires the filename of the inputfile as the only positional | ||
argument. The input must define the following Python variables, which are used in the calculation: | ||
:class:`Ensemble` :param:`ensemble` Definition of the initial ensemble of molecules | ||
:class:`Field` :param:`field` Definition of the time-dependet electric field | ||
:param timerange: 2-tuple of initial and final time of integration | ||
:param dt_save: Tiemstep for saving the :class:`Molecule`-positions to file | ||
@author: Jochen Küpper <[email protected]> | ||
""" | ||
# read specification of problem | ||
with open(inputfilename, mode='r') as inputfile: | ||
code = inputfile.read() | ||
exec(code, globals()) | ||
|
||
# perform the computation | ||
starttime = time.time() | ||
print('Starting propagation of molecular dynamics') | ||
p = Propagate(ensemble, field, timerange, dt_save) | ||
print(' Propagation took', time.time()-starttime, 's') | ||
|
||
# and save the results to the output file | ||
starttime = time.time() | ||
print('Saving data to file') | ||
ensemble._save(output) | ||
print(' Saving took', time.time()-starttime, 's') | ||
|
||
|
||
|
||
if __name__ == '__main__': | ||
main() |
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,41 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8; fill-column: 120 -*- | ||
# | ||
# This file is part of the CMIclassirot classical-rotation alignment simulations | ||
# | ||
# Plotting of degree of alignment and laser pulse | ||
|
||
from cmiclassirot.field import Field | ||
from cmiclassirot.sample import Ensemble | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
import sys | ||
|
||
fname = sys.argv[1] | ||
|
||
e = Ensemble.FromFile(fname) | ||
print("Number of Molecules:", len(e.molecules)) | ||
|
||
doa = np.zeros(len(e.molecules[0].pos)) | ||
E = e.pulse | ||
|
||
for i in e.molecules: | ||
t=[] | ||
pulse = [] | ||
for j in range(len(i.pos)): | ||
try: | ||
doa[j] += i.pos[j].angle.rotation_matrix[2][2]**2 | ||
t.append(i.pos[j].time) | ||
pulse.append(E(i.pos[j].time)) | ||
except: | ||
pass | ||
doa = doa/len(e.molecules) | ||
|
||
fig, ax = plt.subplots(2) | ||
ax[0].plot(np.array(t)*1e9, doa) | ||
ax[1].plot(np.array(t)*1e9, Field.amplitude2intensity(np.array(pulse)) / (1e12 * 1e4)) | ||
plt.xlabel('time (ns)') | ||
ax[0].set_ylabel(r'$\left<\cos^2\theta\right>$') | ||
ax[1].set_ylabel('$E$ ($10^{12}$~W/cm$^2$)') | ||
plt.tight_layout() | ||
plt.show() |
Oops, something went wrong.