orcacal


Nameorcacal JSON
Version 0.0.26 PyPI version JSON
download
home_pagehttps://github.com/HTY-DBY/orcacal
Summarytest
upload_time2024-11-14 05:38:47
maintainerNone
docs_urlNone
authorhty2dby
requires_pythonNone
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 1. 前言

`orcacal` 是一个用于通过 Python 调用 ORCA 软件进行计算的库。它封装了常用的计算方法,方便用户在化学计算和模拟中使用。该库旨在简化用户与 ORCA 之间的交互,并提供一个直观的接口来进行各种化学计算。

本人撰写的 ORCA 教程,包含 orcacal 使用示例:<https://blog.csdn.net/weixin_45756789/article/details/143421047>

ORCA 和 orcacal 的视频教程:<https://space.bilibili.com/123772272>

## 1.1. 特性

- 封装 ORCA 常用计算方法,便于调用和使用
- 提供方便的数据获取、处理和化学特性计算
- 简化的 API 设计,易于上手

# 2. 安装

```bash
pip install orcacal  --upgrade
```

# 3. 使用示例

假如你需要在 H2O_1 文件夹内计算:

```
H2O_1/
│── input.inp
```

代码

## 3.1. 简单运行和获取输出

```python
import os
import orcacal
from Test.Goble.GSet import GSet_init

GSet = GSet_init()

input_file_path = os.path.join(
	GSet.ORCA_cal_test_structure, os.path.splitext(os.path.basename(__file__))[0]
)
# %%

project = orcacal.init(GSet.ORCA_ins_path, input_file_path)  # 初始化计算类

calfun = '! HF DEF2-SVP LARGEPRINT'  # 设置计算方法
maxcore = 400  # 设置每个核心的最大内存使用量
nprocs = -1  # 设置使用的核心数
location = orcacal.generate_xyzLocation('C(Cl)(Cl)C')  # 设置原子位置

project.general_set({
	'calfun': calfun,
	'nprocs': nprocs,
	'maxcore': maxcore,
	'location': location
})

# 一样的方法,只不过分开设置了
# project.set_calfun(calfun)
# project.set_location(location)
# project.set_nprocs(nprocs)
# project.set_maxcore(maxcore)

project.run()

# %%

# 获取 [HOMO, LUMO]
[HOMO, LUMO] = project.get.homo_Lumo_eV()
print(f'HOMO: {HOMO} eV, LUMO: {LUMO} eV')
# 获取单点能
single_point_energy_Debye = project.get.single_point_energy_Debye()
print(f'single_point_energy_Debye: {single_point_energy_Debye:.5f} Debye')
# 获取偶极矩
dipolemoment_Debye = project.get.dipolemoment_Debye()
print(f'dipolemoment_Debye:\nTotal--{dipolemoment_Debye[0]:.5f}, X-{dipolemoment_Debye[1]:.5f}, Y-{dipolemoment_Debye[2]:.5f}, Z-{dipolemoment_Debye[3]:.5f} Debye')

```

## 3.3. 便利性的操作

### 3.3.1. 从 SMILES 创建分子对象并生成带电荷和自旋多重度的笛卡尔坐标系 (xyz)

```python
import orcacal

atom_coords = orcacal.generate_xyzLocation("O")
print(atom_coords)

# atom_coords:
# * xyz 0 1
# O 0.008935 0.404022 0.000000
# H -0.787313 -0.184699 0.000000
# H 0.778378 -0.219323 0.000000
# *
```

### 3.3.2. 生成 Molden 文件用于载入其他软件

```python
----
```

## 3.4. 其他说明

输入的文件的命名不一定需要是 input.xxx,这只是默认值,同理输出也不一定命名为 result.xxx,可以查看相应方法的 API,基本都提供了修改方案

例如在`orcacal.run`中设置 input_name 或/和 output_name

`orcacal.run(ORCA_ins_path, input_file_path, input_name='input', output_name='result')`

# 4. API 手册

## 4.1. orcacal

### 4.1.1. orcacal.run

`run(ORCA_ins_path: Path, input_file_path: Path, input_name: str = 'input', output_name: str = 'result') -> None`

执行 ORCA 计算,输出结果保存到同目录下的 result.out 中。

```
Args:
ORCA_ins_path (Path): ORCA 安装目录。
input_file_path (Path): 输入文件所在的路径。
input_name (str): 输入文件的基本名称(不包括扩展名),默认是 'input'。
output_name (str): 输出结果文件的基本名称(不包括扩展名),默认是 'result'。
```

## 4.2. orcacal.get

### 4.2.1. orcacal.get.homo_Lumo_eV

`homo_Lumo_eV(input_file_path: Path, output_name: str = 'result') -> list or None:`

从指定的输出文件中提取 HOMO 和 LUMO 能量值,单位为 eV。

