Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
parser-octopus
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
nomad-lab
parser-octopus
Commits
47a85285
Commit
47a85285
authored
7 years ago
by
Ask Hjorth Larsen
Browse files
Options
Downloads
Patches
Plain Diff
more cleanup
parent
bf381d1d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
parser/parser-octopus/aseoct.py
+0
-128
0 additions, 128 deletions
parser/parser-octopus/aseoct.py
with
0 additions
and
128 deletions
parser/parser-octopus/aseoct.py
+
0
−
128
View file @
47a85285
...
@@ -28,61 +28,6 @@ from ase.io.xsf import read_xsf
...
@@ -28,61 +28,6 @@ from ase.io.xsf import read_xsf
from
ase.units
import
Bohr
,
Angstrom
,
Hartree
,
eV
,
Debye
from
ase.units
import
Bohr
,
Angstrom
,
Hartree
,
eV
,
Debye
# Representation of parameters from highest to lowest level of abstraction:
#
# * Atoms object plus reduced kwargs that specify info not stored in the Atoms
# * full dictionary of kwargs incorporating info contained in the Atoms
# * series of assignments (names, values). May contain duplicates.
# * text in Octopus input file format
# Octopus variable types and specification in Python:
#
# Type Examples Equivalent in Python:
# -----------------------------------------------------------------------------
# flag wfs + density 'wfs + density'
# float 2.7, 2.7 + pi^2 2.7, 2.7 + np.pi**2
# integer 42, rmmdiis 42, 'rmmdiis'
# logical true, false, yes, no, ... True, False, 1, 0, 'yes', 'no', ...
# string "stdout.txt" '"stdout.txt"' (apologies for ugliness)
#
# block %Coordinates List of lists:
# 'H' | 0 | 0 | 0 coordinates=[["'H'", 0, 0, 0],
# 'O' | 0 | 0 | 1 ["'O'", 0, 0, 1]]
# % (elemements are sent through repr())
# Rules for input parameters
# --------------------------
#
# We make the following conversions:
# dict of keyword arguments + Atoms object -> Octopus input file
# and:
# Octopus input file -> Atoms object + dict of keyword arguments
# Below we detail some conventions and compatibility issues.
#
# 1) ASE always passes some parameters by default (always write
# forces, etc.). They can be overridden by the user, but the
# resulting behaviour is undefined.
#
# 2) Atoms object is used to establish some parameters: Coordinates,
# Lsize, etc. All those parameters can be overridden by passing
# them directly as keyword arguments. Parameters that were taken
# from the Atoms object are always marked with the comment "# ASE
# auto" in the input file. This is used to distinguish variables
# that are overridden from variables that simply came from the
# atoms object when restarting.
#
# 3) Some variables do not interact nicely between ASE and Octopus,
# such as SubSystemCoordinates which may involve rotations. There
# may be many such variables that we have not identified, but at
# least the known ones will cause a suppressable
# OctopusKeywordError. (This third rule has not been implemented
# as of this moment.)
#
# 4) OctopusKeywordError is raised from Python for keywords that are
# not valid according to oct-help.
def
read_eigenvalues_file
(
fd
):
def
read_eigenvalues_file
(
fd
):
unit
=
None
unit
=
None
...
@@ -138,51 +83,6 @@ def read_eigenvalues_file(fd):
...
@@ -138,51 +83,6 @@ def read_eigenvalues_file(fd):
return
kptsarr
,
eigsarr
,
occsarr
return
kptsarr
,
eigsarr
,
occsarr
def
process_special_kwargs
(
atoms
,
kwargs
):
return
# XXXXXX disabled
kwargs
=
kwargs
.
copy
()
kpts
=
kwargs
.
pop
(
'
kpts
'
,
None
)
if
kpts
is
not
None
:
for
kw
in
[
'
kpoints
'
,
'
reducedkpoints
'
,
'
kpointsgrid
'
]:
if
kw
in
kwargs
:
raise
ValueError
(
'
k-points specified multiple times
'
)
kptsarray
=
kpts2ndarray
(
kpts
,
atoms
)
nkpts
=
len
(
kptsarray
)
fullarray
=
np
.
empty
((
nkpts
,
4
))
fullarray
[:,
0
]
=
1.0
/
nkpts
# weights
fullarray
[:,
1
:
4
]
=
kptsarray
kwargs
[
'
kpointsreduced
'
]
=
fullarray
.
tolist
()
# TODO xc=LDA/PBE etc.
# The idea is to get rid of the special keywords, since the rest
# will be passed to Octopus
# XXX do a better check of this
for
kw
in
Octopus
.
special_ase_keywords
:
assert
kw
not
in
kwargs
return
kwargs
def
is_orthorhombic
(
cell
):
return
(
np
.
diag
(
np
.
diag
(
cell
))
==
cell
).
all
()
def
get_input_units
(
kwargs
):
units
=
kwargs
.
get
(
'
unitsinput
'
,
kwargs
.
get
(
'
units
'
,
'
atomic
'
)).
lower
()
if
units
not
in
[
'
ev_angstrom
'
,
'
atomic
'
]:
raise
OctopusKeywordError
(
'
Units not supported by ASE-Octopus
'
'
interface: %s
'
%
units
)
return
units
class
OctopusKeywordError
(
ValueError
):
pass
# Unhandled keywords
class
OctopusParseError
(
Exception
):
pass
# Cannot parse input file
class
OctopusIOError
(
IOError
):
class
OctopusIOError
(
IOError
):
pass
# Cannot find output files
pass
# Cannot find output files
...
@@ -529,26 +429,6 @@ def read_static_info(fd):
...
@@ -529,26 +429,6 @@ def read_static_info(fd):
class
Octopus
(
FileIOCalculator
):
class
Octopus
(
FileIOCalculator
):
"""
Octopus calculator.
The label is always assumed to be a directory.
"""
implemented_properties
=
[
'
energy
'
,
'
forces
'
,
'
dipole
'
,
'
magmom
'
,
'
magmoms
'
]
troublesome_keywords
=
set
([
'
subsystemcoordinates
'
,
'
subsystems
'
,
'
unitsinput
'
,
'
unitsoutput
'
,
'
pdbcoordinates
'
,
'
xyzcoordinates
'
,
'
xsfcoordinates
'
,
'
xsfcoordinatesanimstep
'
,
'
reducedcoordinates
'
])
special_ase_keywords
=
set
([
'
kpts
'
])
def
__init__
(
self
,
restart
):
def
__init__
(
self
,
restart
):
self
.
kwargs
=
{}
self
.
kwargs
=
{}
...
@@ -566,14 +446,6 @@ class Octopus(FileIOCalculator):
...
@@ -566,14 +446,6 @@ class Octopus(FileIOCalculator):
"""
Set octopus input file parameters.
"""
"""
Set octopus input file parameters.
"""
kwargs
=
normalize_keywords
(
kwargs
)
kwargs
=
normalize_keywords
(
kwargs
)
for
keyword
in
kwargs
:
if
keyword
in
self
.
troublesome_keywords
:
msg
=
(
'
ASE-Octopus interface will probably misbehave with
'
'
the %s parameter. Optimists may use
'
'
Octopus(ignore_troublesome_keywords=[kw1, kw2, ...])
'
'
to override this.
'
%
keyword
)
raise
OctopusKeywordError
(
msg
)
changes
=
FileIOCalculator
.
set
(
self
,
**
kwargs
)
changes
=
FileIOCalculator
.
set
(
self
,
**
kwargs
)
if
changes
:
if
changes
:
self
.
results
.
clear
()
self
.
results
.
clear
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment