Skip to content

Commit 375413c

Browse files
committed
added codes
1 parent 4d46dd5 commit 375413c

File tree

149 files changed

+2752
-56770
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+2752
-56770
lines changed

.gitignore

Lines changed: 252 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,252 @@
1+
### https://raw.github.com/github/gitignore/5db84d2431ce5209d252112fdc377c0f17d5078b/Python.gitignore
2+
3+
# Byte-compiled / optimized / DLL files
4+
__pycache__/
5+
*.py[cod]
6+
*$py.class
7+
8+
# C extensions
9+
*.so
10+
11+
# Distribution / packaging
12+
.Python
13+
build/
14+
develop-eggs/
15+
dist/
16+
downloads/
17+
eggs/
18+
.eggs/
19+
lib/
20+
lib64/
21+
parts/
22+
sdist/
23+
var/
24+
wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
.hypothesis/
50+
.pytest_cache/
51+
52+
# Translations
53+
*.mo
54+
*.pot
55+
56+
# Django stuff:
57+
*.log
58+
local_settings.py
59+
db.sqlite3
60+
61+
# Flask stuff:
62+
instance/
63+
.webassets-cache
64+
65+
# Scrapy stuff:
66+
.scrapy
67+
68+
# Sphinx documentation
69+
docs/_build/
70+
71+
# PyBuilder
72+
target/
73+
74+
# Jupyter Notebook
75+
.ipynb_checkpoints
76+
77+
# pyenv
78+
.python-version
79+
80+
# celery beat schedule file
81+
celerybeat-schedule
82+
83+
# SageMath parsed files
84+
*.sage.py
85+
86+
# Environments
87+
.env
88+
.venv
89+
env/
90+
venv/
91+
ENV/
92+
env.bak/
93+
venv.bak/
94+
95+
# Spyder project settings
96+
.spyderproject
97+
.spyproject
98+
99+
# Rope project settings
100+
.ropeproject
101+
102+
# mkdocs documentation
103+
/site
104+
105+
# mypy
106+
.mypy_cache/
107+
108+
109+
### https://raw.github.com/github/gitignore/5db84d2431ce5209d252112fdc377c0f17d5078b/Global/macOS.gitignore
110+
111+
# General
112+
.DS_Store
113+
.AppleDouble
114+
.LSOverride
115+
116+
# Icon must end with two \r
117+
Icon
118+
119+
# Thumbnails
120+
._*
121+
122+
# Files that might appear in the root of a volume
123+
.DocumentRevisions-V100
124+
.fseventsd
125+
.Spotlight-V100
126+
.TemporaryItems
127+
.Trashes
128+
.VolumeIcon.icns
129+
.com.apple.timemachine.donotpresent
130+
131+
# Directories potentially created on remote AFP share
132+
.AppleDB
133+
.AppleDesktop
134+
Network Trash Folder
135+
Temporary Items
136+
.apdisk
137+
138+
139+
### https://raw.github.com/github/gitignore/5db84d2431ce5209d252112fdc377c0f17d5078b/Global/Windows.gitignore
140+
141+
# Windows thumbnail cache files
142+
Thumbs.db
143+
ehthumbs.db
144+
ehthumbs_vista.db
145+
146+
# Dump file
147+
*.stackdump
148+
149+
# Folder config file
150+
[Dd]esktop.ini
151+
152+
# Recycle Bin used on file shares
153+
$RECYCLE.BIN/
154+
155+
# Windows Installer files
156+
*.cab
157+
*.msi
158+
*.msix
159+
*.msm
160+
*.msp
161+
162+
# Windows shortcuts
163+
*.lnk
164+
165+
166+
### https://raw.github.com/github/gitignore/5db84d2431ce5209d252112fdc377c0f17d5078b/Global/Linux.gitignore
167+
168+
*~
169+
170+
# temporary files which can be created if a process still has a handle open of a deleted file
171+
.fuse_hidden*
172+
173+
# KDE directory preferences
174+
.directory
175+
176+
# Linux trash folder which might appear on any partition or disk
177+
.Trash-*
178+
179+
# .nfs files are created when an open file is removed but is still being accessed
180+
.nfs*
181+
182+
183+
### https://raw.github.com/github/gitignore/5db84d2431ce5209d252112fdc377c0f17d5078b/Global/Vim.gitignore
184+
185+
# Swap
186+
[._]*.s[a-v][a-z]
187+
[._]*.sw[a-p]
188+
[._]s[a-rt-v][a-z]
189+
[._]ss[a-gi-z]
190+
[._]sw[a-p]
191+
192+
# Session
193+
Session.vim
194+
195+
# Temporary
196+
.netrwhist
197+
*~
198+
# Auto-generated tag files
199+
tags
200+
# Persistent undo
201+
[._]*.un~
202+
203+
204+
### https://raw.github.com/github/gitignore/5db84d2431ce5209d252112fdc377c0f17d5078b/Global/Emacs.gitignore
205+
206+
# -*- mode: gitignore; -*-
207+
*~
208+
\#*\#
209+
/.emacs.desktop
210+
/.emacs.desktop.lock
211+
*.elc
212+
auto-save-list
213+
tramp
214+
.\#*
215+
216+
# Org-mode
217+
.org-id-locations
218+
*_archive
219+
220+
# flymake-mode
221+
*_flymake.*
222+
223+
# eshell files
224+
/eshell/history
225+
/eshell/lastdir
226+
227+
# elpa packages
228+
/elpa/
229+
230+
# reftex files
231+
*.rel
232+
233+
# AUCTeX auto folder
234+
/auto/
235+
236+
# cask packages
237+
.cask/
238+
dist/
239+
240+
# Flycheck
241+
flycheck_*.el
242+
243+
# server auth directory
244+
/server/
245+
246+
# projectiles files
247+
.projectile
248+
249+
# directory configuration
250+
.dir-locals.el
251+
252+

