ion-CSP 2.1.4__py3-none-any.whl → 2.1.8__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. ion_CSP/__init__.py +2 -2
  2. ion_CSP/convert_SMILES.py +32 -10
  3. ion_CSP/empirical_estimate.py +136 -18
  4. ion_CSP/gen_opt.py +83 -33
  5. ion_CSP/identify_molecules.py +15 -0
  6. ion_CSP/log_and_time.py +55 -8
  7. ion_CSP/mlp_opt.py +52 -6
  8. ion_CSP/model/model.pt +0 -0
  9. ion_CSP/model/options/README.md +5 -0
  10. ion_CSP/model/options/model.ckpt-4000000.pt +0 -0
  11. ion_CSP/param/INCAR_0 +16 -0
  12. ion_CSP/param/INCAR_1 +19 -0
  13. ion_CSP/param/INCAR_2 +19 -0
  14. ion_CSP/param/INCAR_3 +19 -0
  15. ion_CSP/param/POTCAR_C +2319 -0
  16. ion_CSP/param/POTCAR_H +1563 -0
  17. ion_CSP/param/POTCAR_N +2351 -0
  18. ion_CSP/param/POTCAR_O +2487 -0
  19. ion_CSP/param/g16_sub.sh +21 -0
  20. ion_CSP/param/sub_final.sh +91 -0
  21. ion_CSP/param/sub_ori.sh +74 -0
  22. ion_CSP/param/sub_supple.sh +56 -0
  23. ion_CSP/read_mlp_density.py +15 -1
  24. ion_CSP/task_manager.py +2 -2
  25. ion_CSP/upload_download.py +0 -1
  26. ion_CSP/vasp_processing.py +48 -20
  27. {ion_csp-2.1.4.dist-info → ion_csp-2.1.8.dist-info}/METADATA +45 -16
  28. ion_csp-2.1.8.dist-info/RECORD +43 -0
  29. {ion_csp-2.1.4.dist-info → ion_csp-2.1.8.dist-info}/licenses/LICENSE +1 -1
  30. {ion_csp-2.1.4.dist-info → ion_csp-2.1.8.dist-info}/top_level.txt +0 -1
  31. ion_csp-2.1.4.dist-info/RECORD +0 -28
  32. {run → ion_CSP/run}/__init__.py +0 -0
  33. {run → ion_CSP/run}/main_CSP.py +0 -0
  34. {run → ion_CSP/run}/main_EE.py +0 -0
  35. {run → ion_CSP/run}/run_convert_SMILES.py +0 -0
  36. {run → ion_CSP/run}/run_empirical_estimate.py +0 -0
  37. {run → ion_CSP/run}/run_gen_opt.py +0 -0
  38. {run → ion_CSP/run}/run_read_mlp_density.py +0 -0
  39. {run → ion_CSP/run}/run_upload_download.py +0 -0
  40. {run → ion_CSP/run}/run_vasp_processing.py +0 -0
  41. {ion_csp-2.1.4.dist-info → ion_csp-2.1.8.dist-info}/WHEEL +0 -0
  42. {ion_csp-2.1.4.dist-info → ion_csp-2.1.8.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,21 @@
1
+ #!/bin/bash
2
+
3
+ BASE_DIR="./"
4
+
5
+ # 遍历所有.gjf文件
6
+ for gjf in "$BASE_DIR"/*.gjf; do
7
+ # 安全校验文件存在性
8
+ [ -f "$gjf" ] || { echo "Skipping invalid file: $gjf"; continue; }
9
+
10
+ # 提取带路径的文件名
11
+ full_name=$(basename "$gjf")
12
+
13
+ # 安全提取基名(严格去除最后一个.gjf后缀)
14
+ base_name="${full_name%.*}"
15
+
16
+ # 执行命令(示例)
17
+ g16 "$gjf" && formchk "${base_name}.chk"
18
+ if [ $? -ne 0 ] ; then
19
+ touch "${base_name}.fchk"
20
+ fi
21
+ done
@@ -0,0 +1,91 @@
1
+ #!/bin/bash
2
+
3
+ # 设置变量
4
+ BASE_DIR="./"
5
+ INCAR_1="INCAR_1"
6
+ INCAR_2="INCAR_2"
7
+ INCAR_3="INCAR_3"
8
+ POTCAR_H="POTCAR_H"
9
+ POTCAR_C="POTCAR_C"
10
+ POTCAR_N="POTCAR_N"
11
+ POTCAR_O="POTCAR_O"
12
+
13
+ # 检查必要文件是否存在
14
+ if [[ ! -f "$INCAR_1" || ! -f "$INCAR_2" || ! -f "$INCAR_3" || ! -f "$POTCAR_H" || ! -f "$POTCAR_C" || ! -f "$POTCAR_N" || ! -f "$POTCAR_O" ]]; then
15
+ echo "Necessary files are missing, please check the path."
16
+ exit 1
17
+ fi
18
+
19
+ # 创建 POTCAR 文件
20
+ create_potcar_from_poscar() {
21
+ poscar_file="$1"
22
+ output_file="POTCAR"
23
+ > "$output_file" # 清空文件
24
+
25
+ # 读取 POSCAR 文件的第六行(元素行)
26
+ read -r element_line < <(sed -n '6p' "$poscar_file")
27
+
28
+ # 将元素转换为数组
29
+ IFS=' ' read -r -a elements <<< "$element_line"
30
+
31
+ # 根据元素拼接 POTCAR
32
+ for element in "${elements[@]}"; do
33
+ case $element in
34
+ H) cat "$POTCAR_H" >> "$output_file" ;;
35
+ C) cat "$POTCAR_C" >> "$output_file" ;;
36
+ N) cat "$POTCAR_N" >> "$output_file" ;;
37
+ O) cat "$POTCAR_O" >> "$output_file" ;;
38
+ *) echo "Warning: POTCAR for element $element not found." ;;
39
+ esac
40
+ done
41
+ }
42
+
43
+ # 提交第一步优化任务
44
+ for contcar in ${BASE_DIR}/CONTCAR_*; do
45
+ if [[ $contcar =~ CONTCAR_(.*) ]]; then
46
+ sample=${BASH_REMATCH[1]}
47
+ sample_dir="${BASE_DIR}/${sample}"
48
+ mkdir -p "$sample_dir"
49
+ cp "$contcar" "${sample_dir}/POSCAR"
50
+ cp "$INCAR_1" "${sample_dir}/INCAR"
51
+ create_potcar_from_poscar "${sample_dir}/POSCAR" # 根据 POSCAR 创建 POTCAR
52
+ mv "POTCAR" "${sample_dir}/" # 使用自动生成的 POTCAR
53
+ original_dir=$(pwd) # 保存当前目录
54
+ cd "${sample_dir}" && mpirun -n ${DPDISPATCHER_CPU_PER_NODE} vasp_std > vasp.log 2>&1
55
+ cd $original_dir # 返回原始工作目录
56
+ fi
57
+ done
58
+
59
+ echo "All first step tasks have been submitted."
60
+
61
+ # 提交第二步优化任务
62
+ for sample in $(ls ${BASE_DIR}); do
63
+ if [ -f "${BASE_DIR}/${sample}/CONTCAR" ]; then
64
+ sample_dir="${BASE_DIR}/${sample}"
65
+ mkdir -p "${sample_dir}/fine"
66
+ cp "${sample_dir}/CONTCAR" "${sample_dir}/fine/POSCAR"
67
+ cp "$INCAR_2" "${sample_dir}/fine/INCAR"
68
+ cp "${sample_dir}/POTCAR" "${sample_dir}/fine/POTCAR"
69
+ original_dir=$(pwd) # 保存当前目录
70
+ cd "${sample_dir}/fine" && mpirun -n ${DPDISPATCHER_CPU_PER_NODE} vasp_std > vasp.log 2>&1
71
+ cd $original_dir # 返回原始工作目录
72
+ fi
73
+ done
74
+
75
+ echo "All second step tasks have been submitted."
76
+
77
+ # 提交第三步优化任务
78
+ for sample in $(ls ${BASE_DIR}); do
79
+ if [ -f "${BASE_DIR}/${sample}/fine/CONTCAR" ]; then
80
+ sample_dir="${BASE_DIR}/${sample}"
81
+ mkdir -p "${sample_dir}/fine/final"
82
+ cp "${sample_dir}/fine/CONTCAR" "${sample_dir}/fine/final/POSCAR"
83
+ cp "$INCAR_3" "${sample_dir}/fine/final/INCAR"
84
+ cp "${sample_dir}/fine/POTCAR" "${sample_dir}/fine/final/POTCAR"
85
+ original_dir=$(pwd) # 保存当前目录
86
+ cd "${sample_dir}/fine/final" && mpirun -n ${DPDISPATCHER_CPU_PER_NODE} vasp_std > vasp.log 2>&1
87
+ cd $original_dir # 返回原始工作目录
88
+ fi
89
+ done
90
+
91
+ echo "All third step tasks have been submitted."
@@ -0,0 +1,74 @@
1
+ #!/bin/bash
2
+
3
+ # 设置变量
4
+ BASE_DIR="./"
5
+ INCAR_1="INCAR_1"
6
+ INCAR_2="INCAR_2"
7
+ POTCAR_H="POTCAR_H"
8
+ POTCAR_C="POTCAR_C"
9
+ POTCAR_N="POTCAR_N"
10
+ POTCAR_O="POTCAR_O"
11
+
12
+ # 检查必要文件是否存在
13
+ if [[ ! -f "$INCAR_1" || ! -f "$INCAR_2" || ! -f "$POTCAR_H" || ! -f "$POTCAR_C" || ! -f "$POTCAR_N" || ! -f "$POTCAR_O" ]]; then
14
+ echo "Necessary files are missing, please check the path."
15
+ exit 1
16
+ fi
17
+
18
+ # 创建 POTCAR 文件
19
+ create_potcar_from_poscar() {
20
+ poscar_file="$1"
21
+ output_file="POTCAR"
22
+ > "$output_file" # 清空文件
23
+
24
+ # 读取 POSCAR 文件的第六行(元素行)
25
+ read -r element_line < <(sed -n '6p' "$poscar_file")
26
+
27
+ # 将元素转换为数组
28
+ IFS=' ' read -r -a elements <<< "$element_line"
29
+
30
+ # 根据元素拼接 POTCAR
31
+ for element in "${elements[@]}"; do
32
+ case $element in
33
+ H) cat "$POTCAR_H" >> "$output_file" ;;
34
+ C) cat "$POTCAR_C" >> "$output_file" ;;
35
+ N) cat "$POTCAR_N" >> "$output_file" ;;
36
+ O) cat "$POTCAR_O" >> "$output_file" ;;
37
+ *) echo "Warning: POTCAR for element $element not found." ;;
38
+ esac
39
+ done
40
+ }
41
+
42
+ # 提交第一步优化任务
43
+ for contcar in ${BASE_DIR}/CONTCAR_*; do
44
+ if [[ $contcar =~ CONTCAR_(.*) ]]; then
45
+ sample=${BASH_REMATCH[1]}
46
+ sample_dir="${BASE_DIR}/${sample}"
47
+ mkdir -p "$sample_dir"
48
+ cp "$contcar" "${sample_dir}/POSCAR"
49
+ cp "$INCAR_1" "${sample_dir}/INCAR"
50
+ create_potcar_from_poscar "${sample_dir}/POSCAR" # 根据 POSCAR 创建 POTCAR
51
+ mv "POTCAR" "${sample_dir}/" # 使用自动生成的 POTCAR
52
+ original_dir=$(pwd) # 保存当前目录
53
+ cd "${sample_dir}" && mpirun -n ${DPDISPATCHER_CPU_PER_NODE} vasp_std > vasp.log 2>&1
54
+ cd $original_dir # 返回原始工作目录
55
+ fi
56
+ done
57
+
58
+ echo "All first step tasks have been submitted."
59
+
60
+ # 提交第二步优化任务
61
+ for sample in $(ls ${BASE_DIR}); do
62
+ if [ -f "${BASE_DIR}/${sample}/CONTCAR" ]; then
63
+ sample_dir="${BASE_DIR}/${sample}"
64
+ mkdir -p "${sample_dir}/fine"
65
+ cp "${sample_dir}/CONTCAR" "${sample_dir}/fine/POSCAR"
66
+ cp "$INCAR_2" "${sample_dir}/fine/INCAR"
67
+ cp "${sample_dir}/POTCAR" "${sample_dir}/fine/"
68
+ original_dir=$(pwd) # 保存当前目录
69
+ cd "${sample_dir}/fine" && mpirun -n ${DPDISPATCHER_CPU_PER_NODE} vasp_std > vasp.log 2>&1
70
+ cd $original_dir # 返回原始工作目录
71
+ fi
72
+ done
73
+
74
+ echo "All second step tasks have been submitted."
@@ -0,0 +1,56 @@
1
+ #!/bin/bash
2
+
3
+ # 设置变量
4
+ BASE_DIR="./"
5
+ INCAR_3="INCAR_3"
6
+ POTCAR_H="POTCAR_H"
7
+ POTCAR_C="POTCAR_C"
8
+ POTCAR_N="POTCAR_N"
9
+ POTCAR_O="POTCAR_O"
10
+
11
+ # 检查必要文件是否存在
12
+ if [[ ! -f "$INCAR_3" || ! -f "$POTCAR_H" || ! -f "$POTCAR_C" || ! -f "$POTCAR_N" || ! -f "$POTCAR_O" ]]; then
13
+ echo "Necessary files are missing, please check the path."
14
+ exit 1
15
+ fi
16
+
17
+ # 创建 POTCAR 文件
18
+ create_potcar_from_poscar() {
19
+ poscar_file="$1"
20
+ output_file="POTCAR"
21
+ > "$output_file" # 清空文件
22
+
23
+ # 读取 POSCAR 文件的第六行(元素行)
24
+ read -r element_line < <(sed -n '6p' "$poscar_file")
25
+
26
+ # 将元素转换为数组
27
+ IFS=' ' read -r -a elements <<< "$element_line"
28
+
29
+ # 根据元素拼接 POTCAR
30
+ for element in "${elements[@]}"; do
31
+ case $element in
32
+ H) cat "$POTCAR_H" >> "$output_file" ;;
33
+ C) cat "$POTCAR_C" >> "$output_file" ;;
34
+ N) cat "$POTCAR_N" >> "$output_file" ;;
35
+ O) cat "$POTCAR_O" >> "$output_file" ;;
36
+ *) echo "Warning: POTCAR for element $element not found." ;;
37
+ esac
38
+ done
39
+ }
40
+
41
+ # 提交第三步优化任务
42
+ for sample in $(ls ${BASE_DIR}); do
43
+ if [ -f "${BASE_DIR}/${sample}/fine/CONTCAR" ]; then
44
+ sample_dir="${BASE_DIR}/${sample}"
45
+ mkdir -p "${sample_dir}/fine/final"
46
+ cp "${sample_dir}/fine/CONTCAR" "${sample_dir}/fine/final/POSCAR"
47
+ cp "$INCAR_3" "${sample_dir}/fine/final/INCAR"
48
+ create_potcar_from_poscar "${sample_dir}/fine/final/POSCAR" # 根据 POSCAR 创建 POTCAR
49
+ mv "POTCAR" "${sample_dir}/fine/final/" # 使用自动生成的 POTCAR
50
+ original_dir=$(pwd) # 保存当前目录
51
+ cd "${sample_dir}/fine/final" && mpirun -n ${DPDISPATCHER_CPU_PER_NODE} vasp_std > vasp.log 2>&1
52
+ cd $original_dir # 返回原始工作目录
53
+ fi
54
+ done
55
+
56
+ echo "All third step tasks have been submitted."
@@ -9,6 +9,13 @@ from ion_CSP.identify_molecules import identify_molecules, molecules_information
9
9
  class ReadMlpDensity:
10
10
 
11
11
  def __init__(self, work_dir:str):
12
+ """
13
+ This class is designed to read and process MLP optimized files, specifically CONTCAR files, to calculate and sort their densities.
14
+ The class also provides functionality to process these files using phonopy for symmetry analysis and primitive cell generation.
15
+
16
+ :params
17
+ work_dir: The working directory where the MLP optimized files are located.
18
+ """
12
19
  # 获取脚本的当前目录
13
20
  self.base_dir = work_dir
14
21
  os.chdir(self.base_dir)
@@ -39,7 +46,10 @@ class ReadMlpDensity:
39
46
  """
40
47
  Obtain the atomic mass and unit cell volume from the optimized CONTCAR file, and obtain the ion crystal density. Finally, take n CONTCAR files with the highest density and save them separately for viewing.
41
48
 
42
- :param n_screen: 取前n个最大密度的文件
49
+ :params
50
+ n_screen: The number of CONTCAR files with the highest density to be saved.
51
+ molecules_screen: If True, only consider ionic crystals with original ions.
52
+ detail_log: If True, print detailed information about the molecules identified in the CONTCAR files.
43
53
  """
44
54
  os.chdir(self.base_dir)
45
55
  # 获取所有以'CONTCAR_'开头的文件,并按数字顺序处理
@@ -135,6 +145,10 @@ class ReadMlpDensity:
135
145
  def phonopy_processing_max_density(self, specific_directory :str = None):
136
146
  """
137
147
  Use phonopy to check and generate symmetric primitive cells, reducing the complexity of subsequent optimization calculations, and preventing pyxtal.from_random from generating double proportioned supercells.
148
+
149
+ :params
150
+ specific_directory: If specified, phonopy will process the files in this directory instead of the max_density directory.
151
+ If not specified, it will process the files in the max_density directory.
138
152
  """
139
153
  if specific_directory:
140
154
  self.phonopy_dir = os.path.join(self.base_dir, specific_directory)
ion_CSP/task_manager.py CHANGED
@@ -225,7 +225,7 @@ class TaskManager:
225
225
  pid_file = work_dir / "pid.txt"
226
226
 
227
227
  # 动态加载模块
228
- module_name = f"run.main_{module}"
228
+ module_name = f"ion_CSP.run.main_{module}"
229
229
  spec = importlib.util.find_spec(module_name)
230
230
  if not spec:
231
231
  raise ImportError(f"Module {module_name} not found")
@@ -364,7 +364,7 @@ class TaskManager:
364
364
  """主菜单循环 - Main menu loop"""
365
365
  while True:
366
366
  os.system("clear" if os.name == "posix" else "cls")
367
- print("========== Task Execution Sys1tem ==========")
367
+ print("========== Task Execution System ==========")
368
368
  print(f"Current Version: {self.version}")
369
369
  print(f"Current Environment: {self.envs}")
370
370
  print(f"Current Directory: {self.workspace}")
@@ -484,4 +484,3 @@ class SSHBatchJob:
484
484
  def close_connection(self):
485
485
  self.sftp.close()
486
486
  self.client.close()
487
-
@@ -4,6 +4,7 @@ import json
4
4
  import yaml
5
5
  import shutil
6
6
  import logging
7
+ import importlib.resources
7
8
  from ase.io import ParseError
8
9
  from ase.io.vasp import read_vasp_out
9
10
  from dpdispatcher import Machine, Resources, Task, Submission
@@ -13,12 +14,18 @@ from ion_CSP.identify_molecules import identify_molecules, molecules_information
13
14
 
14
15
  class VaspProcessing:
15
16
  def __init__(self, work_dir: str):
17
+ """
18
+ This directory is used to store all the files related to VASP optimizations.
19
+
20
+ :params
21
+ work_dir: The working directory where VASP optimization files will be stored.
22
+ """
16
23
  redirect_dpdisp_logging(os.path.join(work_dir, "dpdispatcher.log"))
17
24
  self.base_dir = work_dir
18
25
  os.chdir(self.base_dir)
19
26
  self.for_vasp_opt_dir = f"{work_dir}/3_for_vasp_opt"
20
27
  self.vasp_optimized_dir = f"{work_dir}/4_vasp_optimized"
21
- self.param_dir = os.path.join(os.path.dirname(__file__), "../../param")
28
+ self.param_dir = importlib.resources.files("ion_CSP.param")
22
29
 
23
30
  def dpdisp_vasp_optimization_tasks(
24
31
  self,
@@ -28,6 +35,10 @@ class VaspProcessing:
28
35
  ):
29
36
  """
30
37
  Based on the dpdispatcher module, prepare and submit files for optimization on remote server or local machine.
38
+ :params
39
+ machine: The machine configuration file, which can be in JSON or YAML format.
40
+ resources: The resources configuration file, which can be in JSON or YAML format.
41
+ nodes: The number of nodes to distribute the optimization tasks across.
31
42
  """
32
43
  # 调整工作目录,减少错误发生
33
44
  os.chdir(self.for_vasp_opt_dir)
@@ -79,7 +90,7 @@ class VaspProcessing:
79
90
  task_dir = os.path.join(self.for_vasp_opt_dir, f"{parent}pop{pop}")
80
91
  os.makedirs(task_dir, exist_ok=True)
81
92
  for file in forward_files:
82
- shutil.copyfile(f"{self.param_dir}/{file}", f"{task_dir}/{file}")
93
+ shutil.copyfile(self.param_dir.joinpath(file), f"{task_dir}/{file}")
83
94
  for job_i in node_jobs[pop]:
84
95
  # 将分配好的POSCAR文件添加到对应的上传文件中
85
96
  forward_files.append(mlp_contcar_files[job_i])
@@ -146,7 +157,11 @@ class VaspProcessing:
146
157
  nodes: int = 1,
147
158
  ):
148
159
  """
149
- Based on the dpdispatcher module, prepare and submit files for optimization on remote server or local machine.
160
+ Based on the dpdispatcher module, prepare and submit files for VASP relaxation on remote server or local machine.
161
+ :params
162
+ machine: The machine configuration file, which can be in JSON or YAML format.
163
+ resources: The resources configuration file, which can be in JSON or YAML format.
164
+ nodes: The number of nodes to distribute the optimization tasks across.
150
165
  """
151
166
  # 调整工作目录,减少错误发生
152
167
  os.chdir(self.vasp_optimized_dir)
@@ -199,7 +214,7 @@ class VaspProcessing:
199
214
  task_dir = os.path.join(self.vasp_optimized_dir, f"{parent}pop{pop}")
200
215
  os.makedirs(task_dir, exist_ok=True)
201
216
  for file in forward_files:
202
- shutil.copyfile(f"{self.param_dir}/{file}", f"{task_dir}/{file}")
217
+ shutil.copyfile(self.param_dir.joinpath(file), f"{task_dir}/{file}")
203
218
  for job_i in node_jobs[pop]:
204
219
  # 将分配好的POSCAR文件添加到对应的上传文件中
205
220
  vasp_dir = vasp_optimized_folders[job_i]
@@ -311,7 +326,7 @@ class VaspProcessing:
311
326
  task_dir = os.path.join(self.for_vasp_opt_dir, f"{parent}pop{pop}")
312
327
  os.makedirs(task_dir, exist_ok=True)
313
328
  for file in forward_files:
314
- shutil.copyfile(f"{self.param_dir}/{file}", f"{task_dir}/{file}")
329
+ shutil.copyfile(self.param_dir.joinpath(file), f"{task_dir}/{file}")
315
330
  for job_i in node_jobs[pop]:
316
331
  # 将分配好的POSCAR文件添加到对应的上传文件中
317
332
  forward_files.append(mlp_contcar_files[job_i])
@@ -622,6 +637,11 @@ class VaspProcessing:
622
637
  with open(csv_file_path, "r") as csvfile:
623
638
  reader = csv.reader(csvfile)
624
639
  # 跳过表头读取第一行结构序号,即符合结构筛选要求的最大密度结构
640
+ header = next(reader)
641
+ if header[0] != "Number":
642
+ raise KeyError(
643
+ "The first column of the CSV file is not 'Number', please check the file format."
644
+ )
625
645
  first_row = next(reader)
626
646
  structure_number = str(first_row[0])
627
647
  # 根据结构序号构建要查找的文件夹路径
@@ -632,24 +652,27 @@ class VaspProcessing:
632
652
  structure_number
633
653
  ):
634
654
  # 查找 CONTCAR 文件
635
- final_contcar_path = os.path.join(
636
- vasp_folder_path, "fine", "final", "CONTCAR"
637
- )
655
+ # final_contcar_path = os.path.join(
656
+ # vasp_folder_path, "fine", "final", "CONTCAR"
657
+ # )
658
+ # print(f"Trying to get the final structure from {vasp_folder_path}")
659
+ # logging.info(
660
+ # f"Trying to get the final structure from {vasp_folder_path}"
661
+ # )
662
+ # if os.path.exists(final_contcar_path):
663
+ # # 复制 CONTCAR 文件到 combo_n 文件夹并重命名为 POSCAR
664
+ # shutil.copy(
665
+ # final_contcar_path, os.path.join(self.base_dir, "POSCAR")
666
+ # )
667
+ # print(f"Renamed CONTCAR to POSCAR in {self.base_dir}, copied from {final_contcar_path}")
668
+ # logging.info(
669
+ # f"Renamed CONTCAR to POSCAR in {self.base_dir}, copied from {final_contcar_path}"
670
+ # )
638
671
  fine_contcar_path = os.path.join(
639
672
  vasp_folder_path, "fine", "CONTCAR"
640
673
  )
641
- logging.info(
642
- f"Trying to get the final structure from {vasp_folder_path}"
643
- )
644
- if os.path.exists(final_contcar_path):
645
- # 复制 CONTCAR 文件到 combo_n 文件夹并重命名为 POSCAR
646
- shutil.copy(
647
- final_contcar_path, os.path.join(self.base_dir, "POSCAR")
648
- )
649
- logging.info(
650
- f"Renamed CONTCAR to POSCAR in {self.base_dir}, copied from {final_contcar_path}"
651
- )
652
- elif os.path.exists(fine_contcar_path):
674
+ if os.path.exists(fine_contcar_path):
675
+ print(f"CONTCAR not found in {os.path.join(vasp_folder_path, 'fine', 'final')}")
653
676
  logging.info(
654
677
  f"CONTCAR not found in {os.path.join(vasp_folder_path, 'fine', 'final')}"
655
678
  )
@@ -657,10 +680,15 @@ class VaspProcessing:
657
680
  shutil.copy(
658
681
  fine_contcar_path, os.path.join(self.base_dir, "POSCAR")
659
682
  )
683
+ print(f"Renamed CONTCAR to POSCAR in {self.base_dir}, copied from {fine_contcar_path}")
660
684
  logging.info(
661
685
  f"Renamed CONTCAR to POSCAR in {self.base_dir}, copied from {fine_contcar_path}"
662
686
  )
663
687
  else:
664
688
  print(f"Eligible CONTCAR not found in {vasp_folder_path}")
689
+ logging.info(
690
+ f"Eligible CONTCAR not found in {vasp_folder_path}"
691
+ )
665
692
  else:
693
+ print(f"CSV file not found in {self.base_dir}")
666
694
  logging.info(f"CSV file not found in {self.base_dir}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ion_CSP
3
- Version: 2.1.4
3
+ Version: 2.1.8
4
4
  Summary: Crystal Structure Design Software Based on Molecular/Ionic Configuration.
5
5
  Home-page: https://github.com/bagabaga007/ion_CSP
6
6
  Author: Ze Yang
@@ -13,6 +13,7 @@ Requires-Python: >=3.11
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
15
  Requires-Dist: ase==3.23.0
16
+ Requires-Dist: scipy==1.15.2
16
17
  Requires-Dist: deepmd-kit==3.0.1
17
18
  Requires-Dist: torch==2.5.0
18
19
  Requires-Dist: dpdispatcher==0.6.7
@@ -27,13 +28,16 @@ Dynamic: home-page
27
28
  Dynamic: license-file
28
29
  Dynamic: requires-python
29
30
 
30
- # Crystal Structure Design Software V2.1
31
+ # 基于分子/离子构型的晶体结构设计软件 V2.1
31
32
 
32
33
  ## 项目概述
34
+
33
35
  基于分子/离子构型的晶体结构设计软件通过结合经验公式、机器学习势函数微调、第一性原理分步优化和分子/离子识别技术,实现了从分子/离子构型出发的高效晶体结构设计。该软件采用模块化设计,支持全流程自动化材料筛选,在保证预测精度的同时显著提升计算效率。
34
36
 
35
37
  ## 功能特性
38
+
36
39
  ### 核心功能
40
+
37
41
  - **双模块工作流**
38
42
  - **EE模块**:基于经验评估的离子组合生成
39
43
  - **CSP模块**:基于离子晶体结构预测的优化筛选
@@ -47,13 +51,16 @@ Dynamic: requires-python
47
51
  - 软链接解析显示实际路径
48
52
 
49
53
  ### 技术特性
54
+
50
55
  - 跨平台支持(Linux/Docker)
51
56
  - 基于Python 3.11+的面向对象架构
52
57
  - 集成psutil进程管理
53
58
  - 结构化日志记录系统
54
59
 
55
60
  ## 安装指南
61
+
56
62
  ### 环境要求
63
+
57
64
  | 组件 | 最低版本 |
58
65
  |-------------|----------|
59
66
  | Python | 3.11 |
@@ -70,10 +77,13 @@ Dynamic: requires-python
70
77
  | rdkit | 2024.03.3|
71
78
 
72
79
  ### 安装步骤
80
+
73
81
  ```bash
74
82
  pip install ion-csp
75
83
  ```
84
+
76
85
 
86
+
77
87
  ```bash
78
88
  # 创建虚拟环境
79
89
  python -m venv venv
@@ -86,29 +96,39 @@ pip install -e .
86
96
  ```
87
97
 
88
98
  ## 快速入门
99
+
89
100
  ### 交互模式
101
+
90
102
  ```bash
91
103
  ion-csp
92
104
  ```
105
+
93
106
  启动交互式命令行界面,支持以下操作:
107
+
94
108
  - 模块选择
95
109
  - 日志查看
96
110
  - 进程管理
97
111
 
98
112
  ### 脚本调用
113
+
99
114
  #### EE模块示例
115
+
100
116
  ```bash
101
117
  ./scripts/main_EE.sh examples/example_1
102
118
  ```
119
+
103
120
  从SMILES表格生成离子组合
104
121
 
105
122
  #### CSP模块示例
123
+
106
124
  ```bash
107
125
  ./scripts/main_CSP.sh examples/example_2
108
126
  ```
127
+
109
128
  从离子组合生成并优化晶体结构
110
129
 
111
130
  ## 技术架构
131
+
112
132
  ```mermaid
113
133
  graph TD
114
134
  A[用户界面] --> B[任务管理器]
@@ -117,34 +137,32 @@ graph TD
117
137
  B --> E[日志系统]
118
138
  B --> F[任务调度]
119
139
  C --> G[经验评估引擎]
120
- D --> H[晶体预测引擎]
140
+ D --> H[离子晶体结构预测引擎]
121
141
  E --> I[结构化日志]
122
142
  F --> J[进程终止]
123
143
  ```
124
144
 
125
145
  ## 贡献指南
146
+
126
147
  1. Fork仓库并创建特性分支
127
148
  2. 编写单元测试覆盖新功能
128
149
  3. 提交Pull Request时注明关联Issue
129
150
  4. 遵循PEP8代码规范
130
151
 
131
152
  ## 许可证
132
- 本项目采用MIT许可证,详见LICENSE文件。
133
153
 
134
- ## 技术支持
135
- - **文档更新**:2025年6月
136
- - **最新版本**:v2.1.4
137
- - **问题追踪**:https://github.com/bagabaga007/ion_CSP/issues
154
+ 本项目采用MIT许可证,详见LICENSE文件。
138
155
 
139
156
  ---
140
157
 
141
- # Crystal Structure Design Software V2.1
142
-
143
158
  ## Project Overview
159
+
144
160
  This software enables efficient crystal structure design from molecular/ion configurations by integrating empirical formulas, tuned machine learning potentials, stepwise first-principles optimization, and molecular/ion recognition techniques. The modular architecture ensures extensibility and maintainability while maintaining prediction accuracy.
145
161
 
146
162
  ## Key Features
163
+
147
164
  ### Core Functionalities
165
+
148
166
  - **Dual-Module Workflow**
149
167
  - **EE Module**: Empirical evaluation-based ion combination generation
150
168
  - **CSP Module**: Ion crystal structure prediction and optimization
@@ -158,13 +176,16 @@ This software enables efficient crystal structure design from molecular/ion conf
158
176
  - Symlink resolution for actual log paths
159
177
 
160
178
  ### Technical Specifications
179
+
161
180
  - Cross-platform support (Linux/Docker)
162
181
  - Object-oriented architecture with Python 3.11+
163
182
  - Integrated process management via psutil
164
183
  - Structured logging system
165
184
 
166
185
  ## Installation
186
+
167
187
  ### Prerequisites
188
+
168
189
  | Component | Min Version |
169
190
  |-------------|-------------|
170
191
  | Python | 3.11 |
@@ -181,6 +202,7 @@ This software enables efficient crystal structure design from molecular/ion conf
181
202
  | rdkit | 2024.03.3|
182
203
 
183
204
  ### Installation Steps
205
+
184
206
  ```bash
185
207
  # Create virtual environment
186
208
  python -m venv venv
@@ -193,29 +215,39 @@ pip install -e .
193
215
  ```
194
216
 
195
217
  ## Quick Start
218
+
196
219
  ### Interactive Mode
220
+
197
221
  ```bash
198
222
  ion-csp
199
223
  ```
224
+
200
225
  Launches CLI interface with:
226
+
201
227
  - Module selection
202
228
  - Log management
203
229
  - Process control
204
230
 
205
231
  ### Script Execution
232
+
206
233
  #### EE Module Example
234
+
207
235
  ```bash
208
236
  ./scripts/main_EE.sh examples/example_1
209
237
  ```
238
+
210
239
  Generates ion combinations from SMILES tables
211
240
 
212
241
  #### CSP Module Example
242
+
213
243
  ```bash
214
244
  ./scripts/main_CSP.sh examples/example_2
215
245
  ```
246
+
216
247
  Optimizes crystal structures from ion combinations
217
248
 
218
249
  ## Technical Architecture
250
+
219
251
  ```mermaid
220
252
  graph TD
221
253
  A[User Interface] --> B[Task Manager]
@@ -224,21 +256,18 @@ graph TD
224
256
  B --> E[Log System]
225
257
  B --> F[Task Scheduler]
226
258
  C --> G[Empirical Evaluation Engine]
227
- D --> H[Crystal Prediction Engine]
259
+ D --> H[Ionic Crystal Structure Prediction Engine]
228
260
  E --> I[Structured Logs]
229
261
  F --> J[Process Termination]
230
262
  ```
231
263
 
232
264
  ## Contribution Guide
265
+
233
266
  1. Fork repository and create feature branch
234
267
  2. Write unit tests for new features
235
268
  3. Submit PR with issue reference
236
269
  4. Follow PEP8 coding standards
237
270
 
238
271
  ## License
239
- MIT License, see LICENSE file.
240
272
 
241
- ## Support
242
- - Documentation last updated: June 2025
243
- - Latest version: v2.1.4
244
- - Issue tracker: https://github.com/bagabaga007/ion_CSP/issues
273
+ MIT License, see LICENSE file.