pypsc


Namepypsc JSON
Version 0.2.1 PyPI version JSON
download
home_pageNone
SummaryPredict crystal structures from available hkl information
upload_time2024-09-18 19:03:48
maintainerNone
docs_urlNone
authorMelanie Netwich, Matthias Zschornak
requires_python>=3.10
licenseMIT License Copyright (c) 2024 Muthu Vallinayagam, M. Netwich, M. Zschornak Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, distribute, sublicense, and/or rewrite the structure of the project, but not to sell or publish it as their own, subject to the following conditions: The Software should only be used for research purposes by institutes, research groups, or individuals for non-commercial activities. It should not be used as a commercial product. The Software is for purely research purposes, and the authors do not hold responsibility for any incorrect or erroneous use of the project. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords x-ray miller index python structure prediction inequalities polytope parameter space one-dimensionally projected structures
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pyPSC: Parameter Space Concept for Determining 1D-Projected Crystal Structures

**pyPSC** is a Python package that implements the Parameter Space Concept (PSC) for determining 1-dimensionally projected structures of independent scatterers from diffraction data. This method avoids traditional Fourier inversion and focuses on exploring all possible structural parameter combinations consistent with available diffraction data in a parameter space of dimension `m`.

## Features

- **No Fourier Inversion Required**: Instead of relying on Fourier sums, pyPSC leverages structure factor amplitudes or intensities, represented by piece-wise analytic hyper-surfaces.
- **Isosurface Intersection**: The method obtains the coordinates of scatterers by intersecting multiple isosurfaces, allowing for the detection of all possible solutions in a single derivation.
- **Resonant Contrast**: The spatial resolution achieved may exceed traditional Fourier inversion methods, especially when resonant contrast is considered.
- **Symmetry Optimizations**: Exploits symmetry properties of isosurfaces to optimize algorithms.
- **Monte-Carlo Simulations**: Includes simulations using projections of random two- and three-atom structures to illustrate the universal applicability of the method.
- **1D Projection Efficiency**: The PSC linearization approach is more efficient than Fourier sums, working with fewer reflections.

## Installation

You can install `pyPSC` using `pip`:

```bash
pip install git+https://github.com/mvnayagam/pyPSC.git
or
pip install pypsc
```

## Usage

To start using `pyPSC`, you can import the necessary modules and run calculations on crystal structures based on diffraction data. Below is a simple example of how you might use the library:

```python
import pypsc
```
For for information, see the examples. 

## Methodology

### Parameter Space Concept (PSC)
The PSC method utilizes structure factor amplitudes or intensities as hyper-surfaces that define acceptable regions in parameter space. By intersecting these isosurfaces, the coordinates of scatterers are determined. This enables the detection of all possible solutions consistent with the given diffraction data.

### Key Advantages:
- Detects all possible solutions from the given structure factor amplitudes.
- Potentially surpasses the spatial resolution of Fourier inversion methods.
- Exploits symmetry properties of isosurfaces for optimized computations.

### Monte-Carlo Simulations
The algorithm has been tested with Monte-Carlo simulations, illustrating its efficacy in predicting structures of random two- and three-atom models.

## Examples

### Example 04 - Two-Atom Structure 
```python
from psc.lib.g_space import g
from psc.lib.x3Dlinearization import linearizenD_EPA
from psc.lib.x3Drepetition import getpolytope_EPA  
from psc.lib.x3Dchecklinearization import checklinear
from psc.lib.x3Dintersection import find_intersection
from psc.lib.x3Dreadwrite import wrtdata

# Simulate a two-atom structure and project to 1D
xcoor  = np.sort(xcoor)[::-1]

# EPA model
f     = [1, 1]

# Define reflection
l = 3
# calculate amplitude for given strucutre and RO
gi    = np.abs(g(l, xcoor, f))

# calculate the isosurface over entrie PS using above gi for s=+1 and s=-1
giso1 = hsurf_g(l, grid, f, gi, j, s=1)
giso2 = hsurf_g(l, grid, f, gi, j, s=-1)

# plot calculated isosurfcae. define cc='k' if same is wanted. or isosurface colour will change automatically
r = np.random.uniform(0.0, 0.8, 3) ; cc = (r[0],r[1],r[2],1)
plotisosurf_EPA(l, h, gi, ax, isos, giso1, giso2, cc, lw=2, imax=0.5)

#---> inearization process with error of err 
errr = 0
meshlist = getmesh(l, xcoor, isos.max())

#---> double segment method - EPA
pnts = double_segment_EPA(gi, l, f, error=0)
plist=linrep_DS(l, f, pnts, meshlist, imin=0, imax=0.5)

#---> single segment method - EPA
#pnts = single_segment_EPA(gi, l, xexp, f, error=0)
#plist=linrep_SS(l, f, pnts, meshlist, imin=0, imax=0.5)

#---> plot segments
plot_segment(ax, plist, cc)

#---> storing segment data
writedata(fn, plist)

# ---> Writting found solutions from given ROs
analyzesolution(solution, xcoor, plotting=True)
```