```
Args:
input_file_path (Path): 输入文件的路径,包含输出文件的目录。
output_name (str): 输出文件的名称,不包含扩展名,默认为 'result'。

Returns:
list or None: [HOMO, LUMO],包含 HOMO 和 LUMO 能量值的列表;如果未找到数据,则返回 None。
```

# 5. 在开发的功能

吉布斯能量变换和换算,福井指数

# 6. Star History

[![Star History Chart](https://api.star-history.com/svg?repos=HTY-DBY/orcacal&type=Date)](https://star-history.com/#HTY-DBY/orcacal&Date)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/HTY-DBY/orcacal",
    "name": "orcacal",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "hty2dby",
    "author_email": "hty@hty.ink",
    "download_url": "https://files.pythonhosted.org/packages/f5/da/5cd0eaea824e2801dc587ed2045950d7ebd31d61ed67b82a67acb87d9cd4/orcacal-0.0.26.tar.gz",
    "platform": null,
    "description": "# 1. \u524d\u8a00\r\n\r\n`orcacal` \u662f\u4e00\u4e2a\u7528\u4e8e\u901a\u8fc7 Python \u8c03\u7528 ORCA \u8f6f\u4ef6\u8fdb\u884c\u8ba1\u7b97\u7684\u5e93\u3002\u5b83\u5c01\u88c5\u4e86\u5e38\u7528\u7684\u8ba1\u7b97\u65b9\u6cd5\uff0c\u65b9\u4fbf\u7528\u6237\u5728\u5316\u5b66\u8ba1\u7b97\u548c\u6a21\u62df\u4e2d\u4f7f\u7528\u3002\u8be5\u5e93\u65e8\u5728\u7b80\u5316\u7528\u6237\u4e0e ORCA \u4e4b\u95f4\u7684\u4ea4\u4e92\uff0c\u5e76\u63d0\u4f9b\u4e00\u4e2a\u76f4\u89c2\u7684\u63a5\u53e3\u6765\u8fdb\u884c\u5404\u79cd\u5316\u5b66\u8ba1\u7b97\u3002\r\n\r\n\u672c\u4eba\u64b0\u5199\u7684 ORCA \u6559\u7a0b\uff0c\u5305\u542b orcacal \u4f7f\u7528\u793a\u4f8b\uff1a<https://blog.csdn.net/weixin_45756789/article/details/143421047>\r\n\r\nORCA \u548c orcacal \u7684\u89c6\u9891\u6559\u7a0b\uff1a<https://space.bilibili.com/123772272>\r\n\r\n## 1.1. \u7279\u6027\r\n\r\n- \u5c01\u88c5 ORCA \u5e38\u7528\u8ba1\u7b97\u65b9\u6cd5\uff0c\u4fbf\u4e8e\u8c03\u7528\u548c\u4f7f\u7528\r\n- \u63d0\u4f9b\u65b9\u4fbf\u7684\u6570\u636e\u83b7\u53d6\u3001\u5904\u7406\u548c\u5316\u5b66\u7279\u6027\u8ba1\u7b97\r\n- \u7b80\u5316\u7684 API \u8bbe\u8ba1\uff0c\u6613\u4e8e\u4e0a\u624b\r\n\r\n# 2. \u5b89\u88c5\r\n\r\n```bash\r\npip install orcacal  --upgrade\r\n```\r\n\r\n# 3. \u4f7f\u7528\u793a\u4f8b\r\n\r\n\u5047\u5982\u4f60\u9700\u8981\u5728 H2O_1 \u6587\u4ef6\u5939\u5185\u8ba1\u7b97\uff1a\r\n\r\n```\r\nH2O_1/\r\n\u2502\u2500\u2500 input.inp\r\n```\r\n\r\n\u4ee3\u7801\r\n\r\n## 3.1. \u7b80\u5355\u8fd0\u884c\u548c\u83b7\u53d6\u8f93\u51fa\r\n\r\n```python\r\nimport os\r\nimport orcacal\r\nfrom Test.Goble.GSet import GSet_init\r\n\r\nGSet = GSet_init()\r\n\r\ninput_file_path = os.path.join(\r\n\tGSet.ORCA_cal_test_structure, os.path.splitext(os.path.basename(__file__))[0]\r\n)\r\n# %%\r\n\r\nproject = orcacal.init(GSet.ORCA_ins_path, input_file_path)  # \u521d\u59cb\u5316\u8ba1\u7b97\u7c7b\r\n\r\ncalfun = '! HF DEF2-SVP LARGEPRINT'  # \u8bbe\u7f6e\u8ba1\u7b97\u65b9\u6cd5\r\nmaxcore = 400  # \u8bbe\u7f6e\u6bcf\u4e2a\u6838\u5fc3\u7684\u6700\u5927\u5185\u5b58\u4f7f\u7528\u91cf\r\nnprocs = -1  # \u8bbe\u7f6e\u4f7f\u7528\u7684\u6838\u5fc3\u6570\r\nlocation = orcacal.generate_xyzLocation('C(Cl)(Cl)C')  # \u8bbe\u7f6e\u539f\u5b50\u4f4d\u7f6e\r\n\r\nproject.general_set({\r\n\t'calfun': calfun,\r\n\t'nprocs': nprocs,\r\n\t'maxcore': maxcore,\r\n\t'location': location\r\n})\r\n\r\n# \u4e00\u6837\u7684\u65b9\u6cd5\uff0c\u53ea\u4e0d\u8fc7\u5206\u5f00\u8bbe\u7f6e\u4e86\r\n# project.set_calfun(calfun)\r\n# project.set_location(location)\r\n# project.set_nprocs(nprocs)\r\n# project.set_maxcore(maxcore)\r\n\r\nproject.run()\r\n\r\n# %%\r\n\r\n# \u83b7\u53d6 [HOMO, LUMO]\r\n[HOMO, LUMO] = project.get.homo_Lumo_eV()\r\nprint(f'HOMO: {HOMO} eV, LUMO: {LUMO} eV')\r\n# \u83b7\u53d6\u5355\u70b9\u80fd\r\nsingle_point_energy_Debye = project.get.single_point_energy_Debye()\r\nprint(f'single_point_energy_Debye: {single_point_energy_Debye:.5f} Debye')\r\n# \u83b7\u53d6\u5076\u6781\u77e9\r\ndipolemoment_Debye = project.get.dipolemoment_Debye()\r\nprint(f'dipolemoment_Debye:\\nTotal--{dipolemoment_Debye[0]:.5f}, X-{dipolemoment_Debye[1]:.5f}, Y-{dipolemoment_Debye[2]:.5f}, Z-{dipolemoment_Debye[3]:.5f} Debye')\r\n\r\n```\r\n\r\n## 3.3. \u4fbf\u5229\u6027\u7684\u64cd\u4f5c\r\n\r\n### 3.3.1. \u4ece SMILES \u521b\u5efa\u5206\u5b50\u5bf9\u8c61\u5e76\u751f\u6210\u5e26\u7535\u8377\u548c\u81ea\u65cb\u591a\u91cd\u5ea6\u7684\u7b1b\u5361\u5c14\u5750\u6807\u7cfb (xyz)\r\n\r\n```python\r\nimport orcacal\r\n\r\natom_coords = orcacal.generate_xyzLocation(\"O\")\r\nprint(atom_coords)\r\n\r\n# atom_coords:\r\n# * xyz 0 1\r\n# O 0.008935 0.404022 0.000000\r\n# H -0.787313 -0.184699 0.000000\r\n# H 0.778378 -0.219323 0.000000\r\n# *\r\n```\r\n\r\n### 3.3.2. \u751f\u6210 Molden \u6587\u4ef6\u7528\u4e8e\u8f7d\u5165\u5176\u4ed6\u8f6f\u4ef6\r\n\r\n```python\r\n----\r\n```\r\n\r\n## 3.4. \u5176\u4ed6\u8bf4\u660e\r\n\r\n\u8f93\u5165\u7684\u6587\u4ef6\u7684\u547d\u540d\u4e0d\u4e00\u5b9a\u9700\u8981\u662f input.xxx\uff0c\u8fd9\u53ea\u662f\u9ed8\u8ba4\u503c\uff0c\u540c\u7406\u8f93\u51fa\u4e5f\u4e0d\u4e00\u5b9a\u547d\u540d\u4e3a result.xxx\uff0c\u53ef\u4ee5\u67e5\u770b\u76f8\u5e94\u65b9\u6cd5\u7684 API\uff0c\u57fa\u672c\u90fd\u63d0\u4f9b\u4e86\u4fee\u6539\u65b9\u6848\r\n\r\n\u4f8b\u5982\u5728`orcacal.run`\u4e2d\u8bbe\u7f6e input_name \u6216/\u548c output_name\r\n\r\n`orcacal.run(ORCA_ins_path, input_file_path, input_name='input', output_name='result')`\r\n\r\n# 4. API \u624b\u518c\r\n\r\n## 4.1. orcacal\r\n\r\n### 4.1.1. orcacal.run\r\n\r\n`run(ORCA_ins_path: Path, input_file_path: Path, input_name: str = 'input', output_name: str = 'result') -> None`\r\n\r\n\u6267\u884c ORCA \u8ba1\u7b97\uff0c\u8f93\u51fa\u7ed3\u679c\u4fdd\u5b58\u5230\u540c\u76ee\u5f55\u4e0b\u7684 result.out \u4e2d\u3002\r\n\r\n```\r\nArgs:\r\nORCA_ins_path (Path): ORCA \u5b89\u88c5\u76ee\u5f55\u3002\r\ninput_file_path (Path): \u8f93\u5165\u6587\u4ef6\u6240\u5728\u7684\u8def\u5f84\u3002\r\ninput_name (str): \u8f93\u5165\u6587\u4ef6\u7684\u57fa\u672c\u540d\u79f0\uff08\u4e0d\u5305\u62ec\u6269\u5c55\u540d\uff09\uff0c\u9ed8\u8ba4\u662f 'input'\u3002\r\noutput_name (str): \u8f93\u51fa\u7ed3\u679c\u6587\u4ef6\u7684\u57fa\u672c\u540d\u79f0\uff08\u4e0d\u5305\u62ec\u6269\u5c55\u540d\uff09\uff0c\u9ed8\u8ba4\u662f 'result'\u3002\r\n```\r\n\r\n## 4.2. orcacal.get\r\n\r\n### 4.2.1. orcacal.get.homo_Lumo_eV\r\n\r\n`homo_Lumo_eV(input_file_path: Path, output_name: str = 'result') -> list or None:`\r\n\r\n\u4ece\u6307\u5b9a\u7684\u8f93\u51fa\u6587\u4ef6\u4e2d\u63d0\u53d6 HOMO \u548c LUMO \u80fd\u91cf\u503c\uff0c\u5355\u4f4d\u4e3a eV\u3002\r\n\r\n```\r\nArgs:\r\ninput_file_path (Path): \u8f93\u5165\u6587\u4ef6\u7684\u8def\u5f84\uff0c\u5305\u542b\u8f93\u51fa\u6587\u4ef6\u7684\u76ee\u5f55\u3002\r\noutput_name (str): \u8f93\u51fa\u6587\u4ef6\u7684\u540d\u79f0\uff0c\u4e0d\u5305\u542b\u6269\u5c55\u540d\uff0c\u9ed8\u8ba4\u4e3a 'result'\u3002\r\n\r\nReturns:\r\nlist or None: [HOMO, LUMO]\uff0c\u5305\u542b HOMO \u548c LUMO \u80fd\u91cf\u503c\u7684\u5217\u8868\uff1b\u5982\u679c\u672a\u627e\u5230\u6570\u636e\uff0c\u5219\u8fd4\u56de None\u3002\r\n```\r\n\r\n# 5. \u5728\u5f00\u53d1\u7684\u529f\u80fd\r\n\r\n\u5409\u5e03\u65af\u80fd\u91cf\u53d8\u6362\u548c\u6362\u7b97\uff0c\u798f\u4e95\u6307\u6570\r\n\r\n# 6. Star History\r\n\r\n[![Star History Chart](https://api.star-history.com/svg?repos=HTY-DBY/orcacal&type=Date)](https://star-history.com/#HTY-DBY/orcacal&Date)\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "test",
    "version": "0.0.26",
    "project_urls": {
        "Homepage": "https://github.com/HTY-DBY/orcacal"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fe0e289b228a1505cc23c47b1f9554a0d68598d0c7f6449a763421fbca8ed0fd",
                "md5": "cf2742c3008f7273c374c5630e247c9c",
                "sha256": "bce859e769e76f9de45aabda4097a9f27eb808e21d999aa79b7c7f74d396bb47"
            },
            "downloads": -1,
            "filename": "orcacal-0.0.26-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cf2742c3008f7273c374c5630e247c9c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 14541976,
            "upload_time": "2024-11-14T05:38:36",
            "upload_time_iso_8601": "2024-11-14T05:38:36.564388Z",
            "url": "https://files.pythonhosted.org/packages/fe/0e/289b228a1505cc23c47b1f9554a0d68598d0c7f6449a763421fbca8ed0fd/orcacal-0.0.26-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f5da5cd0eaea824e2801dc587ed2045950d7ebd31d61ed67b82a67acb87d9cd4",
                "md5": "4bd411bc88897d6a526c57a5517f3244",
                "sha256": "29822049797f639e5974ecd72b2c5c7379781d43b1ed5c26427f459aa52ace3a"
            },
            "downloads": -1,
            "filename": "orcacal-0.0.26.tar.gz",
            "has_sig": false,
            "md5_digest": "4bd411bc88897d6a526c57a5517f3244",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 14431609,
            "upload_time": "2024-11-14T05:38:47",
            "upload_time_iso_8601": "2024-11-14T05:38:47.049901Z",
            "url": "https://files.pythonhosted.org/packages/f5/da/5cd0eaea824e2801dc587ed2045950d7ebd31d61ed67b82a67acb87d9cd4/orcacal-0.0.26.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-14 05:38:47",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "HTY-DBY",
    "github_project": "orcacal",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "orcacal"
}
        
Elapsed time: 0.31009s