Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

hiPhive

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hiPhive - npm Package Compare versions

Comparing version
0.7
to
0.7.1
+1
-2
hiphive.egg-info/PKG-INFO
Metadata-Version: 1.2
Name: hiphive
Version: 0.7
Version: 0.7.1
Summary: High-order force constants for the masses

@@ -98,3 +98,2 @@ Home-page: http://hiphive.materialsmodeling.org/

Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6

@@ -101,0 +100,0 @@ Classifier: Programming Language :: Python :: 3.7

@@ -38,3 +38,3 @@ """

'Paul Erhart']
__version__ = '0.7'
__version__ = '0.7.1'
__all__ = ['ClusterSpace',

@@ -41,0 +41,0 @@ 'StructureContainer',

@@ -69,4 +69,4 @@ import numba

i = 0
for l in range(pos):
v = d[cluster[l], :]
for m in range(pos):
v = d[cluster[m], :]
tvl(fc, v, order - i)

@@ -73,0 +73,0 @@ i += 1

@@ -43,7 +43,7 @@ """

config : Config object
config object containing information on how the cluster space should
be built, e.g. values for tolerances and if acoustic sum rules be
enforced
If not config is given then kwargs can be used to specify:
a configuration object that holds information on how the cluster space
should be built, e.g., values for tolerances and specifications
regarding the handling of acoustic sum rules; if ``config`` is
not given then the keyword arguments that follow below can be
used for configuration.
acoustic_sum_rules : bool

@@ -70,7 +70,8 @@ If True the aucostic sum rules will be enforced by constraining the

>>> from ase.build import bulk
>>> from hiphive import ClusterSpace
>>> prim = bulk('W')
>>> cs = ClusterSpace(prim, [5.0, 4.0])
"""
# TODO: This class probably need some more documentation and a reference to
# the thesis
# TODO: This class probably needs some more documentation
# TODO: Fix doc for n-body cutoff

@@ -77,0 +78,0 @@

@@ -50,9 +50,10 @@ import itertools

Aligning reference with target can be achieved via the transformations
>>> R, T = relate_structures(atoms_ref, atoms_target)
>>> atoms_ref_rotated = rotate_atoms(atoms_ref, R)
>>> atoms_ref_rotated.translate(T)
>>> atoms_ref_rotated.wrap()
>>> atoms_ref_rotated == atoms_target
Aligning reference with target can be achieved via the transformations::
R, T = relate_structures(atoms_ref, atoms_target)
atoms_ref_rotated = rotate_atoms(atoms_ref, R)
atoms_ref_rotated.translate(T)
atoms_ref_rotated.wrap()
atoms_ref_rotated == atoms_target
Parameters

@@ -59,0 +60,0 @@ ----------

@@ -7,4 +7,10 @@ """

import pickle
from typing import IO, Tuple, Union
import numpy as np
from ase import Atoms
from scipy.sparse import coo_matrix, vstack
from .cluster_space import ClusterSpace

@@ -17,7 +23,6 @@ from .core.atoms import Atom, atom_to_spos, spos_to_atom

from .core.utilities import Progress, BiMap
from .force_constants import SortedForceConstants
from .force_constants import ForceConstants, SortedForceConstants
from .input_output.logging_tools import logger
from .calculators.numba_calc import (clusters_force_contribution,
cluster_force_contribution)
from scipy.sparse import coo_matrix, vstack

@@ -35,8 +40,8 @@ logger = logger.getChild('fcm')

----------
atoms : ase.Atoms
atoms
configuration to which the cluster space is to be applied
cs : ClusterSpace
cs
a cluster space compatible with the structure of the atoms
"""
def __init__(self, atoms, cs):
def __init__(self, atoms: Atoms, cs: ClusterSpace):

@@ -50,3 +55,3 @@ self.atoms = atoms.copy()

# TODO: refactor
def _populate_orbits(self, atoms):
def _populate_orbits(self, atoms: Atoms):
"""Map the orbits from the underlying force constant potential onto the

@@ -176,3 +181,3 @@ supercell structure associated with this force constant model.

def get_force_constants(self):
def get_force_constants(self) -> SortedForceConstants:
"""Returns the force constants of the super cell.

@@ -182,3 +187,3 @@

-------
force constants : ForceConstants
force constants
complete set of force constants

@@ -199,3 +204,3 @@ """

@property
def parameters(self):
def parameters(self) -> np.ndarray:
""" list(float): parameters """

@@ -205,3 +210,3 @@ return self._parameters

@parameters.setter
def parameters(self, parameters):
def parameters(self, parameters: np.ndarray) -> None:
self._parameters = parameters

@@ -228,3 +233,3 @@ mapped_parameters = self.cs._map_parameters(parameters)