abics/applications/__init__.py

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .default_observer import *
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
from .base_solver import SolverBase
2+
from collections import namedtuple
3+
import numpy as np
4+
from pymatgen import Structure
5+
import os
6+
import sys,shutil,io
7+
8+
class aenetSolver(SolverBase):
9+
"""
10+
This class defines the aenet solver.
11+
"""
12+
13+
def __init__(self, path_to_solver):
14+
"""
15+
Initialize the solver.
16+
17+
Parameters
18+
----------
19+
path_to_solver : str
20+
Path to the solver.
21+
"""
22+
super(aenetSolver, self).__init__(path_to_solver)
23+
self.path_to_solver = path_to_solver
24+
self.input = aenetSolver.Input()
25+
self.output = aenetSolver.Output()
26+
27+
def name(self):
28+
return "aenet"
29+
30+
class Input(object):
31+
def __init__(self):
32+
self.base_info = None
33+
self.pos_info = None
34+
35+
def from_directory(self, base_input_dir):
36+
# set information of base_input and pos_info from files in base_input_dir
37+
self.base_info = os.path.abspath(base_input_dir)
38+
self.pos_info = open('{}/structure.xsf'.format(base_input_dir), 'r').read()
39+
40+
def update_info_by_structure(self, structure, seldyn_arr=None):
41+
self.pos_info = structure.to('XSF')
42+
43+
def update_info_from_files(self, output_dir, rerun):
44+
print('rerun not implemented. Something has gone wrong')
45+
sys.exit(1)
46+
47+
def write_input(self, output_dir):
48+
# Write input files
49+
if self.base_info is None:
50+
raise AttributeError("Fail to set base_info.")
51+
os.makedirs(output_dir, exist_ok=True)
52+
for fname in os.listdir(self.base_info):
53+
shutil.copy('{}/{}'.format(self.base_info, fname), output_dir)
54+
with open('{}/structure.xsf'.format(output_dir), 'w') as f:
55+
f.write(self.pos_info)
56+
57+
def cl_args(self, nprocs, nthreads, output_dir):
58+
# Specify command line arguments
59+
return ['{}/predict.in'.format(output_dir),]
60+
61+
class Output(object):
62+
63+
def get_results(self, output_dir):
64+
# Read results from files in output_dir and calculate values
65+
Phys = namedtuple("PhysVaules", ("energy", "structure"))
66+
structure = Structure.from_file('{}/structure.xsf'.format(output_dir))
67+
with open('{}/stdout'.format(output_dir)) as f:
68+
lines = f.read()
69+
fi_io = io.StringIO(lines)
70+
line = fi_io.readline()
71+
if 'optimized' in lines:
72+
while 'optimized' not in line:
73+
line = fi_io.readline()
74+
for i in range(4):
75+
fi_io.readline()
76+
for i in range(len(structure)):
77+
xyz = [float(x) for x in fi_io.readline().split()[1:4]]
78+
structure.replace(i, structure[i].species, coords = xyz,
79+
coords_are_cartesian = True)
80+
while 'Total energy' not in line:
81+
line = fi_io.readline()
82+
energy = line.split()[-2]
83+
return Phys(np.float64(energy), structure)
84+
85+
def solver_run_schemes(self):
86+
return ('subprocess')
87+

0 commit comments

Comments
 (0)