# CCS_fit - Fitting using Curvature Constrained Splines
[![PyPI](https://img.shields.io/pypi/v/ccs_fit?color=g)](https://pypi.org/project/ccs-fit/)
[![License](https://img.shields.io/github/license/teoroo-cmc/ccs)](https://opensource.org/licenses/LGPL-3.0)
[![DOI](https://img.shields.io/badge/DOI-10.1016%2Fj.cpc.2020.107602-blue)](https://doi.org/10.1016/j.cpc.2020.107602)
[![Build](https://img.shields.io/github/actions/workflow/status/teoroo-cmc/CCS/ci-cd.yml)](https://github.com/Teoroo-CMC/CCS/actions)
[![Documentation](https://img.shields.io/badge/Github%20Pages-CCS_fit-orange)](https://teoroo-cmc.github.io/CCS/)
[![Python version](https://img.shields.io/pypi/pyversions/ccs_fit)](https://pypi.org/project/ccs-fit/)
<!--- [![Build Status](https://github.com/tblite/tblite/workflows/CI/badge.svg)](https://github.com/tblite/tblite/actions)
[![Latest Release](https://img.shields.io/github/v/release/teoroo-cmc/ccs?display_name=tag&color=brightgreen&sort=semver)](https://github.com/Teoroo-CMC/CCS/releases/latest)
[![Documentation](https://img.shields.io/badge/Github%20Pages-Pages-blue)](https://teoroo-cmc.github.io/CCS/)
[![codecov](https://codecov.io/gh/tblite/tblite/branch/main/graph/badge.svg?token=JXIE6myqNH)](https://codecov.io/gh/tblite/tblite)
[![Coverage](codecov.io/gh/:vcsName/:user/:repo?flag=flag_name&token=a1b2c3d4e5)(https://github.com/Teoroo-CMC/CCS/actions)
--->
![](logo.png)
The `CCS_fit` package is a tool to construct two-body potentials using the idea of curvature constrained splines.
## Getting Started
### Package Layout
```
ccs_fit-x.y.z
├── CHANGELOG.md
├── LICENSE
├── MANIFEST.in
├── README.md
├── bin
│ ├── ccs_build_db
│ ├── ccs_export_sktable
| ├── ccs_export_FF
│ ├── ccs_fetch
│ ├── ccs_fit
│ └── ccs_validate
├── docs
├── examples
│ └── Basic_Tutorial
│ └── tutorial.ipynb
│ └── Advanced_Tutorials
│ ├── CCS
│ ├── CCS_with_LAMMPS
│ ├── DFTB_repulsive_fitting
│ ├── ppmd_interfacing
│ ├── Preparing_ASE_db_trainingsets
│ ├── Search_mode
│ └── Simple_regressor
├── logo.png
├── poetry.lock
├── pyproject.toml
├── src
│ └── ccs
│ ├── ase_calculator
│ ├── common
│ ├── data
│ ├── debugging_tools
│ ├── fitting
│ ├── ppmd_interface
│ ├── regression_tool
│ └── scripts
│ ├── ccs_build_db.py
│ ├── ccs_export_FF.py
│ ├── ccs_export_sktable.py
│ ├── ccs_fetch.py
│ ├── ccs_fit.py
│ └── ccs_validate.py
└── tests
```
* `ccs_build_db` - Routine that builds an ASE-database.
* `ccs_fetch` - Executable to construct the traning-set (structures.json) from a pre-existing ASE-database.
* `ccs_fit` - The primary executable file for the ccs_fit package.
* `ccs_export_sktable` - Export the spline in a dftbplus-compatible layout.
* `ccs_export_FF` - Fit the spline to commonly employed force fields; Buckingham, Morse and Lennard Jones.
* `ccs_validate` - Validation of the energies and forces of the fit compared to the training set.
* `main.py` - A module to parse input files.
* `objective.py` - A module which contains the objective function and solver.
* `spline_functions.py` - A module for spline construction/evaluation/output.
<!---
### Prerequisites
You need to install the following softwares
```
pip install numpy
pip install scipy
pip install ase
pip install cvxopt
```
### Installing from source
#### Git clone
```
git clone git@github.com/Teoroo-CMC/CCS.git
cd CCS
python setup.py install
```
--->
### (Recommended) installing from pip
```
pip install ccs_fit
```
### Installing from source using poetry
```
git clone https://github.com/Teoroo-CMC/CCS_fit.git ccs_fit
cd ccs_fit
# Install python package manager poetry (see https://python-poetry.org/docs/ for more explicit installation instructions)
curl -sSL https://install.python-poetry.org | python3 -
# You might have to add poetry to your PATH
poetry --version # to see if poetry installed correctly
poetry install # to install ccs_fit
```
<!---
### Environment Variables
Set the following environment variables:
```
$export PYTHONPATH=<path-to-CCS-package>:$PYTHONPATH
$export PATH=<path-to-CCS-bin>:$PATH
Within a conda virtual environment, you can update the path by using:
conda develop <path-to-CCS-package>
```
--->
## Tutorials
We provide tutorials in the [examples](examples/) folder. To run the example, go to one of the folders. Each contain the neccesery input files required for the task at hand. A sample `CCS_input.json` for O$_2$ is shown below:
```
{
"General": {
"interface": "CCS"
},
"Train-set": "structures.json",
"Twobody": {
"O-O": {
"Rcut": 2.5,
"Resolution": 0.02,
"Swtype": "sw"
}
},
"Onebody": [
"O"
]
}
```
The `CCS_input.json` file should provide at a minimum the block "General" specifying an interface. The default is to look for input structures in the file `structure.json` file. The format for `structure.json` is shown below :
```
{
"energies":{
"S1": {
"Energy": -4.22425752,
"Atoms": {
"O": 2
},
"O-O": [
0.96
]
},
"S2": {
"Energy": -5.29665634,
"Atoms": {
"O": 2
},
"O-O": [
0.98
]
},
"S3": {
"Energy": -6.20910363,
"Atoms": {
"O": 2
},
"O-O": [
1.0
]
},
"S4": {
"Energy": -6.98075271,
"Atoms": {
"O": 2
},
"O-O": [
1.02
]
}
}
}
```
The `structure.json` file contains different configurations labeled ("S1", "S2"...) and corresponding energy, pairwise distances (contained in an array labelled as "O-O" for oxygen). The stoichiometry of each configuration is given under the atoms label ("Atoms") as a key-value pair ("O" : 2 ).
To perform the fit :
```
ccs_fit
```
The following output files are obtained:
```
CCS_params.json CCS_error.out ccs.log
```
* CCS_params.json - Contains the spline coefficients, and one-body terms for two body potentials.
* error.out - Contains target energies, predicted energies and absolute error for each configuration.
* ccs.log - Contains debug information
## Authors
* **Akshay Krishna AK**
* **Jolla Kullgren**
* **Eddie Wadbro**
* **Peter Broqvist**
* **Thijs Smolders**
## Funding
This project has received funding from the European Union's Horizon 2020 research and innovation programme under grant agreement No 957189, and the Swedish National Strategic e-Science programme eSSENCE. The project is part of BATTERY 2030+, the large-scale European research initiative for inventing the sustainable batteries of the future.
## License
This project is licensed under the GPLv3 License - see the [LICENSE](LICENSE) file for details.
## Acknowledgement
We want to thank Pavlin Mitev, Christof Köhler, Matthew Wolf, Kersti Hermansson, Bálint Aradi and Tammo van der Heide, and all the members of the [TEOROO-group](http://www.teoroo.kemi.uu.se/) at Uppsala University, Sweden for fruitful discussions and general support.
Raw data
{
"_id": null,
"home_page": "https://github.com/Teoroo-CMC/CCS",
"name": "ccs-fit",
"maintainer": "Jolla Kullgren",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "jolla.kullgren@kemi.uu.se",
"keywords": "Curvature,Constrained,Splines,Two-Body,Interatomic,Repulsive,Fitting",
"author": "Akshay Krishna AK",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/d8/b3/b3d9590e6bd8e63935480e831421e2c71f4c948be545fc282f1248c7ae51/ccs_fit-0.22.5.tar.gz",
"platform": null,
"description": "# CCS_fit - Fitting using Curvature Constrained Splines \n\n[![PyPI](https://img.shields.io/pypi/v/ccs_fit?color=g)](https://pypi.org/project/ccs-fit/)\n[![License](https://img.shields.io/github/license/teoroo-cmc/ccs)](https://opensource.org/licenses/LGPL-3.0)\n[![DOI](https://img.shields.io/badge/DOI-10.1016%2Fj.cpc.2020.107602-blue)](https://doi.org/10.1016/j.cpc.2020.107602)\n[![Build](https://img.shields.io/github/actions/workflow/status/teoroo-cmc/CCS/ci-cd.yml)](https://github.com/Teoroo-CMC/CCS/actions)\n[![Documentation](https://img.shields.io/badge/Github%20Pages-CCS_fit-orange)](https://teoroo-cmc.github.io/CCS/)\n[![Python version](https://img.shields.io/pypi/pyversions/ccs_fit)](https://pypi.org/project/ccs-fit/)\n\n<!--- [![Build Status](https://github.com/tblite/tblite/workflows/CI/badge.svg)](https://github.com/tblite/tblite/actions)\n[![Latest Release](https://img.shields.io/github/v/release/teoroo-cmc/ccs?display_name=tag&color=brightgreen&sort=semver)](https://github.com/Teoroo-CMC/CCS/releases/latest)\n[![Documentation](https://img.shields.io/badge/Github%20Pages-Pages-blue)](https://teoroo-cmc.github.io/CCS/)\n[![codecov](https://codecov.io/gh/tblite/tblite/branch/main/graph/badge.svg?token=JXIE6myqNH)](https://codecov.io/gh/tblite/tblite) \n[![Coverage](codecov.io/gh/:vcsName/:user/:repo?flag=flag_name&token=a1b2c3d4e5)(https://github.com/Teoroo-CMC/CCS/actions)\n--->\n\n![](logo.png)\n\nThe `CCS_fit` package is a tool to construct two-body potentials using the idea of curvature constrained splines.\n## Getting Started\n### Package Layout\n\n```\nccs_fit-x.y.z\n\u251c\u2500\u2500 CHANGELOG.md\n\u251c\u2500\u2500 LICENSE\n\u251c\u2500\u2500 MANIFEST.in\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 bin\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 ccs_build_db\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 ccs_export_sktable\n| \u251c\u2500\u2500 ccs_export_FF\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 ccs_fetch\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 ccs_fit\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 ccs_validate\n\u251c\u2500\u2500 docs\n\u251c\u2500\u2500 examples\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 Basic_Tutorial\n\u2502\u00a0\u00a0 \u00a0\u00a0 \u2514\u2500\u2500 tutorial.ipynb\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 Advanced_Tutorials\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 CCS\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 CCS_with_LAMMPS\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 DFTB_repulsive_fitting\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 ppmd_interfacing\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 Preparing_ASE_db_trainingsets\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 Search_mode\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 Simple_regressor\n\u251c\u2500\u2500 logo.png\n\u251c\u2500\u2500 poetry.lock\n\u251c\u2500\u2500 pyproject.toml\n\u251c\u2500\u2500 src\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 ccs\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 ase_calculator\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 common\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 data\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 debugging_tools\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 fitting\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 ppmd_interface\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 regression_tool\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 scripts\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 ccs_build_db.py\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 ccs_export_FF.py\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 ccs_export_sktable.py\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 ccs_fetch.py\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 ccs_fit.py\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 ccs_validate.py\n\u2514\u2500\u2500 tests\n```\n\n* `ccs_build_db` - Routine that builds an ASE-database.\n* `ccs_fetch` - Executable to construct the traning-set (structures.json) from a pre-existing ASE-database.\n* `ccs_fit` - The primary executable file for the ccs_fit package.\n* `ccs_export_sktable` - Export the spline in a dftbplus-compatible layout.\n* `ccs_export_FF` - Fit the spline to commonly employed force fields; Buckingham, Morse and Lennard Jones.\n* `ccs_validate` - Validation of the energies and forces of the fit compared to the training set.\n* `main.py` - A module to parse input files.\n* `objective.py` - A module which contains the objective function and solver.\n* `spline_functions.py` - A module for spline construction/evaluation/output. \n\n<!---\n### Prerequisites\n\nYou need to install the following softwares\n```\npip install numpy\npip install scipy\npip install ase\npip install cvxopt\n```\n### Installing from source\n\n#### Git clone\n\n```\ngit clone git@github.com/Teoroo-CMC/CCS.git\ncd CCS\npython setup.py install\n```\n--->\n\n### (Recommended) installing from pip\n```\npip install ccs_fit\n```\n\n### Installing from source using poetry\n```\ngit clone https://github.com/Teoroo-CMC/CCS_fit.git ccs_fit\ncd ccs_fit\n\n# Install python package manager poetry (see https://python-poetry.org/docs/ for more explicit installation instructions)\ncurl -sSL https://install.python-poetry.org | python3 -\n# You might have to add poetry to your PATH\npoetry --version # to see if poetry installed correctly\npoetry install # to install ccs_fit\n```\n<!---\n### Environment Variables\nSet the following environment variables:\n```\n$export PYTHONPATH=<path-to-CCS-package>:$PYTHONPATH\n$export PATH=<path-to-CCS-bin>:$PATH\n\nWithin a conda virtual environment, you can update the path by using:\nconda develop <path-to-CCS-package>\n```\n--->\n\n## Tutorials\n\nWe provide tutorials in the [examples](examples/) folder. To run the example, go to one of the folders. Each contain the neccesery input files required for the task at hand. A sample `CCS_input.json` for O$_2$ is shown below:\n```\n{\n \"General\": {\n \"interface\": \"CCS\"\n },\n \"Train-set\": \"structures.json\",\n \"Twobody\": {\n \"O-O\": {\n \"Rcut\": 2.5,\n \"Resolution\": 0.02,\n \"Swtype\": \"sw\"\n }\n },\n \"Onebody\": [\n \"O\"\n ]\n}\n\n```\nThe `CCS_input.json` file should provide at a minimum the block \"General\" specifying an interface. The default is to look for input structures in the file `structure.json` file. The format for `structure.json` is shown below :\n```\n{\n\"energies\":{\n \"S1\": {\n \"Energy\": -4.22425752,\n \"Atoms\": {\n \"O\": 2\n },\n \"O-O\": [\n 0.96\n ]\n },\n \"S2\": {\n \"Energy\": -5.29665634,\n \"Atoms\": {\n \"O\": 2\n },\n \"O-O\": [\n 0.98\n ]\n },\n \"S3\": {\n \"Energy\": -6.20910363,\n \"Atoms\": {\n \"O\": 2\n },\n \"O-O\": [\n 1.0\n ]\n },\n \"S4\": {\n \"Energy\": -6.98075271,\n \"Atoms\": {\n \"O\": 2\n },\n \"O-O\": [\n 1.02\n ]\n }\n}\n}\n```\nThe `structure.json` file contains different configurations labeled (\"S1\", \"S2\"...) and corresponding energy, pairwise distances (contained in an array labelled as \"O-O\" for oxygen). The stoichiometry of each configuration is given under the atoms label (\"Atoms\") as a key-value pair (\"O\" : 2 ). \n\n\nTo perform the fit : \n```\nccs_fit\n```\nThe following output files are obtained:\n```\nCCS_params.json CCS_error.out ccs.log \n```\n* CCS_params.json - Contains the spline coefficients, and one-body terms for two body potentials.\n* error.out - Contains target energies, predicted energies and absolute error for each configuration.\n* ccs.log - Contains debug information\n## Authors\n\n* **Akshay Krishna AK** \n* **Jolla Kullgren** \n* **Eddie Wadbro** \n* **Peter Broqvist**\n* **Thijs Smolders**\n\n## Funding\nThis project has received funding from the European Union's Horizon 2020 research and innovation programme under grant agreement No 957189, and the Swedish National Strategic e-Science programme eSSENCE. The project is part of BATTERY 2030+, the large-scale European research initiative for inventing the sustainable batteries of the future.\n\n## License\nThis project is licensed under the GPLv3 License - see the [LICENSE](LICENSE) file for details.\n\n## Acknowledgement\nWe want to thank Pavlin Mitev, Christof K\u00f6hler, Matthew Wolf, Kersti Hermansson, B\u00e1lint Aradi and Tammo van der Heide, and all the members of the [TEOROO-group](http://www.teoroo.kemi.uu.se/) at Uppsala University, Sweden for fruitful discussions and general support.\n\n",
"bugtrack_url": null,
"license": "GPL-3",
"summary": "Fitting tools for repulsive two body interactions using curvature constrained splines.",
"version": "0.22.5",
"project_urls": {
"Documentation": "https://teoroo-cmc.github.io/CCS/index.html",
"Homepage": "https://github.com/Teoroo-CMC/CCS",
"Repository": "https://github.com/Teoroo-CMC/CCS"
},
"split_keywords": [
"curvature",
"constrained",
"splines",
"two-body",
"interatomic",
"repulsive",
"fitting"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2d0653146d03c16b87353d66e22d3fa70057e98b123752f5b5303a91e02bcf52",
"md5": "1d4d3dc0b0bff854995910e575d4ffc7",
"sha256": "d2818c31aa6edb05b446a0b800de5130afa408cba2f172c8d95a84c686c996c9"
},
"downloads": -1,
"filename": "ccs_fit-0.22.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1d4d3dc0b0bff854995910e575d4ffc7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 71956,
"upload_time": "2024-02-16T09:31:34",
"upload_time_iso_8601": "2024-02-16T09:31:34.556293Z",
"url": "https://files.pythonhosted.org/packages/2d/06/53146d03c16b87353d66e22d3fa70057e98b123752f5b5303a91e02bcf52/ccs_fit-0.22.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d8b3b3d9590e6bd8e63935480e831421e2c71f4c948be545fc282f1248c7ae51",
"md5": "4cd6c14752c7c34b53ff6771780e0377",
"sha256": "e2b09fc14115a817dc3cafd65d20a238326fc3bb562b51aefa9b8633ed216e83"
},
"downloads": -1,
"filename": "ccs_fit-0.22.5.tar.gz",
"has_sig": false,
"md5_digest": "4cd6c14752c7c34b53ff6771780e0377",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 53440,
"upload_time": "2024-02-16T09:31:36",
"upload_time_iso_8601": "2024-02-16T09:31:36.927834Z",
"url": "https://files.pythonhosted.org/packages/d8/b3/b3d9590e6bd8e63935480e831421e2c71f4c948be545fc282f1248c7ae51/ccs_fit-0.22.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-16 09:31:36",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Teoroo-CMC",
"github_project": "CCS",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "ccs-fit"
}