def get_forces(self, displacements):
def get_forces(self, displacements: np.ndarray) -> np.ndarray:
""" Returns the forces in the system given displacements.

@@ -236,3 +241,3 @@

----------
displacements : numpy.ndarray
displacements
displacements of each atom in the supercell (`N, 3` array)

@@ -261,3 +266,3 @@ """

def get_fit_matrix(self, displacements):
def get_fit_matrix(self, displacements: np.ndarray) -> np.ndarray:
""" Returns the matrix used to fit the parameters.

@@ -269,3 +274,3 @@

----------
displacements : numpy.ndarrya
displacements
displacements of each atom in the supercell (`(N, 3)` array)

@@ -303,3 +308,3 @@ """

def get_fcs_sensing(self, fcs):
def get_fcs_sensing(self, fcs: ForceConstants) -> Tuple[np.ndarray, np.ndarray]:
""" Creates a fit matrix from force constants directly.

@@ -313,17 +318,14 @@

The parameters can be extracted using e.g. least squares from numpy
The parameters can be extracted using e.g. least squares from numpy::
>>> parameters = np.linalg.lstsq(*fcm.get_fcs_sensing(fcs))[0]
parameters = np.linalg.lstsq(*fcm.get_fcs_sensing(fcs))[0]
Parameters
----------
fcs: ForceConstants
Must be compatible with the ideal structure of the model
fcs
force constants that are compatible with the ideal structure of the model
Returns
-------
M : np.array
The sensing matrix
F : np.array
The flattened, irreducible force constants
a tuple comprising the sensing matrix and the flattened, irreducible force constants
"""

@@ -352,3 +354,3 @@ M, F = [], []

@staticmethod
def read(f):
def read(f: Union[str, IO]):
"""Reads a force constant model from file.

@@ -358,9 +360,8 @@

----------
f : str or file object
name of input file (str) or stream to load from (file object)
f
name of input file (`str`) or stream to load from (`IO`)
Returns
-------
ForceConstantModel
the original object as stored in the file
the force constant model object as stored in the file
"""

@@ -373,3 +374,3 @@ if isinstance(f, str):

def write(self, f):
def write(self, f: Union[str, IO]) -> None:
"""Writes a force constant model to file.

@@ -379,4 +380,4 @@

----------
f : str or file object
name of input file (str) or stream to write to (file object)
f
name of input file (`str`) or stream to write to (`IO`)
"""

@@ -383,0 +384,0 @@ if isinstance(f, str):

@@ -170,4 +170,4 @@ """

fc_sum_ijk = np.zeros((3, )*order)
for l in atomic_indices:
cluster = ijk + (l, )
for m in atomic_indices:
cluster = ijk + (m, )
fc_sum_ijk += self[cluster]

@@ -174,0 +174,0 @@ assert np.linalg.norm(fc_sum_ijk) < tol, assert_msg.format(order, *ijk)

@@ -119,8 +119,11 @@ """

-------
>>> db = connect('dft_training_structures.db')
>>> training_structures = [row.toatoms() for row in db.select()]
>>> training_structures = prepare_structures(training_structures, atoms_ideal)
>>> for s in training_structures:
>>> sc.add_structure(s)
The following example illustrates the use of this function::
db = connect('dft_training_structures.db')
training_structures = [row.toatoms() for row in db.select()]
training_structures = prepare_structures(training_structures, atoms_ideal)
for s in training_structures:
sc.add_structure(s)
Parameters

@@ -156,6 +159,3 @@ ----------

--------
After obtaining the permutation via
```
p = find_permutation(atoms1, atoms2)
```
After obtaining the permutation via ``p = find_permutation(atoms1, atoms2)``
the reordered structure ``atoms1[p]`` will give the closest match

@@ -162,0 +162,0 @@ to ``atoms2``.

Metadata-Version: 1.2
Name: hiphive
Version: 0.7
Version: 0.7.1
Summary: High-order force constants for the masses

@@ -98,3 +98,2 @@ Home-page: http://hiphive.materialsmodeling.org/

Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6

@@ -101,0 +100,0 @@ Classifier: Programming Language :: Python :: 3.7

@@ -7,4 +7,4 @@ #!/usr/bin/env python3

if sys.version_info < (3, 5, 0, 'final', 0):
raise SystemExit('Python 3.5 or later is required!')
if sys.version_info < (3, 6, 0, 'final', 0):
raise SystemExit('Python 3.6 or later is required!')

@@ -49,3 +49,2 @@ with open('README.rst', encoding='utf-8') as fd:

'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',

@@ -52,0 +51,0 @@ 'Programming Language :: Python :: 3.7',