## Documentation

For detailed documentation on how to use the library, please visit the [Documentation](https://github.com/mvnayagam/pyPSC.git).

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

## Contributing

Contributions are welcome! Please fork the repository, make your changes, and submit a pull request. For major changes, open an issue to discuss what you would like to change.

## Issues

If you encounter any problems or have suggestions, feel free to open an issue on the [Issues page](https://github.com/mvnayagam/pyPSC/issues).

---

This `README.md` gives a clear overview of the project, its features, and usage. You can adapt and extend this based on the specifics of your implementation and how your library evolves. Let me know if you need more details!

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pypsc",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "Muthu Vallinayagam <muthu.vallin@gmail.com>",
    "keywords": "x-ray, miller index, python, structure prediction, inequalities, polytope, parameter space, one-dimensionally projected structures",
    "author": "Melanie Netwich, Matthias Zschornak",
    "author_email": "Muthu Vallinayagam <muthu.vallinayagam@htw-dresden.de>",
    "download_url": "https://files.pythonhosted.org/packages/15/66/3a660795c915a19d5890d877cfaa0ca4342aef3fd35930ae8324322103f6/pypsc-0.2.1.tar.gz",
    "platform": null,
    "description": "# pyPSC: Parameter Space Concept for Determining 1D-Projected Crystal Structures\r\n\r\n**pyPSC** is a Python package that implements the Parameter Space Concept (PSC) for determining 1-dimensionally projected structures of independent scatterers from diffraction data. This method avoids traditional Fourier inversion and focuses on exploring all possible structural parameter combinations consistent with available diffraction data in a parameter space of dimension `m`.\r\n\r\n## Features\r\n\r\n- **No Fourier Inversion Required**: Instead of relying on Fourier sums, pyPSC leverages structure factor amplitudes or intensities, represented by piece-wise analytic hyper-surfaces.\r\n- **Isosurface Intersection**: The method obtains the coordinates of scatterers by intersecting multiple isosurfaces, allowing for the detection of all possible solutions in a single derivation.\r\n- **Resonant Contrast**: The spatial resolution achieved may exceed traditional Fourier inversion methods, especially when resonant contrast is considered.\r\n- **Symmetry Optimizations**: Exploits symmetry properties of isosurfaces to optimize algorithms.\r\n- **Monte-Carlo Simulations**: Includes simulations using projections of random two- and three-atom structures to illustrate the universal applicability of the method.\r\n- **1D Projection Efficiency**: The PSC linearization approach is more efficient than Fourier sums, working with fewer reflections.\r\n\r\n## Installation\r\n\r\nYou can install `pyPSC` using `pip`:\r\n\r\n```bash\r\npip install git+https://github.com/mvnayagam/pyPSC.git\r\nor\r\npip install pypsc\r\n```\r\n\r\n## Usage\r\n\r\nTo start using `pyPSC`, you can import the necessary modules and run calculations on crystal structures based on diffraction data. Below is a simple example of how you might use the library:\r\n\r\n```python\r\nimport pypsc\r\n```\r\nFor for information, see the examples. \r\n\r\n## Methodology\r\n\r\n### Parameter Space Concept (PSC)\r\nThe PSC method utilizes structure factor amplitudes or intensities as hyper-surfaces that define acceptable regions in parameter space. By intersecting these isosurfaces, the coordinates of scatterers are determined. This enables the detection of all possible solutions consistent with the given diffraction data.\r\n\r\n### Key Advantages:\r\n- Detects all possible solutions from the given structure factor amplitudes.\r\n- Potentially surpasses the spatial resolution of Fourier inversion methods.\r\n- Exploits symmetry properties of isosurfaces for optimized computations.\r\n\r\n### Monte-Carlo Simulations\r\nThe algorithm has been tested with Monte-Carlo simulations, illustrating its efficacy in predicting structures of random two- and three-atom models.\r\n\r\n## Examples\r\n\r\n### Example 04 - Two-Atom Structure \r\n```python\r\nfrom psc.lib.g_space import g\r\nfrom psc.lib.x3Dlinearization import linearizenD_EPA\r\nfrom psc.lib.x3Drepetition import getpolytope_EPA  \r\nfrom psc.lib.x3Dchecklinearization import checklinear\r\nfrom psc.lib.x3Dintersection import find_intersection\r\nfrom psc.lib.x3Dreadwrite import wrtdata\r\n\r\n# Simulate a two-atom structure and project to 1D\r\nxcoor  = np.sort(xcoor)[::-1]\r\n\r\n# EPA model\r\nf     = [1, 1]\r\n\r\n# Define reflection\r\nl = 3\r\n# calculate amplitude for given strucutre and RO\r\ngi    = np.abs(g(l, xcoor, f))\r\n\r\n# calculate the isosurface over entrie PS using above gi for s=+1 and s=-1\r\ngiso1 = hsurf_g(l, grid, f, gi, j, s=1)\r\ngiso2 = hsurf_g(l, grid, f, gi, j, s=-1)\r\n\r\n# plot calculated isosurfcae. define cc='k' if same is wanted. or isosurface colour will change automatically\r\nr = np.random.uniform(0.0, 0.8, 3) ; cc = (r[0],r[1],r[2],1)\r\nplotisosurf_EPA(l, h, gi, ax, isos, giso1, giso2, cc, lw=2, imax=0.5)\r\n\r\n#---> inearization process with error of err \r\nerrr = 0\r\nmeshlist = getmesh(l, xcoor, isos.max())\r\n\r\n#---> double segment method - EPA\r\npnts = double_segment_EPA(gi, l, f, error=0)\r\nplist=linrep_DS(l, f, pnts, meshlist, imin=0, imax=0.5)\r\n\r\n#---> single segment method - EPA\r\n#pnts = single_segment_EPA(gi, l, xexp, f, error=0)\r\n#plist=linrep_SS(l, f, pnts, meshlist, imin=0, imax=0.5)\r\n\r\n#---> plot segments\r\nplot_segment(ax, plist, cc)\r\n\r\n#---> storing segment data\r\nwritedata(fn, plist)\r\n\r\n# ---> Writting found solutions from given ROs\r\nanalyzesolution(solution, xcoor, plotting=True)\r\n```\r\n\r\n## Documentation\r\n\r\nFor detailed documentation on how to use the library, please visit the [Documentation](https://github.com/mvnayagam/pyPSC.git).\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\r\n\r\n## Contributing\r\n\r\nContributions are welcome! Please fork the repository, make your changes, and submit a pull request. For major changes, open an issue to discuss what you would like to change.\r\n\r\n## Issues\r\n\r\nIf you encounter any problems or have suggestions, feel free to open an issue on the [Issues page](https://github.com/mvnayagam/pyPSC/issues).\r\n\r\n---\r\n\r\nThis `README.md` gives a clear overview of the project, its features, and usage. You can adapt and extend this based on the specifics of your implementation and how your library evolves. Let me know if you need more details!\r\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Muthu Vallinayagam, M. Netwich, M. Zschornak  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, distribute, sublicense, and/or rewrite the structure of the project, but not to sell or publish it as their own, subject to the following conditions:  The Software should only be used for research purposes by institutes, research groups, or individuals for non-commercial activities. It should not be used as a commercial product. The Software is for purely research purposes, and the authors do not hold responsibility for any incorrect or erroneous use of the project.  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Predict crystal structures from available hkl information",
    "version": "0.2.1",
    "project_urls": {
        "Documentation": "https://github.com/mvnayagam/pypsc.git",
        "Issues": "https://github.com/mvnayagam/pypsc/issues",
        "Repository": "https://github.com/mvnayagam/pypsc.git"
    },
    "split_keywords": [
        "x-ray",
        " miller index",
        " python",
        " structure prediction",
        " inequalities",
        " polytope",
        " parameter space",
        " one-dimensionally projected structures"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "42925624a0764c27274168acfa532116db8cfc59d931fc4bf8a452fad39750c8",
                "md5": "2108d51ae3e1ce6358df2b6b136898b9",
                "sha256": "42ddf2e4356fe6a30183f3a799a6a52af8aefaac0123acfec3ed6caf0668c7a7"
            },
            "downloads": -1,
            "filename": "pypsc-0.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2108d51ae3e1ce6358df2b6b136898b9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 76063,
            "upload_time": "2024-09-18T19:03:46",
            "upload_time_iso_8601": "2024-09-18T19:03:46.466205Z",
            "url": "https://files.pythonhosted.org/packages/42/92/5624a0764c27274168acfa532116db8cfc59d931fc4bf8a452fad39750c8/pypsc-0.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "15663a660795c915a19d5890d877cfaa0ca4342aef3fd35930ae8324322103f6",
                "md5": "e2ff7cd9b3f0d23e64261496f92e129e",
                "sha256": "774999b79dc98cf023f095ec9e3e1d5bb6a3f4f380aa08e3fde94a7c35bcd7df"
            },
            "downloads": -1,
            "filename": "pypsc-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "e2ff7cd9b3f0d23e64261496f92e129e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 64373,
            "upload_time": "2024-09-18T19:03:48",
            "upload_time_iso_8601": "2024-09-18T19:03:48.179912Z",
            "url": "https://files.pythonhosted.org/packages/15/66/3a660795c915a19d5890d877cfaa0ca4342aef3fd35930ae8324322103f6/pypsc-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-18 19:03:48",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mvnayagam",
    "github_project": "pypsc",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pypsc"
}
        
Elapsed time: 0.32593s