diff --git a/docs/_modules/index.html b/docs/_modules/index.html index f44a8dedc64..ab5dd2ae687 100644 --- a/docs/_modules/index.html +++ b/docs/_modules/index.html @@ -13,7 +13,6 @@ - @@ -299,7 +298,7 @@
if 'hollow' in positions and not obtuse:
ads_sites['hollow'].append(
self.ensemble_center(mesh, v))
- ads_sites['all'] = sum(ads_sites.values(), [])
for key, sites in ads_sites.items():
# Pare off outer sites for bridge/hollow
if key in ['bridge', 'hollow']:
@@ -348,6 +346,7 @@ Source code for pymatgen.analysis.adsorption
sites = [site + distance * self.mvec for site in sites]
ads_sites[key] = sites
+ ads_sites['all'] = sum(ads_sites.values(), [])
return ads_sites
[docs] def symm_reduce(self, coords_set, threshold=1e-6):
@@ -787,7 +786,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/aflow_prototypes.html b/docs/_modules/pymatgen/analysis/aflow_prototypes.html
index 2417c3eb1c2..33b9bebe08a 100644
--- a/docs/_modules/pymatgen/analysis/aflow_prototypes.html
+++ b/docs/_modules/pymatgen/analysis/aflow_prototypes.html
@@ -13,7 +13,6 @@
-
@@ -193,7 +192,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/bond_dissociation.html b/docs/_modules/pymatgen/analysis/bond_dissociation.html
index 748e92501a4..5de79fcb570 100644
--- a/docs/_modules/pymatgen/analysis/bond_dissociation.html
+++ b/docs/_modules/pymatgen/analysis/bond_dissociation.html
@@ -13,7 +13,6 @@
-
@@ -436,7 +435,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/bond_valence.html b/docs/_modules/pymatgen/analysis/bond_valence.html
index 1f77b681cf2..aa19bfbecbf 100644
--- a/docs/_modules/pymatgen/analysis/bond_valence.html
+++ b/docs/_modules/pymatgen/analysis/bond_valence.html
@@ -13,7 +13,6 @@
-
@@ -603,7 +602,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/chemenv/coordination_environments/chemenv_strategies.html b/docs/_modules/pymatgen/analysis/chemenv/coordination_environments/chemenv_strategies.html
index 27d03ff89ff..7e2af2cb1b9 100644
--- a/docs/_modules/pymatgen/analysis/chemenv/coordination_environments/chemenv_strategies.html
+++ b/docs/_modules/pymatgen/analysis/chemenv/coordination_environments/chemenv_strategies.html
@@ -13,7 +13,6 @@
-
@@ -2030,7 +2029,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/chemenv/coordination_environments/coordination_geometries.html b/docs/_modules/pymatgen/analysis/chemenv/coordination_environments/coordination_geometries.html
index 09a9797a6a2..525aadeb158 100644
--- a/docs/_modules/pymatgen/analysis/chemenv/coordination_environments/coordination_geometries.html
+++ b/docs/_modules/pymatgen/analysis/chemenv/coordination_environments/coordination_geometries.html
@@ -13,7 +13,6 @@
-
@@ -1228,7 +1227,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/chemenv/coordination_environments/coordination_geometry_finder.html b/docs/_modules/pymatgen/analysis/chemenv/coordination_environments/coordination_geometry_finder.html
index 897756ac25c..49a6c1cac66 100644
--- a/docs/_modules/pymatgen/analysis/chemenv/coordination_environments/coordination_geometry_finder.html
+++ b/docs/_modules/pymatgen/analysis/chemenv/coordination_environments/coordination_geometry_finder.html
@@ -13,7 +13,6 @@
-
@@ -1868,7 +1867,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/chemenv/coordination_environments/structure_environments.html b/docs/_modules/pymatgen/analysis/chemenv/coordination_environments/structure_environments.html
index 3b2518d7ad9..fd4af1792b2 100644
--- a/docs/_modules/pymatgen/analysis/chemenv/coordination_environments/structure_environments.html
+++ b/docs/_modules/pymatgen/analysis/chemenv/coordination_environments/structure_environments.html
@@ -13,7 +13,6 @@
-
@@ -1826,7 +1825,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/chemenv/coordination_environments/voronoi.html b/docs/_modules/pymatgen/analysis/chemenv/coordination_environments/voronoi.html
index 90728d61782..d985901a8c0 100644
--- a/docs/_modules/pymatgen/analysis/chemenv/coordination_environments/voronoi.html
+++ b/docs/_modules/pymatgen/analysis/chemenv/coordination_environments/voronoi.html
@@ -13,7 +13,6 @@
-
@@ -855,7 +854,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/chemenv/utils/chemenv_config.html b/docs/_modules/pymatgen/analysis/chemenv/utils/chemenv_config.html
index 90f371f4600..5c6b71a26da 100644
--- a/docs/_modules/pymatgen/analysis/chemenv/utils/chemenv_config.html
+++ b/docs/_modules/pymatgen/analysis/chemenv/utils/chemenv_config.html
@@ -13,7 +13,6 @@
-
@@ -244,7 +243,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/chemenv/utils/chemenv_errors.html b/docs/_modules/pymatgen/analysis/chemenv/utils/chemenv_errors.html
index 09e577ece1f..8e1f491d8e0 100644
--- a/docs/_modules/pymatgen/analysis/chemenv/utils/chemenv_errors.html
+++ b/docs/_modules/pymatgen/analysis/chemenv/utils/chemenv_errors.html
@@ -13,7 +13,6 @@
-
@@ -208,7 +207,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/chemenv/utils/coordination_geometry_utils.html b/docs/_modules/pymatgen/analysis/chemenv/utils/coordination_geometry_utils.html
index 57e66a8938a..8090f93f57d 100644
--- a/docs/_modules/pymatgen/analysis/chemenv/utils/coordination_geometry_utils.html
+++ b/docs/_modules/pymatgen/analysis/chemenv/utils/coordination_geometry_utils.html
@@ -13,7 +13,6 @@
-
@@ -1045,7 +1044,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/chemenv/utils/defs_utils.html b/docs/_modules/pymatgen/analysis/chemenv/utils/defs_utils.html
index 070837ae9ce..b7004206ede 100644
--- a/docs/_modules/pymatgen/analysis/chemenv/utils/defs_utils.html
+++ b/docs/_modules/pymatgen/analysis/chemenv/utils/defs_utils.html
@@ -13,7 +13,6 @@
-
@@ -168,7 +167,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/chemenv/utils/func_utils.html b/docs/_modules/pymatgen/analysis/chemenv/utils/func_utils.html
index adf3ae04211..a5bcf133ed2 100644
--- a/docs/_modules/pymatgen/analysis/chemenv/utils/func_utils.html
+++ b/docs/_modules/pymatgen/analysis/chemenv/utils/func_utils.html
@@ -13,7 +13,6 @@
-
@@ -287,7 +286,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/chemenv/utils/math_utils.html b/docs/_modules/pymatgen/analysis/chemenv/utils/math_utils.html
index 3cb6a8ce70b..7e8bb34cab7 100644
--- a/docs/_modules/pymatgen/analysis/chemenv/utils/math_utils.html
+++ b/docs/_modules/pymatgen/analysis/chemenv/utils/math_utils.html
@@ -13,7 +13,6 @@
-
@@ -363,7 +362,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/chemenv/utils/scripts_utils.html b/docs/_modules/pymatgen/analysis/chemenv/utils/scripts_utils.html
index bf4ed7fbddd..794da86ce9f 100644
--- a/docs/_modules/pymatgen/analysis/chemenv/utils/scripts_utils.html
+++ b/docs/_modules/pymatgen/analysis/chemenv/utils/scripts_utils.html
@@ -13,7 +13,6 @@
-
@@ -407,7 +406,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/cost/cost.html b/docs/_modules/pymatgen/analysis/cost/cost.html
index dc0a7db6d92..ef5407679f0 100644
--- a/docs/_modules/pymatgen/analysis/cost/cost.html
+++ b/docs/_modules/pymatgen/analysis/cost/cost.html
@@ -13,7 +13,6 @@
-
@@ -269,7 +268,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/defects/core.html b/docs/_modules/pymatgen/analysis/defects/core.html
index c16623bdf90..ddfdcc3e07b 100644
--- a/docs/_modules/pymatgen/analysis/defects/core.html
+++ b/docs/_modules/pymatgen/analysis/defects/core.html
@@ -13,7 +13,6 @@
-
@@ -721,7 +720,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/defects/corrections.html b/docs/_modules/pymatgen/analysis/defects/corrections.html
index a25507081f0..9fec9356abc 100644
--- a/docs/_modules/pymatgen/analysis/defects/corrections.html
+++ b/docs/_modules/pymatgen/analysis/defects/corrections.html
@@ -13,7 +13,6 @@
-
@@ -928,7 +927,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/defects/defect_compatibility.html b/docs/_modules/pymatgen/analysis/defects/defect_compatibility.html
index 8f1c756a306..b7596eaa2dd 100644
--- a/docs/_modules/pymatgen/analysis/defects/defect_compatibility.html
+++ b/docs/_modules/pymatgen/analysis/defects/defect_compatibility.html
@@ -13,7 +13,6 @@
-
@@ -591,7 +590,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/defects/dilute_solution_model.html b/docs/_modules/pymatgen/analysis/defects/dilute_solution_model.html
index 887ce642f90..d2037d3b343 100644
--- a/docs/_modules/pymatgen/analysis/defects/dilute_solution_model.html
+++ b/docs/_modules/pymatgen/analysis/defects/dilute_solution_model.html
@@ -13,7 +13,6 @@
-
@@ -1436,7 +1435,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/defects/generators.html b/docs/_modules/pymatgen/analysis/defects/generators.html
index 2d6192c278b..a6817a0af21 100644
--- a/docs/_modules/pymatgen/analysis/defects/generators.html
+++ b/docs/_modules/pymatgen/analysis/defects/generators.html
@@ -13,7 +13,6 @@
-
@@ -385,7 +384,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/defects/thermodynamics.html b/docs/_modules/pymatgen/analysis/defects/thermodynamics.html
index 4e7db715536..a1cbc5328e9 100644
--- a/docs/_modules/pymatgen/analysis/defects/thermodynamics.html
+++ b/docs/_modules/pymatgen/analysis/defects/thermodynamics.html
@@ -13,7 +13,6 @@
-
@@ -755,7 +754,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/defects/utils.html b/docs/_modules/pymatgen/analysis/defects/utils.html
index 8b7063a0eb8..73d18bba56d 100644
--- a/docs/_modules/pymatgen/analysis/defects/utils.html
+++ b/docs/_modules/pymatgen/analysis/defects/utils.html
@@ -13,7 +13,6 @@
-
@@ -1474,7 +1473,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/diffraction/core.html b/docs/_modules/pymatgen/analysis/diffraction/core.html
index 0d498a01f7d..decef306d54 100644
--- a/docs/_modules/pymatgen/analysis/diffraction/core.html
+++ b/docs/_modules/pymatgen/analysis/diffraction/core.html
@@ -13,7 +13,6 @@
-
@@ -296,7 +295,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/diffraction/neutron.html b/docs/_modules/pymatgen/analysis/diffraction/neutron.html
index c8e70239ffd..e0bde9363c7 100644
--- a/docs/_modules/pymatgen/analysis/diffraction/neutron.html
+++ b/docs/_modules/pymatgen/analysis/diffraction/neutron.html
@@ -13,7 +13,6 @@
-
@@ -285,7 +284,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/diffraction/xrd.html b/docs/_modules/pymatgen/analysis/diffraction/xrd.html
index 41384cca793..916c1a61123 100644
--- a/docs/_modules/pymatgen/analysis/diffraction/xrd.html
+++ b/docs/_modules/pymatgen/analysis/diffraction/xrd.html
@@ -13,7 +13,6 @@
-
@@ -381,7 +380,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/diffusion_analyzer.html b/docs/_modules/pymatgen/analysis/diffusion_analyzer.html
index b23cbfe1ae2..29ed6088a25 100644
--- a/docs/_modules/pymatgen/analysis/diffusion_analyzer.html
+++ b/docs/_modules/pymatgen/analysis/diffusion_analyzer.html
@@ -13,7 +13,6 @@
-
@@ -987,7 +986,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/dimensionality.html b/docs/_modules/pymatgen/analysis/dimensionality.html
index d56bb794ddf..713c71f845b 100644
--- a/docs/_modules/pymatgen/analysis/dimensionality.html
+++ b/docs/_modules/pymatgen/analysis/dimensionality.html
@@ -13,7 +13,6 @@
-
@@ -637,7 +636,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/elasticity/elastic.html b/docs/_modules/pymatgen/analysis/elasticity/elastic.html
index 11d66aeffb8..a56a2cdb732 100644
--- a/docs/_modules/pymatgen/analysis/elasticity/elastic.html
+++ b/docs/_modules/pymatgen/analysis/elasticity/elastic.html
@@ -13,7 +13,6 @@
-
@@ -1162,7 +1161,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/elasticity/strain.html b/docs/_modules/pymatgen/analysis/elasticity/strain.html
index 7acc5a18736..ed133e432a7 100644
--- a/docs/_modules/pymatgen/analysis/elasticity/strain.html
+++ b/docs/_modules/pymatgen/analysis/elasticity/strain.html
@@ -13,7 +13,6 @@
-
@@ -347,7 +346,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/elasticity/stress.html b/docs/_modules/pymatgen/analysis/elasticity/stress.html
index 084ff39aea5..376280d5bae 100644
--- a/docs/_modules/pymatgen/analysis/elasticity/stress.html
+++ b/docs/_modules/pymatgen/analysis/elasticity/stress.html
@@ -13,7 +13,6 @@
-
@@ -192,7 +191,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/energy_models.html b/docs/_modules/pymatgen/analysis/energy_models.html
index ed65cc42f14..9e2cf87425f 100644
--- a/docs/_modules/pymatgen/analysis/energy_models.html
+++ b/docs/_modules/pymatgen/analysis/energy_models.html
@@ -13,7 +13,6 @@
-
@@ -245,7 +244,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/eos.html b/docs/_modules/pymatgen/analysis/eos.html
index 42d5b9b9175..36988fcf087 100644
--- a/docs/_modules/pymatgen/analysis/eos.html
+++ b/docs/_modules/pymatgen/analysis/eos.html
@@ -13,7 +13,6 @@
-
@@ -670,7 +669,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/ewald.html b/docs/_modules/pymatgen/analysis/ewald.html
index 858a8152df3..9f7be54c2dd 100644
--- a/docs/_modules/pymatgen/analysis/ewald.html
+++ b/docs/_modules/pymatgen/analysis/ewald.html
@@ -13,7 +13,6 @@
-
@@ -743,7 +742,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/excitation.html b/docs/_modules/pymatgen/analysis/excitation.html
index 8543f2b2921..088abe946d9 100644
--- a/docs/_modules/pymatgen/analysis/excitation.html
+++ b/docs/_modules/pymatgen/analysis/excitation.html
@@ -13,7 +13,6 @@
-
@@ -121,7 +120,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/ferroelectricity/polarization.html b/docs/_modules/pymatgen/analysis/ferroelectricity/polarization.html
index f7d128cd966..fb766e04c73 100644
--- a/docs/_modules/pymatgen/analysis/ferroelectricity/polarization.html
+++ b/docs/_modules/pymatgen/analysis/ferroelectricity/polarization.html
@@ -13,7 +13,6 @@
-
@@ -49,24 +48,7 @@ Source code for pymatgen.analysis.ferroelectricity.polarization
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
-
-from pymatgen.core.structure import Structure
-from pymatgen.core.lattice import Lattice
-import numpy as np
-
-"""
-This module provides the classes needed to analyze the change in polarization
-from a nonpolar reference phase to a polar ferroelectric phase.
-"""
-
-__author__ = "Tess Smidt"
-__copyright__ = "Copyright 2017, The Materials Project"
-__version__ = "1.0"
-__email__ = "tsmidt@berkeley.edu"
-__status__ = "Development"
-__date__ = "April 15, 2017"
-
-"""
+r"""
This module contains classes useful for analyzing ferroelectric candidates.
The Polarization class can recover the spontaneous polarization using
multiple calculations along a nonpolar to polar ferroelectric distortion.
@@ -112,6 +94,18 @@ Source code for pymatgen.analysis.ferroelectricity.polarization
"""
+from pymatgen.core.structure import Structure
+from pymatgen.core.lattice import Lattice
+import numpy as np
+
+__author__ = "Tess Smidt"
+__copyright__ = "Copyright 2017, The Materials Project"
+__version__ = "1.0"
+__email__ = "tsmidt@berkeley.edu"
+__status__ = "Development"
+__date__ = "April 15, 2017"
+
+
[docs]def zval_dict_from_potcar(potcar):
"""
Creates zval_dictionary for calculating the ionic polarization from
@@ -135,7 +129,7 @@ Source code for pymatgen.analysis.ferroelectricity.polarization
Returns polarization in electron Angstroms.
"""
- norms = structure.lattice.lengths_and_angles[0]
+ norms = structure.lattice.lengths
return np.multiply(norms, -site.frac_coords * zval)
@@ -157,6 +151,10 @@ Source code for pymatgen.analysis.ferroelectricity.polarization
[docs]class PolarizationLattice(Structure):
+ """
+ Why is a Lattice inheriting a structure? This is ridiculous.
+ """
+
[docs] def get_nearest_site(self, coords, site, r=None):
"""
Given coords and a site, find closet site to coords.
@@ -272,7 +270,7 @@ Source code for pymatgen.analysis.ferroelectricity.polarization
return p_elecs, p_ions
[docs] def get_same_branch_polarization_data(self, convert_to_muC_per_cm2=True, all_in_polar=True):
- """
+ r"""
Get same branch dipole moment (convert_to_muC_per_cm2=False)
or polarization for given polarization data (convert_to_muC_per_cm2=True).
@@ -331,9 +329,9 @@ Source code for pymatgen.analysis.ferroelectricity.polarization
# adjust lattices
for i in range(L):
lattice = lattices[i]
- l, a = lattice.lengths_and_angles
- lattices[i] = Lattice.from_lengths_and_angles(
- np.array(l) * units.ravel()[i], a)
+ l = lattice.lengths
+ a = lattice.angles
+ lattices[i] = Lattice.from_parameters(*(np.array(l) * units.ravel()[i]), *a)
# convert polarizations to polar lattice
elif convert_to_muC_per_cm2 and all_in_polar:
abc = [lattice.abc for lattice in lattices]
@@ -342,9 +340,10 @@ Source code for pymatgen.analysis.ferroelectricity.polarization
p_tot *= abc[-1] / volumes[-1] * e_to_muC * cm2_to_A2 # to muC / cm^2
for i in range(L):
lattice = lattices[-1] # Use polar lattice
- l, a = lattice.lengths_and_angles
- lattices[i] = Lattice.from_lengths_and_angles(
- np.array(l) * units.ravel()[-1], a) # Use polar units (volume)
+ l = lattice.lengths
+ a = lattice.angles
+ # Use polar units (volume)
+ lattices[i] = Lattice.from_parameters(*(np.array(l) * units.ravel()[-1]), *a)
d_structs = []
sites = []
@@ -393,18 +392,17 @@ Source code for pymatgen.analysis.ferroelectricity.polarization
# adjust lattices
for i in range(L):
lattice = lattices[i]
- l, a = lattice.lengths_and_angles
- lattices[i] = Lattice.from_lengths_and_angles(
- np.array(l) * units.ravel()[i], a)
+ l = lattice.lengths
+ a = lattice.angles
+ lattices[i] = Lattice.from_parameters(*(np.array(l) * units.ravel()[i]), *a)
elif convert_to_muC_per_cm2 and all_in_polar:
for i in range(L):
lattice = lattices[-1]
- l, a = lattice.lengths_and_angles
- lattices[i] = Lattice.from_lengths_and_angles(
- np.array(l) * units.ravel()[-1], a)
+ l = lattice.lengths
+ a = lattice.angles
+ lattices[i] = Lattice.from_parameters(*(np.array(l) * units.ravel()[-1]), *a)
- quanta = np.array(
- [np.array(l.lengths_and_angles[0]) for l in lattices])
+ quanta = np.array([np.array(l.lengths) for l in lattices])
return quanta
@@ -489,7 +487,13 @@ Source code for pymatgen.analysis.ferroelectricity.polarization
[docs]class EnergyTrend:
+ """
+ Class for fitting trends to energies.
+ """
def __init__(self, energies):
+ """
+ :param energies: Energies
+ """
self.energies = energies
[docs] def spline(self):
@@ -574,7 +578,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/fragmenter.html b/docs/_modules/pymatgen/analysis/fragmenter.html
index 759344f9955..4080bead64c 100644
--- a/docs/_modules/pymatgen/analysis/fragmenter.html
+++ b/docs/_modules/pymatgen/analysis/fragmenter.html
@@ -13,7 +13,6 @@
-
@@ -424,7 +423,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/functional_groups.html b/docs/_modules/pymatgen/analysis/functional_groups.html
index f0eaa7aa343..f80e6bb233d 100644
--- a/docs/_modules/pymatgen/analysis/functional_groups.html
+++ b/docs/_modules/pymatgen/analysis/functional_groups.html
@@ -13,7 +13,6 @@
-
@@ -455,7 +454,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/gb/grain.html b/docs/_modules/pymatgen/analysis/gb/grain.html
index 9cf445dab09..3bdccc9b7ac 100644
--- a/docs/_modules/pymatgen/analysis/gb/grain.html
+++ b/docs/_modules/pymatgen/analysis/gb/grain.html
@@ -13,7 +13,6 @@
-
@@ -2416,7 +2415,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/graphs.html b/docs/_modules/pymatgen/analysis/graphs.html
index a36e7c12ebb..c044dbe665d 100644
--- a/docs/_modules/pymatgen/analysis/graphs.html
+++ b/docs/_modules/pymatgen/analysis/graphs.html
@@ -13,7 +13,6 @@
-
@@ -421,7 +420,7 @@ Source code for pymatgen.analysis.graphs
include_index=True)
for site, dist, to_index in equiv_sites:
to_jimage = np.subtract(site.frac_coords, self.structure[from_index].frac_coords)
- to_jimage = to_jimage.astype(int)
+ to_jimage = np.round(to_jimage).astype(int)
self.add_edge(from_index=from_index, from_jimage=(0, 0, 0),
to_jimage=to_jimage, to_index=to_index)
return
@@ -2943,7 +2942,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/interface.html b/docs/_modules/pymatgen/analysis/interface.html
index 73085e34666..4b14ec88f78 100644
--- a/docs/_modules/pymatgen/analysis/interface.html
+++ b/docs/_modules/pymatgen/analysis/interface.html
@@ -13,7 +13,6 @@
-
@@ -1169,7 +1168,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/interface_reactions.html b/docs/_modules/pymatgen/analysis/interface_reactions.html
index e3b691c98e4..0a927c7d09c 100644
--- a/docs/_modules/pymatgen/analysis/interface_reactions.html
+++ b/docs/_modules/pymatgen/analysis/interface_reactions.html
@@ -13,7 +13,6 @@
-
@@ -636,7 +635,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/local_env.html b/docs/_modules/pymatgen/analysis/local_env.html
index e7c3b80ce90..f05f4b2cb49 100644
--- a/docs/_modules/pymatgen/analysis/local_env.html
+++ b/docs/_modules/pymatgen/analysis/local_env.html
@@ -13,7 +13,6 @@
-
@@ -3821,7 +3820,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/magnetism/analyzer.html b/docs/_modules/pymatgen/analysis/magnetism/analyzer.html
index a2ea752a18f..f773701e15c 100644
--- a/docs/_modules/pymatgen/analysis/magnetism/analyzer.html
+++ b/docs/_modules/pymatgen/analysis/magnetism/analyzer.html
@@ -13,7 +13,6 @@
-
@@ -1374,7 +1373,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/magnetism/heisenberg.html b/docs/_modules/pymatgen/analysis/magnetism/heisenberg.html
index fb6bccc6c77..9b66b0d3a0f 100644
--- a/docs/_modules/pymatgen/analysis/magnetism/heisenberg.html
+++ b/docs/_modules/pymatgen/analysis/magnetism/heisenberg.html
@@ -13,7 +13,6 @@
-
@@ -902,7 +901,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/magnetism/jahnteller.html b/docs/_modules/pymatgen/analysis/magnetism/jahnteller.html
index 2b007925383..b2ee0a1d148 100644
--- a/docs/_modules/pymatgen/analysis/magnetism/jahnteller.html
+++ b/docs/_modules/pymatgen/analysis/magnetism/jahnteller.html
@@ -13,7 +13,6 @@
-
@@ -623,7 +622,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/molecule_matcher.html b/docs/_modules/pymatgen/analysis/molecule_matcher.html
index 17e0e7d2bfb..180f3672bf7 100644
--- a/docs/_modules/pymatgen/analysis/molecule_matcher.html
+++ b/docs/_modules/pymatgen/analysis/molecule_matcher.html
@@ -13,7 +13,6 @@
-
@@ -774,7 +773,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/molecule_structure_comparator.html b/docs/_modules/pymatgen/analysis/molecule_structure_comparator.html
index d95e461a045..057e1fffabb 100644
--- a/docs/_modules/pymatgen/analysis/molecule_structure_comparator.html
+++ b/docs/_modules/pymatgen/analysis/molecule_structure_comparator.html
@@ -13,7 +13,6 @@
-
@@ -266,7 +265,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/nmr.html b/docs/_modules/pymatgen/analysis/nmr.html
index 28a0768e3b9..9cf7553d4db 100644
--- a/docs/_modules/pymatgen/analysis/nmr.html
+++ b/docs/_modules/pymatgen/analysis/nmr.html
@@ -13,7 +13,6 @@
-
@@ -308,7 +307,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/path_finder.html b/docs/_modules/pymatgen/analysis/path_finder.html
index 7d38c4a3f5e..d4641b0fcf4 100644
--- a/docs/_modules/pymatgen/analysis/path_finder.html
+++ b/docs/_modules/pymatgen/analysis/path_finder.html
@@ -13,7 +13,6 @@
-
@@ -529,7 +528,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/phase_diagram.html b/docs/_modules/pymatgen/analysis/phase_diagram.html
index a972bcb4961..69ee88b95b8 100644
--- a/docs/_modules/pymatgen/analysis/phase_diagram.html
+++ b/docs/_modules/pymatgen/analysis/phase_diagram.html
@@ -13,7 +13,6 @@
-
@@ -2182,7 +2181,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/piezo.html b/docs/_modules/pymatgen/analysis/piezo.html
index 4e0b1f016bd..3b3ade4eb44 100644
--- a/docs/_modules/pymatgen/analysis/piezo.html
+++ b/docs/_modules/pymatgen/analysis/piezo.html
@@ -13,7 +13,6 @@
-
@@ -140,7 +139,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/piezo_sensitivity.html b/docs/_modules/pymatgen/analysis/piezo_sensitivity.html
index 2e48dfc1858..99befb2ed8c 100644
--- a/docs/_modules/pymatgen/analysis/piezo_sensitivity.html
+++ b/docs/_modules/pymatgen/analysis/piezo_sensitivity.html
@@ -13,7 +13,6 @@
-
@@ -917,7 +916,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/pourbaix_diagram.html b/docs/_modules/pymatgen/analysis/pourbaix_diagram.html
index 59a6ec44395..79d077b7b06 100644
--- a/docs/_modules/pymatgen/analysis/pourbaix_diagram.html
+++ b/docs/_modules/pymatgen/analysis/pourbaix_diagram.html
@@ -13,7 +13,6 @@
-
@@ -1163,7 +1162,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/quasiharmonic.html b/docs/_modules/pymatgen/analysis/quasiharmonic.html
index 8b86830eff6..652b701e27e 100644
--- a/docs/_modules/pymatgen/analysis/quasiharmonic.html
+++ b/docs/_modules/pymatgen/analysis/quasiharmonic.html
@@ -13,7 +13,6 @@
-
@@ -410,7 +409,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/reaction_calculator.html b/docs/_modules/pymatgen/analysis/reaction_calculator.html
index a2e90a6e1d1..53b677f6028 100644
--- a/docs/_modules/pymatgen/analysis/reaction_calculator.html
+++ b/docs/_modules/pymatgen/analysis/reaction_calculator.html
@@ -13,7 +13,6 @@
-
@@ -559,7 +558,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/structure_analyzer.html b/docs/_modules/pymatgen/analysis/structure_analyzer.html
index cbe92c75c20..fe3f1d68cb5 100644
--- a/docs/_modules/pymatgen/analysis/structure_analyzer.html
+++ b/docs/_modules/pymatgen/analysis/structure_analyzer.html
@@ -13,7 +13,6 @@
-
@@ -739,7 +738,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/structure_matcher.html b/docs/_modules/pymatgen/analysis/structure_matcher.html
index 4d1bb3400d7..86042ea2c47 100644
--- a/docs/_modules/pymatgen/analysis/structure_matcher.html
+++ b/docs/_modules/pymatgen/analysis/structure_matcher.html
@@ -13,7 +13,6 @@
-
@@ -128,6 +127,10 @@ Source code for pymatgen.analysis.structure_matcher
[docs] @classmethod
def from_dict(cls, d):
+ """
+ :param d: Dict representation
+ :return: Comparator.
+ """
for trans_modules in ['structure_matcher']:
mod = __import__('pymatgen.analysis.' + trans_modules,
globals(), locals(), [d['@class']], 0)
@@ -137,6 +140,9 @@ Source code for pymatgen.analysis.structure_matcher
raise ValueError("Invalid Comparator dict")
[docs] def as_dict(self):
+ """
+ :return: MSONable dict
+ """
return {"version": __version__, "@module": self.__class__.__module__,
"@class": self.__class__.__name__}
@@ -325,7 +331,10 @@ Source code for pymatgen.analysis.structure_matcher
return False
[docs] def get_hash(self, composition):
- # Difficult to define sensible hash
+ """
+ :param composition: Composition.
+ :return: 1. Difficult to define sensible hash
+ """
return 1
@@ -372,52 +381,53 @@ Source code for pymatgen.analysis.structure_matcher
continue. (This function will search all possible
lattices for the smallest average rms displacement
between the two structures)
-
- Args:
- ltol (float): Fractional length tolerance. Default is 0.2.
- stol (float): Site tolerance. Defined as the fraction of the
- average free length per atom := ( V / Nsites ) ** (1/3)
- Default is 0.3.
- angle_tol (float): Angle tolerance in degrees. Default is 5 degrees.
- primitive_cell (bool): If true: input structures will be reduced to
- primitive cells prior to matching. Default to True.
- scale (bool): Input structures are scaled to equivalent volume if
- true; For exact matching, set to False.
- attempt_supercell (bool): If set to True and number of sites in
- cells differ after a primitive cell reduction (divisible by an
- integer) attempts to generate a supercell transformation of the
- smaller cell which is equivalent to the larger structure.
- allow_subset (bool): Allow one structure to match to the subset of
- another structure. Eg. Matching of an ordered structure onto a
- disordered one, or matching a delithiated to a lithiated
- structure. This option cannot be combined with
- attempt_supercell, or with structure grouping.
- comparator (Comparator): A comparator object implementing an equals
- method that declares declaring equivalency of sites. Default is
- SpeciesComparator, which implies rigid species
- mapping, i.e., Fe2+ only matches Fe2+ and not Fe3+.
-
- Other comparators are provided, e.g., ElementComparator which
- matches only the elements and not the species.
-
- The reason why a comparator object is used instead of
- supplying a comparison function is that it is not possible to
- pickle a function, which makes it otherwise difficult to use
- StructureMatcher with Python's multiprocessing.
- supercell_size (str): Method to use for determining the size of a
- supercell (if applicable). Possible values are num_sites,
- num_atoms, volume, or an element present in both structures.
- ignored_species (list): A list of ions to be ignored in matching. Useful
- for matching structures that have similar frameworks except for
- certain ions, e.g., Li-ion intercalation frameworks. This is more
- useful than allow_subset because it allows better control over
- what species are ignored in the matching.
"""
def __init__(self, ltol=0.2, stol=0.3, angle_tol=5, primitive_cell=True,
scale=True, attempt_supercell=False, allow_subset=False,
comparator=SpeciesComparator(), supercell_size='num_sites',
ignored_species=None):
+ """
+ Args:
+ ltol (float): Fractional length tolerance. Default is 0.2.
+ stol (float): Site tolerance. Defined as the fraction of the
+ average free length per atom := ( V / Nsites ) ** (1/3)
+ Default is 0.3.
+ angle_tol (float): Angle tolerance in degrees. Default is 5 degrees.
+ primitive_cell (bool): If true: input structures will be reduced to
+ primitive cells prior to matching. Default to True.
+ scale (bool): Input structures are scaled to equivalent volume if
+ true; For exact matching, set to False.
+ attempt_supercell (bool): If set to True and number of sites in
+ cells differ after a primitive cell reduction (divisible by an
+ integer) attempts to generate a supercell transformation of the
+ smaller cell which is equivalent to the larger structure.
+ allow_subset (bool): Allow one structure to match to the subset of
+ another structure. Eg. Matching of an ordered structure onto a
+ disordered one, or matching a delithiated to a lithiated
+ structure. This option cannot be combined with
+ attempt_supercell, or with structure grouping.
+ comparator (Comparator): A comparator object implementing an equals
+ method that declares declaring equivalency of sites. Default is
+ SpeciesComparator, which implies rigid species
+ mapping, i.e., Fe2+ only matches Fe2+ and not Fe3+.
+
+ Other comparators are provided, e.g., ElementComparator which
+ matches only the elements and not the species.
+
+ The reason why a comparator object is used instead of
+ supplying a comparison function is that it is not possible to
+ pickle a function, which makes it otherwise difficult to use
+ StructureMatcher with Python's multiprocessing.
+ supercell_size (str): Method to use for determining the size of a
+ supercell (if applicable). Possible values are num_sites,
+ num_atoms, volume, or an element present in both structures.
+ ignored_species (list): A list of ions to be ignored in matching. Useful
+ for matching structures that have similar frameworks except for
+ certain ions, e.g., Li-ion intercalation frameworks. This is more
+ useful than allow_subset because it allows better control over
+ what species are ignored in the matching.
+ """
self.ltol = ltol
self.stol = stol
@@ -483,9 +493,9 @@ Source code for pymatgen.analysis.structure_matcher
"""
def av_lat(l1, l2):
- params = (np.array(l1.lengths_and_angles) +
- np.array(l2.lengths_and_angles)) / 2
- return Lattice.from_lengths_and_angles(*params)
+ params = (np.array(l1.parameters) +
+ np.array(l2.parameters)) / 2
+ return Lattice.from_parameters(*params)
def sc_generator(s1, s2):
s2_fc = np.array(s2.frac_coords)
@@ -827,6 +837,9 @@ Source code for pymatgen.analysis.structure_matcher
return all_groups
[docs] def as_dict(self):
+ """
+ :return: MSONable dict
+ """
return {"version": __version__, "@module": self.__class__.__module__,
"@class": self.__class__.__name__,
"comparator": self._comparator.as_dict(),
@@ -838,6 +851,10 @@ Source code for pymatgen.analysis.structure_matcher
[docs] @classmethod
def from_dict(cls, d):
+ """
+ :param d: Dict representation
+ :return: StructureMatcher
+ """
return StructureMatcher(
ltol=d["ltol"], stol=d["stol"], angle_tol=d["angle_tol"],
primitive_cell=d["primitive_cell"], scale=d["scale"],
@@ -1164,23 +1181,24 @@ Source code for pymatgen.analysis.structure_matcher
NOTE: for defect complexes (more than a single defect),
this comparator will break.
-
- Args:
- check_charge (bool): Gives option to check
- if charges are identical.
- Default is False (different charged defects can be same)
- check_primitive_cell (bool): Gives option to
- compare different supercells of bulk_structure,
- rather than directly compare supercell sizes
- Default is False (requires bulk_structure in each defect to be same size)
- check_lattice_scale (bool): Gives option to scale volumes of
- structures to each other identical lattice constants.
- Default is False (enforces same
- lattice constants in both structures)
"""
def __init__(self, check_charge=False, check_primitive_cell=False,
check_lattice_scale=False):
+ """
+ Args:
+ check_charge (bool): Gives option to check
+ if charges are identical.
+ Default is False (different charged defects can be same)
+ check_primitive_cell (bool): Gives option to
+ compare different supercells of bulk_structure,
+ rather than directly compare supercell sizes
+ Default is False (requires bulk_structure in each defect to be same size)
+ check_lattice_scale (bool): Gives option to scale volumes of
+ structures to each other identical lattice constants.
+ Default is False (enforces same
+ lattice constants in both structures)
+ """
self.check_charge = check_charge
self.check_primitive_cell = check_primitive_cell
self.check_lattice_scale = check_lattice_scale
@@ -1275,7 +1293,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/structure_prediction/dopant_predictor.html b/docs/_modules/pymatgen/analysis/structure_prediction/dopant_predictor.html
index 522da6ea713..110c9b4312a 100644
--- a/docs/_modules/pymatgen/analysis/structure_prediction/dopant_predictor.html
+++ b/docs/_modules/pymatgen/analysis/structure_prediction/dopant_predictor.html
@@ -13,7 +13,6 @@
-
@@ -269,7 +268,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/structure_prediction/substitution_probability.html b/docs/_modules/pymatgen/analysis/structure_prediction/substitution_probability.html
index 12071b9d85d..b4e769df3a9 100644
--- a/docs/_modules/pymatgen/analysis/structure_prediction/substitution_probability.html
+++ b/docs/_modules/pymatgen/analysis/structure_prediction/substitution_probability.html
@@ -13,7 +13,6 @@
-
@@ -340,7 +339,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/structure_prediction/substitutor.html b/docs/_modules/pymatgen/analysis/structure_prediction/substitutor.html
index 31acc554365..56c091d991f 100644
--- a/docs/_modules/pymatgen/analysis/structure_prediction/substitutor.html
+++ b/docs/_modules/pymatgen/analysis/structure_prediction/substitutor.html
@@ -13,7 +13,6 @@
-
@@ -349,7 +348,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/structure_prediction/volume_predictor.html b/docs/_modules/pymatgen/analysis/structure_prediction/volume_predictor.html
index 8af667abefd..03cce46fd0b 100644
--- a/docs/_modules/pymatgen/analysis/structure_prediction/volume_predictor.html
+++ b/docs/_modules/pymatgen/analysis/structure_prediction/volume_predictor.html
@@ -13,7 +13,6 @@
-
@@ -343,7 +342,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/substrate_analyzer.html b/docs/_modules/pymatgen/analysis/substrate_analyzer.html
index 33a1cc73709..c8d667b888e 100644
--- a/docs/_modules/pymatgen/analysis/substrate_analyzer.html
+++ b/docs/_modules/pymatgen/analysis/substrate_analyzer.html
@@ -13,7 +13,6 @@
-
@@ -515,7 +514,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/surface_analysis.html b/docs/_modules/pymatgen/analysis/surface_analysis.html
index 65c4bcffe27..b8905dd2727 100644
--- a/docs/_modules/pymatgen/analysis/surface_analysis.html
+++ b/docs/_modules/pymatgen/analysis/surface_analysis.html
@@ -13,7 +13,6 @@
-
@@ -1952,7 +1951,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/thermochemistry.html b/docs/_modules/pymatgen/analysis/thermochemistry.html
index f66961104a1..f346f10a725 100644
--- a/docs/_modules/pymatgen/analysis/thermochemistry.html
+++ b/docs/_modules/pymatgen/analysis/thermochemistry.html
@@ -13,7 +13,6 @@
-
@@ -171,7 +170,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/transition_state.html b/docs/_modules/pymatgen/analysis/transition_state.html
index 1a7fdb2ab13..ce412cb6def 100644
--- a/docs/_modules/pymatgen/analysis/transition_state.html
+++ b/docs/_modules/pymatgen/analysis/transition_state.html
@@ -13,7 +13,6 @@
-
@@ -488,7 +487,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/wulff.html b/docs/_modules/pymatgen/analysis/wulff.html
index 5f50acc2485..4e18448c750 100644
--- a/docs/_modules/pymatgen/analysis/wulff.html
+++ b/docs/_modules/pymatgen/analysis/wulff.html
@@ -13,7 +13,6 @@
-
@@ -725,7 +724,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/analysis/xas/spectrum.html b/docs/_modules/pymatgen/analysis/xas/spectrum.html
index b777226d126..099368002f5 100644
--- a/docs/_modules/pymatgen/analysis/xas/spectrum.html
+++ b/docs/_modules/pymatgen/analysis/xas/spectrum.html
@@ -13,7 +13,6 @@
-
@@ -141,7 +140,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/apps/battery/analyzer.html b/docs/_modules/pymatgen/apps/battery/analyzer.html
index d8c7476639c..5a4f408f092 100644
--- a/docs/_modules/pymatgen/apps/battery/analyzer.html
+++ b/docs/_modules/pymatgen/apps/battery/analyzer.html
@@ -13,7 +13,6 @@
-
@@ -304,7 +303,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/apps/battery/battery_abc.html b/docs/_modules/pymatgen/apps/battery/battery_abc.html
index 44e5080103f..3a3ba71e099 100644
--- a/docs/_modules/pymatgen/apps/battery/battery_abc.html
+++ b/docs/_modules/pymatgen/apps/battery/battery_abc.html
@@ -13,7 +13,6 @@
-
@@ -429,7 +428,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/apps/battery/conversion_battery.html b/docs/_modules/pymatgen/apps/battery/conversion_battery.html
index fe621e4b7c9..5cb4be35b6f 100644
--- a/docs/_modules/pymatgen/apps/battery/conversion_battery.html
+++ b/docs/_modules/pymatgen/apps/battery/conversion_battery.html
@@ -13,7 +13,6 @@
-
@@ -600,7 +599,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/apps/battery/insertion_battery.html b/docs/_modules/pymatgen/apps/battery/insertion_battery.html
index f07f6b0a1f0..f276449ffc8 100644
--- a/docs/_modules/pymatgen/apps/battery/insertion_battery.html
+++ b/docs/_modules/pymatgen/apps/battery/insertion_battery.html
@@ -13,7 +13,6 @@
-
@@ -626,7 +625,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/apps/battery/plotter.html b/docs/_modules/pymatgen/apps/battery/plotter.html
index 96b7705b686..20c0ed48d11 100644
--- a/docs/_modules/pymatgen/apps/battery/plotter.html
+++ b/docs/_modules/pymatgen/apps/battery/plotter.html
@@ -13,7 +13,6 @@
-
@@ -197,7 +196,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/apps/borg/hive.html b/docs/_modules/pymatgen/apps/borg/hive.html
index 3b45e4b1a6d..6f325a45ad3 100644
--- a/docs/_modules/pymatgen/apps/borg/hive.html
+++ b/docs/_modules/pymatgen/apps/borg/hive.html
@@ -13,7 +13,6 @@
-
@@ -471,7 +470,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/apps/borg/queen.html b/docs/_modules/pymatgen/apps/borg/queen.html
index 053b4696ad6..1fb8224604f 100644
--- a/docs/_modules/pymatgen/apps/borg/queen.html
+++ b/docs/_modules/pymatgen/apps/borg/queen.html
@@ -13,7 +13,6 @@
-
@@ -226,7 +225,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/cli/feff_input_generation.html b/docs/_modules/pymatgen/cli/feff_input_generation.html
index 1ed4d89c781..0e0d54fc0cc 100644
--- a/docs/_modules/pymatgen/cli/feff_input_generation.html
+++ b/docs/_modules/pymatgen/cli/feff_input_generation.html
@@ -13,7 +13,6 @@
-
@@ -159,7 +158,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/cli/feff_plot_cross_section.html b/docs/_modules/pymatgen/cli/feff_plot_cross_section.html
index 1c1b79c1841..ee8186afe6c 100644
--- a/docs/_modules/pymatgen/cli/feff_plot_cross_section.html
+++ b/docs/_modules/pymatgen/cli/feff_plot_cross_section.html
@@ -13,7 +13,6 @@
-
@@ -151,7 +150,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/cli/feff_plot_dos.html b/docs/_modules/pymatgen/cli/feff_plot_dos.html
index daab0829936..44551513152 100644
--- a/docs/_modules/pymatgen/cli/feff_plot_dos.html
+++ b/docs/_modules/pymatgen/cli/feff_plot_dos.html
@@ -13,7 +13,6 @@
-
@@ -151,7 +150,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/cli/gaussian_analyzer.html b/docs/_modules/pymatgen/cli/gaussian_analyzer.html
index 1b4ca0ab72f..29a21fa0dc5 100644
--- a/docs/_modules/pymatgen/cli/gaussian_analyzer.html
+++ b/docs/_modules/pymatgen/cli/gaussian_analyzer.html
@@ -13,7 +13,6 @@
-
@@ -174,7 +173,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/cli/get_environment.html b/docs/_modules/pymatgen/cli/get_environment.html
index 98b5569a092..ff6d42cd076 100644
--- a/docs/_modules/pymatgen/cli/get_environment.html
+++ b/docs/_modules/pymatgen/cli/get_environment.html
@@ -13,7 +13,6 @@
-
@@ -118,7 +117,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/cli/pmg.html b/docs/_modules/pymatgen/cli/pmg.html
index 012c24b2b6d..1516283adc1 100644
--- a/docs/_modules/pymatgen/cli/pmg.html
+++ b/docs/_modules/pymatgen/cli/pmg.html
@@ -13,7 +13,6 @@
-
@@ -372,7 +371,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/cli/pmg_analyze.html b/docs/_modules/pymatgen/cli/pmg_analyze.html
index d0624ed722b..bb1b90e66cd 100644
--- a/docs/_modules/pymatgen/cli/pmg_analyze.html
+++ b/docs/_modules/pymatgen/cli/pmg_analyze.html
@@ -13,7 +13,6 @@
-
@@ -222,7 +221,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/cli/pmg_config.html b/docs/_modules/pymatgen/cli/pmg_config.html
index 62b6dc31ecd..4f7063bef5d 100644
--- a/docs/_modules/pymatgen/cli/pmg_config.html
+++ b/docs/_modules/pymatgen/cli/pmg_config.html
@@ -13,7 +13,6 @@
-
@@ -281,7 +280,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/cli/pmg_plot.html b/docs/_modules/pymatgen/cli/pmg_plot.html
index 290f720c703..05e7d930364 100644
--- a/docs/_modules/pymatgen/cli/pmg_plot.html
+++ b/docs/_modules/pymatgen/cli/pmg_plot.html
@@ -13,7 +13,6 @@
-
@@ -171,7 +170,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/cli/pmg_potcar.html b/docs/_modules/pymatgen/cli/pmg_potcar.html
index 699c141316f..f0f347eeebf 100644
--- a/docs/_modules/pymatgen/cli/pmg_potcar.html
+++ b/docs/_modules/pymatgen/cli/pmg_potcar.html
@@ -13,7 +13,6 @@
-
@@ -126,7 +125,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/cli/pmg_query.html b/docs/_modules/pymatgen/cli/pmg_query.html
index 2782d66f0c8..513695a3d0a 100644
--- a/docs/_modules/pymatgen/cli/pmg_query.html
+++ b/docs/_modules/pymatgen/cli/pmg_query.html
@@ -13,7 +13,6 @@
-
@@ -138,7 +137,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/cli/pmg_structure.html b/docs/_modules/pymatgen/cli/pmg_structure.html
index 155708dc256..209f5e50dee 100644
--- a/docs/_modules/pymatgen/cli/pmg_structure.html
+++ b/docs/_modules/pymatgen/cli/pmg_structure.html
@@ -13,7 +13,6 @@
-
@@ -184,7 +183,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/command_line/aconvasp_caller.html b/docs/_modules/pymatgen/command_line/aconvasp_caller.html
index f6a88c2137e..8d5a29a94dc 100644
--- a/docs/_modules/pymatgen/command_line/aconvasp_caller.html
+++ b/docs/_modules/pymatgen/command_line/aconvasp_caller.html
@@ -13,7 +13,6 @@
-
@@ -203,7 +202,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/command_line/bader_caller.html b/docs/_modules/pymatgen/command_line/bader_caller.html
index 1575e8baca9..ffe120c7827 100644
--- a/docs/_modules/pymatgen/command_line/bader_caller.html
+++ b/docs/_modules/pymatgen/command_line/bader_caller.html
@@ -13,7 +13,6 @@
-
@@ -561,7 +560,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/command_line/critic2_caller.html b/docs/_modules/pymatgen/command_line/critic2_caller.html
index e2998ce446c..210c835e734 100644
--- a/docs/_modules/pymatgen/command_line/critic2_caller.html
+++ b/docs/_modules/pymatgen/command_line/critic2_caller.html
@@ -13,7 +13,6 @@
-
@@ -652,7 +651,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/command_line/enumlib_caller.html b/docs/_modules/pymatgen/command_line/enumlib_caller.html
index 7259c5b823f..fd52064a762 100644
--- a/docs/_modules/pymatgen/command_line/enumlib_caller.html
+++ b/docs/_modules/pymatgen/command_line/enumlib_caller.html
@@ -13,7 +13,6 @@
-
@@ -497,7 +496,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/command_line/gulp_caller.html b/docs/_modules/pymatgen/command_line/gulp_caller.html
index 8aade5db71c..30ffd004be0 100644
--- a/docs/_modules/pymatgen/command_line/gulp_caller.html
+++ b/docs/_modules/pymatgen/command_line/gulp_caller.html
@@ -13,7 +13,6 @@
-
@@ -799,7 +798,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/command_line/mcsqs_caller.html b/docs/_modules/pymatgen/command_line/mcsqs_caller.html
index cbd95e27e5f..839cc6bc48a 100644
--- a/docs/_modules/pymatgen/command_line/mcsqs_caller.html
+++ b/docs/_modules/pymatgen/command_line/mcsqs_caller.html
@@ -13,7 +13,6 @@
-
@@ -211,7 +210,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/command_line/vampire_caller.html b/docs/_modules/pymatgen/command_line/vampire_caller.html
index 6e2453b9efd..eb457212689 100644
--- a/docs/_modules/pymatgen/command_line/vampire_caller.html
+++ b/docs/_modules/pymatgen/command_line/vampire_caller.html
@@ -13,7 +13,6 @@
-
@@ -510,7 +509,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/core/bonds.html b/docs/_modules/pymatgen/core/bonds.html
index 7e4f4f302be..ec746cc386a 100644
--- a/docs/_modules/pymatgen/core/bonds.html
+++ b/docs/_modules/pymatgen/core/bonds.html
@@ -13,7 +13,6 @@
-
@@ -63,10 +62,8 @@ Source code for pymatgen.core.bonds
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
-__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyuep@gmail.com"
-__date__ = "Jul 26, 2012"
def _load_bond_length_data():
@@ -158,7 +155,7 @@ Source code for pymatgen.core.bonds
if dist < (1 + tol) * v:
return True
return False
- elif default_bl:
+ if default_bl:
return dist < (1 + tol) * default_bl
raise ValueError("No bond data for elements {} - {}".format(*syms))
@@ -191,10 +188,9 @@ Source code for pymatgen.core.bonds
syms = tuple(sorted([sp1, sp2]))
if syms in bond_lengths:
return bond_lengths[syms].copy()
- elif default_bl is not None:
+ if default_bl is not None:
return {1: default_bl}
- else:
- raise ValueError("No bond data for elements {} - {}".format(*syms))
+ raise ValueError("No bond data for elements {} - {}".format(*syms))
[docs]def get_bond_order(sp1, sp2, dist, tol=0.2, default_bl=None):
@@ -228,10 +224,9 @@ Source code for pymatgen.core.bonds
if lengths_list[trial_bond_order] < dist:
if trial_bond_order == 0:
return trial_bond_order
- else:
- low_bl = lengths_list[trial_bond_order]
- high_bl = lengths_list[trial_bond_order - 1]
- return trial_bond_order - (dist - low_bl) / (high_bl - low_bl)
+ low_bl = lengths_list[trial_bond_order]
+ high_bl = lengths_list[trial_bond_order - 1]
+ return trial_bond_order - (dist - low_bl) / (high_bl - low_bl)
trial_bond_order += 1
# Distance shorter than the shortest bond length stored,
# check if the distance is too short
@@ -311,7 +306,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/core/composition.html b/docs/_modules/pymatgen/core/composition.html
index 05a56c2b56d..bbc528a35c3 100644
--- a/docs/_modules/pymatgen/core/composition.html
+++ b/docs/_modules/pymatgen/core/composition.html
@@ -13,7 +13,6 @@
-
@@ -58,20 +57,17 @@ Source code for pymatgen.core.composition
import numbers
import string
from itertools import combinations_with_replacement, product
-
import os
import re
-
-from collections import defaultdict
from typing import Tuple, List
-from monty.serialization import loadfn
-
from functools import total_ordering
+from monty.serialization import loadfn
from monty.fractions import gcd, gcd_float
+from monty.json import MSONable
+
from pymatgen.core.periodic_table import get_el_sp, Element, Specie, DummySpecie
from pymatgen.util.string import formula_double_format
-from monty.json import MSONable
from pymatgen.core.units import Mass
__author__ = "Shyue Ping Ong"
@@ -123,17 +119,13 @@ Source code for pymatgen.core.composition
7.0
"""
- """
- Tolerance in distinguishing different composition amounts.
- 1e-8 is fairly tight, but should cut out most floating point arithmetic
- errors.
- """
+ # Tolerance in distinguishing different composition amounts.
+ # 1e-8 is fairly tight, but should cut out most floating point arithmetic
+ # errors.
amount_tolerance = 1e-8
- """
- Special formula handling for peroxides and certain elements. This is so
- that formula output does not write LiO instead of Li2O2 for example.
- """
+ # Special formula handling for peroxides and certain elements. This is so
+ # that formula output does not write LiO instead of Li2O2 for example.
special_formulas = {"LiO": "Li2O2", "NaO": "Na2O2", "KO": "K2O2",
"HO": "H2O2", "CsO": "Cs2O2", "RbO": "Rb2O2",
"O": "O2", "N": "N2", "F": "F2", "Cl": "Cl2",
@@ -233,7 +225,7 @@ Source code for pymatgen.core.composition
for el in sorted(set(self.elements + other.elements)):
if other[el] - self[el] >= Composition.amount_tolerance:
return False
- elif self[el] - other[el] >= Composition.amount_tolerance:
+ if self[el] - other[el] >= Composition.amount_tolerance:
return True
return True
@@ -593,8 +585,7 @@ Source code for pymatgen.core.composition
if "block" in category:
return any([category[0] in el.block for el in self.elements])
- else:
- return any([getattr(el, "is_{}".format(category)) for el in self.elements])
+ return any([getattr(el, "is_{}".format(category)) for el in self.elements])
def _parse_formula(self, formula):
"""
@@ -818,7 +809,7 @@ Source code for pymatgen.core.composition
all_oxi_states, max_sites, oxi_states_override, target_charge)
# Special case: No charged compound is possible
- if len(oxidation_states) == 0:
+ if not oxidation_states:
return Composition(dict((Specie(e, 0), f) for e, f in self.items()))
# Generate the species
@@ -921,7 +912,7 @@ Source code for pymatgen.core.composition
el_amt = comp.get_el_amt_dict()
els = el_amt.keys()
el_sums = [] # matrix: dim1= el_idx, dim2=possible sums
- el_sum_scores = defaultdict(set) # dict of el_idx, sum -> score
+ el_sum_scores = collections.defaultdict(set) # dict of el_idx, sum -> score
el_best_oxid_combo = {} # dict of el_idx, sum -> oxid combo with best score
for idx, el in enumerate(els):
el_sum_scores[idx] = {}
@@ -980,7 +971,7 @@ Source code for pymatgen.core.composition
dict((e, el_best_oxid_combo[idx][v]) for idx, (e, v) in enumerate(zip(els, x))))
# sort the solutions by highest to lowest score
- if len(all_scores) > 0:
+ if all_scores:
all_sols, all_oxid_combo = zip(*[(y, x) for (z, y, x) in sorted(zip(all_scores, all_sols, all_oxid_combo),
key=lambda pair: pair[0],
reverse=True)])
@@ -1027,7 +1018,7 @@ Source code for pymatgen.core.composition
return all_matches
@staticmethod
- def _comps_from_fuzzy_formula(fuzzy_formula, m_dict={}, m_points=0,
+ def _comps_from_fuzzy_formula(fuzzy_formula, m_dict=None, m_points=0,
factor=1):
"""
A recursive helper method for formula parsing that helps in
@@ -1049,6 +1040,7 @@ Source code for pymatgen.core.composition
the second element being the number of points awarded that
Composition intepretation.
"""
+ m_dict = m_dict or {}
def _parse_chomp_and_rank(m, f, m_dict, m_points):
"""
@@ -1239,8 +1231,7 @@ Source code for pymatgen.core.composition
+ """Exception class for composition errors"""
[docs]class ChemicalPotential(dict, MSONable):
@@ -1265,16 +1256,14 @@ Source code for pymatgen.core.composition
def __mul__(self, other):
if isinstance(other, numbers.Number):
return ChemicalPotential({k: v * other for k, v in self.items()})
- else:
- return NotImplemented
+ raise NotImplementedError()
__rmul__ = __mul__
def __truediv__(self, other):
if isinstance(other, numbers.Number):
return ChemicalPotential({k: v / other for k, v in self.items()})
- else:
- return NotImplemented
+ raise NotImplementedError()
__div__ = __truediv__
@@ -1283,16 +1272,14 @@ Source code for pymatgen.core.composition
els = set(self.keys()).union(other.keys())
return ChemicalPotential({e: self.get(e, 0) - other.get(e, 0)
for e in els})
- else:
- return NotImplemented
+ raise NotImplementedError()
def __add__(self, other):
if isinstance(other, ChemicalPotential):
els = set(self.keys()).union(other.keys())
return ChemicalPotential({e: self.get(e, 0) + other.get(e, 0)
for e in els})
- else:
- return NotImplemented
+ raise NotImplementedError()
[docs] def get_energy(self, composition, strict=True):
"""
@@ -1353,7 +1340,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/core/ion.html b/docs/_modules/pymatgen/core/ion.html
index fb86fda816d..96e3cb6134f 100644
--- a/docs/_modules/pymatgen/core/ion.html
+++ b/docs/_modules/pymatgen/core/ion.html
@@ -13,7 +13,6 @@
-
@@ -53,20 +52,14 @@ Source code for pymatgen.core.ion
Module containing class to create an ion
"""
-__author__ = "Sai Jayaraman"
-__copyright__ = "Copyright 2012, The Materials Project"
-__version__ = "0.0"
-__maintainer__ = "Sai Jayaraman"
-__email__ = "sjayaram@mit.edu"
-__status__ = "Production"
-__date__ = "Dec 10, 2012"
-
import re
-import numpy as np
from copy import deepcopy
-from pymatgen.core.composition import Composition
+import numpy as np
+
from monty.json import MSONable
+
+from pymatgen.core.composition import Composition
from pymatgen.util.string import formula_double_format
@@ -306,7 +299,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/core/lattice.html b/docs/_modules/pymatgen/core/lattice.html
index e44c68bc8fd..de3efb691b3 100644
--- a/docs/_modules/pymatgen/core/lattice.html
+++ b/docs/_modules/pymatgen/core/lattice.html
@@ -13,7 +13,6 @@
-
@@ -56,30 +55,27 @@ Source code for pymatgen.core.lattice
import math
import itertools
import warnings
-
from functools import reduce
-from math import gcd
+import collections
from fractions import Fraction
-
from typing import List, Union, Dict, Tuple, Iterator, Optional, Sequence
-from pymatgen.util.typing import Vector3Like
import numpy as np
from numpy.linalg import inv
from numpy import pi, dot, transpose
from monty.json import MSONable
+from monty.dev import deprecated
+
from pymatgen.util.coord import pbc_shortest_vectors
from pymatgen.util.num import abs_cap
+from pymatgen.util.typing import Vector3Like
__author__ = "Shyue Ping Ong, Michael Kocher"
__copyright__ = "Copyright 2011, The Materials Project"
-__version__ = "1.0"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyuep@gmail.com"
-__status__ = "Production"
-__date__ = "Sep 23, 2011"
[docs]class Lattice(MSONable):
@@ -166,7 +162,7 @@ Source code for pymatgen.core.lattice
elif fmt_spec.endswith("p"):
fmt = "{{{}, {}, {}, {}, {}, {}}}"
fmt_spec = fmt_spec[:-1]
- m = self.lengths_and_angles
+ m = (self.lengths, self.angles)
else:
fmt = "{} {} {}\n{} {} {}\n{} {} {}"
return fmt.format(*[format(c, fmt_spec) for row in m for c in row])
@@ -239,7 +235,7 @@ Source code for pymatgen.core.lattice
Returns:
Lattice coordinates.
"""
- return self.lengths_and_angles[0] * self.get_fractional_coords(cart_coords)
+ return self.lengths * self.get_fractional_coords(cart_coords)
[docs] def d_hkl(self, miller_index: Vector3Like) -> float:
"""
@@ -344,7 +340,8 @@ Source code for pymatgen.core.lattice
"""
return Lattice.from_parameters(a, a, a, alpha, alpha, alpha)
-[docs] @staticmethod
+ @staticmethod
+ @deprecated(message="Use Lattice.from_parameters instead. This will be removed in v2020.*")
def from_lengths_and_angles(abc: Sequence[float], ang: Sequence[float]):
"""
Create a Lattice using unit cell lengths and angles (in degrees).
@@ -356,7 +353,7 @@ Source code for pymatgen.core.lattice
Returns:
A Lattice with the specified lattice parameters.
"""
- return Lattice.from_parameters(abc[0], abc[1], abc[2], ang[0], ang[1], ang[2])
+ return Lattice.from_parameters(abc[0], abc[1], abc[2], ang[0], ang[1], ang[2])
[docs] @classmethod
def from_parameters(
@@ -435,10 +432,8 @@ Source code for pymatgen.core.lattice
if "matrix" in d:
return cls(d["matrix"])
- else:
- return cls.from_parameters(
- d["a"], d["b"], d["c"], d["alpha"], d["beta"], d["gamma"]
- )
+ return cls.from_parameters(d["a"], d["b"], d["c"],
+ d["alpha"], d["beta"], d["gamma"])
@property
def a(self) -> float:
@@ -498,6 +493,14 @@ Source code for pymatgen.core.lattice
return float(abs(dot(np.cross(m[0], m[1]), m[2])))
@property
+ def parameters(self) -> Tuple[float, float, float, float, float, float]:
+ """
+ Returns: (a, b, c, alpha, beta, gamma).
+ """
+ return (*self.lengths, *self.angles)
+
+ @property # type: ignore
+ @deprecated(message="Use Lattice.parameters instead. This will be removed in v2020.*")
def lengths_and_angles(self) -> Tuple[Tuple[float, float, float], Tuple[float, float, float]]:
"""
Returns (lattice lengths, lattice angles).
@@ -596,7 +599,7 @@ Source code for pymatgen.core.lattice
"@class": self.__class__.__name__,
"matrix": self._matrix.tolist(),
}
- (a, b, c), (alpha, beta, gamma) = self.lengths_and_angles
+ a, b, c, alpha, beta, gamma = self.parameters
if verbosity > 0:
d.update(
{
@@ -646,8 +649,8 @@ Source code for pymatgen.core.lattice
None is returned if no matches are found.
"""
- (lengths, angles) = other_lattice.lengths_and_angles
- (alpha, beta, gamma) = angles
+ lengths = other_lattice.lengths
+ (alpha, beta, gamma) = other_lattice.angles
frac, dist, _, _ = self.get_points_in_sphere(
[[0, 0, 0]], [0, 0, 0], max(lengths) * (1 + ltol), zip_results=False
@@ -807,7 +810,7 @@ Source code for pymatgen.core.lattice
# Update the Gram-Schmidt coefficients
for s in range(k - 1, k + 1):
u[s - 1, 0: (s - 1)] = (
- dot(a[:, s - 1].T, b[:, 0: (s - 1)]) / m[0: (s - 1)]
+ dot(a[:, s - 1].T, b[:, 0: (s - 1)]) / m[0: (s - 1)]
)
b[:, s - 1] = a[:, s - 1] - dot(
b[:, 0: (s - 1)], u[s - 1, 0: (s - 1)].T
@@ -975,8 +978,7 @@ Source code for pymatgen.core.lattice
if mapped is not None:
if np.linalg.det(mapped[0].matrix) > 0:
return mapped[0]
- else:
- return Lattice(-mapped[0].matrix)
+ return Lattice(-mapped[0].matrix)
raise ValueError("can't find niggli")
@@ -1102,6 +1104,57 @@ Source code for pymatgen.core.lattice
center: Vector3Like,
r: float,
zip_results=True,
+ ) -> Union[
+ List[Tuple[np.ndarray, float, int, np.ndarray]],
+ List[np.ndarray],
+ ]:
+ """
+ Find all points within a sphere from the point taking into account
+ periodic boundary conditions. This includes sites in other periodic
+ images.
+
+ Algorithm:
+
+ 1. place sphere of radius r in crystal and determine minimum supercell
+ (parallelpiped) which would contain a sphere of radius r. for this
+ we need the projection of a_1 on a unit vector perpendicular
+ to a_2 & a_3 (i.e. the unit vector in the direction b_1) to
+ determine how many a_1"s it will take to contain the sphere.
+
+ Nxmax = r * length_of_b_1 / (2 Pi)
+
+ 2. keep points falling within r.
+
+ Args:
+ frac_points: All points in the lattice in fractional coordinates.
+ center: Cartesian coordinates of center of sphere.
+ r: radius of sphere.
+ zip_results (bool): Whether to zip the results together to group by
+ point, or return the raw fcoord, dist, index arrays
+
+ Returns:
+ if zip_results:
+ [(fcoord, dist, index, supercell_image) ...] since most of the time, subsequent
+ processing requires the distance, index number of the atom, or index of the image
+ else:
+ fcoords, dists, inds, image
+ """
+ cart_coords = self.get_cartesian_coords(frac_points)
+ neighbors = get_points_in_spheres(all_coords=cart_coords, center_coords=np.array([center]), r=r, pbc=True,
+ numerical_tol=1e-8, lattice=self, return_fcoords=True)[0]
+ if len(neighbors) < 1:
+ return [] if zip_results else [()] * 4
+ if zip_results:
+ return neighbors
+ return [np.array(i) for i in list(zip(*neighbors))]
+
+ @deprecated(get_points_in_sphere, "This is retained purely for checking purposes.")
+ def get_points_in_sphere_old(
+ self,
+ frac_points: List[Vector3Like],
+ center: Vector3Like,
+ r: float,
+ zip_results=True,
) -> Union[
List[Tuple[np.ndarray, float, int, np.ndarray]],
Tuple[List[np.ndarray], List[float], List[int], List[np.ndarray]],
@@ -1190,13 +1243,12 @@ Source code for pymatgen.core.lattice
images[within_r[1:]],
)
)
- else:
- return (
- shifted_coords[within_r],
- np.sqrt(d_2[within_r]),
- indices[within_r[0]],
- images[within_r[1:]],
- )
+ return (
+ shifted_coords[within_r],
+ np.sqrt(d_2[within_r]),
+ indices[within_r[0]],
+ images[within_r[1:]],
+ )
[docs] def get_all_distances(
self,
@@ -1231,16 +1283,16 @@ Source code for pymatgen.core.lattice
:param hex_length_tol: Length tolerance
:return: Whether lattice corresponds to hexagonal lattice.
"""
- lengths, angles = self.lengths_and_angles
+ lengths = self.lengths
+ angles = self.angles
right_angles = [i for i in range(3) if abs(angles[i] - 90) < hex_angle_tol]
hex_angles = [i for i in range(3)
if abs(angles[i] - 60) < hex_angle_tol or abs(angles[i] - 120) < hex_angle_tol]
return (
- len(right_angles) == 2
- and len(hex_angles) == 1
- and abs(lengths[right_angles[0]] - lengths[right_angles[1]])
- < hex_length_tol
+ len(right_angles) == 2 and
+ len(hex_angles) == 1 and
+ abs(lengths[right_angles[0]] - lengths[right_angles[1]]) < hex_length_tol
)
[docs] def get_distance_and_image(
@@ -1375,7 +1427,7 @@ Source code for pymatgen.core.lattice
md = [Fraction(n).limit_denominator(12).denominator for n in mi]
mi *= reduce(lambda x, y: x * y, md)
int_miller_index = np.int_(np.round(mi, 1))
- mi /= np.abs(reduce(gcd, int_miller_index))
+ mi /= np.abs(reduce(math.gcd, int_miller_index))
# round to a reasonable precision
mi = np.array([round(h, round_dp) for h in mi])
@@ -1406,6 +1458,193 @@ Source code for pymatgen.core.lattice
mi *= -1
return tuple(mi) # type: ignore
+
+
+[docs]def get_points_in_spheres(all_coords: np.ndarray, center_coords: np.ndarray, r: float,
+ pbc: Union[bool, List[bool]] = True, numerical_tol: float = 1e-8,
+ lattice: Lattice = None, return_fcoords: bool = False,
+ ) -> List[List[Tuple[np.ndarray, float, int, np.ndarray]]]:
+ """
+ For each point in `center_coords`, get all the neighboring points in `all_coords` that are within the
+ cutoff radius `r`.
+
+ Args:
+ all_coords: (list of cartesian coordinates) all available points
+ center_coords: (list of cartesian coordinates) all centering points
+ r: (float) cutoff radius
+ pbc: (bool or a list of bool) whether to set periodic boundaries
+ numerical_tol: (float) numerical tolerance
+ lattice: (Lattice) lattice to consider when PBC is enabled
+ return_fcoords: (bool) whether to return fractional coords when pbc is set.
+ Returns:
+ List[List[Tuple[coords, distance, index, image]]]
+ """
+ if isinstance(pbc, bool):
+ pbc = [pbc] * 3
+ if return_fcoords and lattice is None:
+ raise ValueError("Lattice needs to be supplied to compute fractional coordinates")
+ center_coords_min = np.min(center_coords, axis=0)
+ center_coords_max = np.max(center_coords, axis=0)
+ # The lower bound of all considered atom coords
+ global_min = center_coords_min - r - numerical_tol
+ global_max = center_coords_max + r + numerical_tol
+
+ if any(pbc):
+ if lattice is None:
+ raise ValueError("Lattice needs to be supplied when considering periodic boundary")
+ recp_len = np.array(lattice.reciprocal_lattice.abc)
+ maxr = np.ceil((r + 0.15) * recp_len / (2 * math.pi))
+ frac_coords = lattice.get_fractional_coords(center_coords)
+ nmin_temp = np.floor(np.min(frac_coords, axis=0)) - maxr
+ nmax_temp = np.ceil(np.max(frac_coords, axis=0)) + maxr
+ nmin = np.zeros_like(nmin_temp)
+ nmin[pbc] = nmin_temp[pbc]
+ nmax = np.ones_like(nmax_temp)
+ nmax[pbc] = nmax_temp[pbc]
+ all_ranges = [np.arange(x, y, dtype='int64') for x, y in zip(nmin, nmax)]
+ matrix = lattice.matrix
+
+ all_fcoords = np.mod(lattice.get_fractional_coords(all_coords), 1)
+ coords_in_cell = np.dot(all_fcoords, matrix)
+
+ # Filter out those beyond max range
+ valid_coords = []
+ valid_images = []
+ valid_indices = []
+ for image in itertools.product(*all_ranges):
+ coords = np.dot(image, matrix) + coords_in_cell
+ valid_index_bool = np.all(np.bitwise_and(coords > global_min[None, :], coords < global_max[None, :]),
+ axis=1)
+ ind = np.arange(len(all_coords))
+ if np.any(valid_index_bool):
+ valid_coords.append(coords[valid_index_bool])
+ valid_images.append(np.tile(image, [np.sum(valid_index_bool), 1]))
+ valid_indices.extend([k for k in ind if valid_index_bool[k]])
+ if len(valid_coords) < 1:
+ return [[]] * len(center_coords)
+ valid_coords = np.concatenate(valid_coords, axis=0)
+ valid_images = np.concatenate(valid_images, axis=0)
+
+ else:
+ valid_coords = all_coords
+ valid_images = [[0, 0, 0]] * len(valid_coords)
+ valid_indices = np.arange(len(valid_coords))
+
+ # Divide the valid 3D space into cubes and compute the cube ids
+ all_cube_index = _compute_cube_index(valid_coords, global_min, r)
+ nx, ny, nz = _compute_cube_index(global_max, global_min, r) + 1
+ all_cube_index = _three_to_one(all_cube_index, ny, nz)
+ site_cube_index = _three_to_one(_compute_cube_index(center_coords, global_min, r), ny, nz)
+ # create cube index to coordinates, images, and indices map
+ cube_to_coords = collections.defaultdict(list) # type: Dict[int, List]
+ cube_to_images = collections.defaultdict(list) # type: Dict[int, List]
+ cube_to_indices = collections.defaultdict(list) # type: Dict[int, List]
+ for i, j, k, l in zip(all_cube_index.ravel(), valid_coords,
+ valid_images, valid_indices):
+ cube_to_coords[i].append(j)
+ cube_to_images[i].append(k)
+ cube_to_indices[i].append(l)
+
+ # find all neighboring cubes for each atom in the lattice cell
+ site_neighbors = find_neighbors(site_cube_index, nx, ny, nz)
+ neighbors = [] # type: List[List[Tuple[np.ndarray, float, int, np.ndarray]]]
+
+ for i, j in zip(center_coords, site_neighbors):
+ l1 = np.array(_three_to_one(j, ny, nz), dtype=int).ravel()
+ # use the cube index map to find the all the neighboring
+ # coords, images, and indices
+ ks = [k for k in l1 if k in cube_to_coords]
+ if not ks:
+ neighbors.append([])
+ continue
+ nn_coords = np.concatenate([cube_to_coords[k] for k in ks], axis=0)
+ nn_images = itertools.chain(*[cube_to_images[k] for k in ks])
+ nn_indices = itertools.chain(*[cube_to_indices[k] for k in ks])
+ dist = np.linalg.norm(nn_coords - i[None, :], axis=1)
+ nns: List[Tuple[np.ndarray, float, int, np.ndarray]] = []
+ for coord, index, image, d in zip(nn_coords, nn_indices, nn_images, dist):
+ # filtering out all sites that are beyond the cutoff
+ # Here there is no filtering of overlapping sites
+ if d < r + numerical_tol:
+ if return_fcoords and (lattice is not None):
+ coord = np.round(lattice.get_fractional_coords(coord), 10)
+ nn = (coord, float(d), int(index), image)
+ nns.append(nn)
+ neighbors.append(nns)
+ return neighbors
+
+
+# The following internal methods are used in the get_points_in_sphere method.
+def _compute_cube_index(coords: np.ndarray, global_min: float, radius: float
+ ) -> np.ndarray:
+ """
+ Compute the cube index from coordinates
+ Args:
+ coords: (nx3 array) atom coordinates
+ global_min: (float) lower boundary of coordinates
+ radius: (float) cutoff radius
+
+ Returns: (nx3 array) int indices
+
+ """
+ return np.array(np.floor((coords - global_min) / radius), dtype=int)
+
+
+def _one_to_three(label1d: np.ndarray, ny: int, nz: int) -> np.ndarray:
+ """
+ Convert a 1D index array to 3D index array
+
+ Args:
+ label1d: (array) 1D index array
+ ny: (int) number of cells in y direction
+ nz: (int) number of cells in z direction
+
+ Returns: (nx3) int array of index
+
+ """
+ last = np.mod(label1d, nz)
+ second = np.mod((label1d - last) / nz, ny)
+ first = (label1d - last - second * nz) / (ny * nz)
+ return np.concatenate([first, second, last], axis=1)
+
+
+def _three_to_one(label3d: np.ndarray, ny: int, nz: int) -> np.ndarray:
+ """
+ The reverse of _one_to_three
+ """
+ return np.array(label3d[:, 0] * ny * nz +
+ label3d[:, 1] * nz + label3d[:, 2]).reshape((-1, 1))
+
+
+[docs]def find_neighbors(label: np.ndarray, nx: int, ny: int, nz: int
+ ) -> List[np.ndarray]:
+ """
+ Given a cube index, find the neighbor cube indices
+
+ Args:
+ label: (array) (n,) or (n x 3) indice array
+ nx: (int) number of cells in y direction
+ ny: (int) number of cells in y direction
+ nz: (int) number of cells in z direction
+
+ Returns: neighbor cell indices
+
+ """
+
+ array = [[-1, 0, 1]] * 3
+ neighbor_vectors = np.array(list(itertools.product(*array)),
+ dtype=int)
+ if np.shape(label)[1] == 1:
+ label3d = _one_to_three(label, ny, nz)
+ else:
+ label3d = label
+ all_labels = label3d[:, None, :] - neighbor_vectors[None, :, :]
+ filtered_labels = []
+ # filter out out-of-bound labels i.e., label < 0
+ for labels in all_labels:
+ ind = (labels[:, 0] < nx) * (labels[:, 1] < ny) * (labels[:, 2] < nz) * np.all(labels > -1e-5, axis=1)
+ filtered_labels.append(labels[ind])
+ return filtered_labels
@@ -1444,7 +1683,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/core/libxcfunc.html b/docs/_modules/pymatgen/core/libxcfunc.html
index 03675f1ad9b..ab56e7beae7 100644
--- a/docs/_modules/pymatgen/core/libxcfunc.html
+++ b/docs/_modules/pymatgen/core/libxcfunc.html
@@ -13,7 +13,6 @@
-
@@ -600,7 +599,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/core/molecular_orbitals.html b/docs/_modules/pymatgen/core/molecular_orbitals.html
index 79273c60fee..c03f5a6bf86 100644
--- a/docs/_modules/pymatgen/core/molecular_orbitals.html
+++ b/docs/_modules/pymatgen/core/molecular_orbitals.html
@@ -13,7 +13,6 @@
-
@@ -158,12 +157,7 @@ Source code for pymatgen.core.molecular_orbitals
except Exception:
lumo = None
- if homo == lumo:
- metal = True
- else:
- metal = False
-
- return {'HOMO': homo, 'LUMO': lumo, 'metal': metal}
+ return {'HOMO': homo, 'LUMO': lumo, 'metal': homo == lumo}
@@ -202,7 +196,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/core/operations.html b/docs/_modules/pymatgen/core/operations.html
index c7f3b7ff01a..980e8be2790 100644
--- a/docs/_modules/pymatgen/core/operations.html
+++ b/docs/_modules/pymatgen/core/operations.html
@@ -13,7 +13,6 @@
-
@@ -53,12 +52,13 @@ Source code for pymatgen.core.operations
This module provides classes that operate on points or vectors in 3D space.
"""
-import numpy as np
import re
from math import sin, cos, pi, sqrt
import string
import warnings
+import numpy as np
+
from pymatgen.electronic_structure.core import Magmom
from pymatgen.util.string import transformation_to_string
@@ -510,7 +510,7 @@ Source code for pymatgen.core.operations
tol (float): Tolerance for determining if matrices are equal.
"""
SymmOp.__init__(self, affine_transformation_matrix, tol=tol)
- if time_reversal != 1 and time_reversal != -1:
+ if time_reversal not in (-1, 1):
raise Exception(
"Time reversal operator not well defined: {0}, {1}".format(time_reversal,
type(time_reversal)))
@@ -674,7 +674,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/core/periodic_table.html b/docs/_modules/pymatgen/core/periodic_table.html
index cf8ee5a82de..a8e900e7f49 100644
--- a/docs/_modules/pymatgen/core/periodic_table.html
+++ b/docs/_modules/pymatgen/core/periodic_table.html
@@ -13,7 +13,6 @@
-
@@ -54,25 +53,20 @@ Source code for pymatgen.core.periodic_table
import re
import json
import warnings
-import numpy as np
from io import open
from pathlib import Path
from enum import Enum
from typing import Optional, Callable
+from itertools import product, \
+ combinations
+from collections import Counter
+
+import numpy as np
+
from pymatgen.core.units import Mass, Length, FloatWithUnit, Unit, \
SUPPORTED_UNIT_NAMES
from pymatgen.util.string import formula_double_format
from monty.json import MSONable
-from itertools import product, combinations
-from collections import Counter
-
-__author__ = "Shyue Ping Ong, Michael Kocher"
-__copyright__ = "Copyright 2011, The Materials Project"
-__version__ = "2.0"
-__maintainer__ = "Shyue Ping Ong"
-__email__ = "shyuep@gmail.com"
-__status__ = "Production"
-__date__ = "Sep 23, 2011"
# Loads element data from json file
with open(str(Path(__file__).absolute().parent / "periodic_table.json"), "rt") as f:
@@ -470,12 +464,11 @@ Source code for pymatgen.core.periodic_table
"""
if "X" in self._data:
return self._data["X"]
- else:
- warnings.warn("No electronegativity for %s. Setting to NaN. "
- "This has no physical meaning, and is mainly done to "
- "avoid errors caused by the code expecting a float."
- % self.symbol)
- return float("NaN")
+ warnings.warn("No electronegativity for %s. Setting to NaN. "
+ "This has no physical meaning, and is mainly done to "
+ "avoid errors caused by the code expecting a float."
+ % self.symbol)
+ return float("NaN")
@property
def atomic_radius(self):
@@ -509,7 +502,7 @@ Source code for pymatgen.core.periodic_table
val = self._data.get(kstr, None)
if str(val).startswith("no data"):
val = None
- elif type(val) == dict:
+ elif isinstance(val, dict):
pass
else:
try:
@@ -602,8 +595,7 @@ Source code for pymatgen.core.periodic_table
"""
if "Ionic radii" in self._data:
return {int(k): FloatWithUnit(v, "ang") for k, v in self._data["Ionic radii"].items()}
- else:
- return {}
+ return {}
@property
def number(self):
@@ -777,8 +769,7 @@ Source code for pymatgen.core.periodic_table
L, v_e = self.valence
if v_e <= (2 * L + 1):
return J_sorted_terms[0][0]
- else:
- return J_sorted_terms[-1][0]
+ return J_sorted_terms[-1][0]
def __eq__(self, other):
return isinstance(other, Element) and self.Z == other.Z
@@ -805,10 +796,10 @@ Source code for pymatgen.core.periodic_table
x2 = float("inf") if other.X != other.X else other.X
if x1 != x2:
return x1 < x2
- else:
- # There are cases where the electronegativity are exactly equal.
- # We then sort by symbol.
- return self.symbol < other.symbol
+
+ # There are cases where the electronegativity are exactly equal.
+ # We then sort by symbol.
+ return self.symbol < other.symbol
[docs] @staticmethod
def from_Z(z: int):
@@ -856,11 +847,7 @@ Source code for pymatgen.core.periodic_table
True if symbol is a valid element (e.g., "H"). False otherwise
(e.g., "Zebra").
"""
- try:
- Element(symbol)
- return True
- except Exception:
- return False
+ return symbol in Element.__members__
@property
def row(self):
@@ -871,11 +858,10 @@ Source code for pymatgen.core.periodic_table
total = 0
if 57 <= z <= 71:
return 8
- elif 89 <= z <= 103:
+ if 89 <= z <= 103:
return 9
-
- for i in range(len(_pt_row_sizes)):
- total += _pt_row_sizes[i]
+ for i, size in enumerate(_pt_row_sizes):
+ total += size
if total >= z:
return i + 1
return 8
@@ -893,23 +879,20 @@ Source code for pymatgen.core.periodic_table
if 3 <= z <= 18:
if (z - 2) % 8 == 0:
return 18
- elif (z - 2) % 8 <= 2:
+ if (z - 2) % 8 <= 2:
return (z - 2) % 8
- else:
- return 10 + (z - 2) % 8
+ return 10 + (z - 2) % 8
if 19 <= z <= 54:
if (z - 18) % 18 == 0:
return 18
- else:
- return (z - 18) % 18
+ return (z - 18) % 18
if (z - 54) % 32 == 0:
return 18
- elif (z - 54) % 32 >= 18:
+ if (z - 54) % 32 >= 18:
return (z - 54) % 32 - 14
- else:
- return (z - 54) % 32
+ return (z - 54) % 32
@property
def block(self):
@@ -918,13 +901,13 @@ Source code for pymatgen.core.periodic_table
"""
if (self.is_actinoid or self.is_lanthanoid) and self.Z not in [71, 103]:
return "f"
- elif self.is_actinoid or self.is_lanthanoid:
+ if self.is_actinoid or self.is_lanthanoid:
return "d"
- elif self.group in [1, 2]:
+ if self.group in [1, 2]:
return "s"
- elif self.group in range(13, 19):
+ if self.group in range(13, 19):
return "p"
- elif self.group in range(3, 13):
+ if self.group in range(3, 13):
return "d"
raise ValueError("unable to determine block")
@@ -1173,19 +1156,18 @@ Source code for pymatgen.core.periodic_table
x2 = float("inf") if other.X != other.X else other.X
if x1 != x2:
return x1 < x2
- elif self.symbol != other.symbol:
+ if self.symbol != other.symbol:
# There are cases where the electronegativity are exactly equal.
# We then sort by symbol.
return self.symbol < other.symbol
- elif self.oxi_state:
+ if self.oxi_state:
other_oxi = 0 if (isinstance(other, Element)
or other.oxi_state is None) else other.oxi_state
return self.oxi_state < other_oxi
- elif getattr(self, "spin", False):
+ if getattr(self, "spin", False):
other_spin = getattr(other, "spin", 0)
return self.spin < other_spin
- else:
- return False
+ return False
@property
def element(self):
@@ -1208,7 +1190,7 @@ Source code for pymatgen.core.periodic_table
warnings.warn("No default ionic radius for %s. Using hs data." %
self)
return d["Ionic radii hs"][oxstr]
- elif oxstr in d.get("Ionic radii ls", {}):
+ if oxstr in d.get("Ionic radii ls", {}):
warnings.warn("No default ionic radius for %s. Using ls data." %
self)
return d["Ionic radii ls"][oxstr]
@@ -1247,8 +1229,7 @@ Source code for pymatgen.core.periodic_table
toks = m.group(4).replace(",", "").split("=")
properties = {toks[0]: float(toks[1])}
return Specie(sym, oxi, properties)
- else:
- raise ValueError("Invalid Species String")
+ raise ValueError("Invalid Species String")
def __repr__(self):
return "Specie " + self.__str__()
@@ -1276,18 +1257,18 @@ Source code for pymatgen.core.periodic_table
quad_mom = self._el.nmr_quadrupole_moment
- if len(quad_mom) == 0:
+ if not quad_mom:
return 0.0
if isotope is None:
isotopes = list(quad_mom.keys())
isotopes.sort(key=lambda x: int(x.split("-")[1]), reverse=False)
return quad_mom.get(isotopes[0], 0.0)
- else:
- if isotope not in quad_mom:
- raise ValueError("No quadrupole moment for isotope {}".format(
- isotope))
- return quad_mom.get(isotope, 0.0)
+
+ if isotope not in quad_mom:
+ raise ValueError("No quadrupole moment for isotope {}".format(
+ isotope))
+ return quad_mom.get(isotope, 0.0)
[docs] def get_shannon_radius(self, cn: str, spin: str = "",
radius_type: str = "ionic"):
@@ -1339,8 +1320,7 @@ Source code for pymatgen.core.periodic_table
an invalid oxidation state.
ValueError if invalid coordination or spin_config.
"""
- if coordination not in ("oct", "tet") or \
- spin_config not in ("high", "low"):
+ if coordination not in ("oct", "tet") or spin_config not in ("high", "low"):
raise ValueError("Invalid coordination or spin config.")
elec = self.full_electronic_structure
if len(elec) < 4 or elec[-1][1] != "s" or elec[-2][1] != "d":
@@ -1351,26 +1331,27 @@ Source code for pymatgen.core.periodic_table
raise AttributeError(
"Invalid oxidation state {} for element {}".format(self.oxi_state, self.symbol))
if spin_config == "high":
- return nelectrons if nelectrons <= 5 else 10 - nelectrons
- elif spin_config == "low":
+ if nelectrons <= 5:
+ return nelectrons
+ return 10 - nelectrons
+ if spin_config == "low":
if coordination == "oct":
if nelectrons <= 3:
return nelectrons
- elif nelectrons <= 6:
+ if nelectrons <= 6:
return 6 - nelectrons
- elif nelectrons <= 8:
+ if nelectrons <= 8:
return nelectrons - 6
- else:
- return 10 - nelectrons
- elif coordination == "tet":
+ return 10 - nelectrons
+ if coordination == "tet":
if nelectrons <= 2:
return nelectrons
- elif nelectrons <= 4:
+ if nelectrons <= 4:
return 4 - nelectrons
- elif nelectrons <= 7:
+ if nelectrons <= 7:
return nelectrons - 4
- else:
- return 10 - nelectrons
+ return 10 - nelectrons
+ raise RuntimeError()
def __deepcopy__(self, memo):
return Specie(self.symbol, self.oxi_state, self._properties)
@@ -1467,8 +1448,10 @@ Source code for pymatgen.core.periodic_table
"""
if not isinstance(other, DummySpecie):
return False
- return (isinstance(other, Specie) and self.symbol == other.symbol and self.oxi_state == other.oxi_state
- and self._properties == other._properties)
+ return (isinstance(other, Specie) and
+ self.symbol == other.symbol and
+ self.oxi_state == other.oxi_state and
+ self._properties == other._properties)
def __ne__(self, other):
return not self.__eq__(other)
@@ -1480,13 +1463,12 @@ Source code for pymatgen.core.periodic_table
"""
if self.X != other.X:
return self.X < other.X
- elif self.symbol != other.symbol:
+ if self.symbol != other.symbol:
# There are cases where the electronegativity are exactly equal.
# We then sort by symbol.
return self.symbol < other.symbol
- else:
- other_oxi = 0 if isinstance(other, Element) else other.oxi_state
- return self.oxi_state < other_oxi
+ other_oxi = 0 if isinstance(other, Element) else other.oxi_state
+ return self.oxi_state < other_oxi
@property
def Z(self) -> int:
@@ -1675,7 +1657,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/core/sites.html b/docs/_modules/pymatgen/core/sites.html
index 164d1798f6c..d16bcb3b940 100644
--- a/docs/_modules/pymatgen/core/sites.html
+++ b/docs/_modules/pymatgen/core/sites.html
@@ -13,7 +13,6 @@
-
@@ -56,13 +55,15 @@ Source code for pymatgen.core.sites
import collections
import numpy as np
+from monty.json import MSONable
+from monty.dev import deprecated
+
from pymatgen.core.lattice import Lattice
from pymatgen.core.periodic_table import Element, Specie, DummySpecie, \
get_el_sp
-from monty.json import MSONable
from pymatgen.util.coord import pbc_diff
from pymatgen.core.composition import Composition
-from monty.dev import deprecated
+
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
@@ -206,10 +207,9 @@ Source code for pymatgen.core.sites
"""
if self.is_ordered:
return list(self.species.keys())[0].__str__()
- else:
- sorted_species = sorted(self.species.keys())
- return ", ".join(["{}:{:.3f}".format(sp, self.species[sp])
- for sp in sorted_species])
+ sorted_species = sorted(self.species.keys())
+ return ", ".join(["{}:{:.3f}".format(sp, self.species[sp])
+ for sp in sorted_species])
@property # type: ignore
@deprecated(message="Use site.species instead. This will be deprecated with effect from pymatgen 2020.")
@@ -529,9 +529,9 @@ Source code for pymatgen.core.sites
frac_coords = np.mod(self.frac_coords, 1)
if in_place:
self.frac_coords = frac_coords
- else:
- return PeriodicSite(self.species, frac_coords, self.lattice,
- properties=self.properties)
+ return None
+ return PeriodicSite(self.species, frac_coords, self.lattice,
+ properties=self.properties)
[docs] def is_periodic_image(self, other, tolerance=1e-8, check_lattice=True):
"""
@@ -727,7 +727,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/core/spectrum.html b/docs/_modules/pymatgen/core/spectrum.html
index 76101922b73..a0161d6d3dd 100644
--- a/docs/_modules/pymatgen/core/spectrum.html
+++ b/docs/_modules/pymatgen/core/spectrum.html
@@ -13,7 +13,6 @@
-
@@ -54,10 +53,11 @@ Source code for pymatgen.core.spectrum
x y value pairs.
"""
-from monty.json import MSONable
import numpy as np
from scipy.ndimage.filters import gaussian_filter1d
+from monty.json import MSONable
+
from pymatgen.util.coord import get_linear_interpolated_value
__author__ = "Chen Zheng"
@@ -106,10 +106,9 @@ Source code for pymatgen.core.spectrum
def __getattr__(self, item):
if item == self.XLABEL.lower():
return self.x
- elif item == self.YLABEL.lower():
+ if item == self.YLABEL.lower():
return self.y
- else:
- raise AttributeError("Invalid attribute name %s" % str(item))
+ raise AttributeError("Invalid attribute name %s" % str(item))
def __len__(self):
return self.ydim[0]
@@ -161,9 +160,8 @@ Source code for pymatgen.core.spectrum
"""
if len(self.ydim) == 1:
return get_linear_interpolated_value(self.x, self.y, x)
- else:
- return [get_linear_interpolated_value(self.x, self.y[:, k], x)
- for k in range(self.ydim[1])]
+ return [get_linear_interpolated_value(self.x, self.y[:, k], x)
+ for k in range(self.ydim[1])]
[docs] def copy(self):
"""
@@ -296,7 +294,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/core/structure.html b/docs/_modules/pymatgen/core/structure.html
index ebd150a4eb4..03196f31714 100644
--- a/docs/_modules/pymatgen/core/structure.html
+++ b/docs/_modules/pymatgen/core/structure.html
@@ -13,7 +13,6 @@
-
@@ -67,15 +66,15 @@ Source code for pymatgen.core.structure
import functools
from typing import Dict, List, Tuple, Optional, Union, Iterator, Set, Sequence, Iterable
-from math import gcd
-
import numpy as np
from monty.dev import deprecated
+from monty.io import zopen
+from monty.json import MSONable
+
from pymatgen.core.operations import SymmOp
-from pymatgen.core.lattice import Lattice
+from pymatgen.core.lattice import Lattice, get_points_in_spheres
from pymatgen.core.periodic_table import Element, Specie, get_el_sp, DummySpecie
-from monty.json import MSONable
from pymatgen.core.sites import Site, PeriodicSite
from pymatgen.core.bonds import CovalentBond, get_bond_length
from pymatgen.core.composition import Composition
@@ -83,7 +82,6 @@ Source code for pymatgen.core.structure
lattice_points_in_supercell
from pymatgen.core.units import Mass, Length
-from monty.io import zopen
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2011, The Materials Project"
@@ -113,7 +111,6 @@ Source code for pymatgen.core.structure
"""
Returns a tuple of sites.
"""
- pass
[docs] @abstractmethod
def get_distance(self, i: int, j: int) -> float:
@@ -126,8 +123,7 @@ Source code for pymatgen.core.structure
Returns:
Distance between sites at index i and index j.
- """
- pass
+ """
@property
def distance_matrix(self) -> np.ndarray:
@@ -347,24 +343,21 @@ Source code for pymatgen.core.structure
"""
Generates well-known string representations of SiteCollections (e.g.,
molecules / structures). Should return a string type or write to a file.
- """
- pass
+ """
[docs] @classmethod
@abstractmethod
def from_str(cls, input_string: str, fmt: str):
"""
Reads in SiteCollection from a string.
- """
- pass
+ """
[docs] @classmethod
@abstractmethod
def from_file(cls, filename: str):
"""
Reads in SiteCollection from a filename.
- """
- pass
+ """
[docs] def add_site_property(self, property_name: str, values: List):
"""
@@ -482,7 +475,7 @@ Source code for pymatgen.core.structure
**kwargs: parameters to pass into oxi_state_guesses()
"""
oxid_guess = self.composition.oxi_state_guesses(**kwargs)
- oxid_guess = oxid_guess or [dict([(e.symbol, 0) for e in self.composition])]
+ oxid_guess = oxid_guess or [{e.symbol: 0 for e in self.composition}]
self.add_oxidation_state_by_element(oxid_guess[0])
[docs] def add_spin_by_element(self, spins: Dict[str, float]):
@@ -628,14 +621,14 @@ Source code for pymatgen.core.structure
self._lattice = Lattice(lattice)
sites = []
- for i in range(len(species)):
+ for i, sp in enumerate(species):
prop = None
if site_properties:
prop = {k: v[i]
for k, v in site_properties.items()}
sites.append(
- PeriodicSite(species[i], coords[i], self._lattice,
+ PeriodicSite(sp, coords[i], self._lattice,
to_unit_cell,
coords_are_cartesian=coords_are_cartesian,
properties=prop))
@@ -754,8 +747,7 @@ Source code for pymatgen.core.structure
if not sgp.is_compatible(latt):
raise ValueError(
"Supplied lattice with parameters %s is incompatible with "
- "supplied spacegroup %s!" % (latt.lengths_and_angles,
- sgp.symbol)
+ "supplied spacegroup %s!" % (latt.parameters, sgp.symbol)
)
if len(species) != len(coords):
@@ -764,8 +756,7 @@ Source code for pymatgen.core.structure
"different!" % (len(species), len(coords))
)
- frac_coords = np.array(coords, dtype=np.float) \
- if not coords_are_cartesian else \
+ frac_coords = np.array(coords, dtype=np.float) if not coords_are_cartesian else \
latt.get_fractional_coords(coords)
props = {} if site_properties is None else site_properties
@@ -842,8 +833,8 @@ Source code for pymatgen.core.structure
if 'magmom' not in site_properties:
raise ValueError('Magnetic moments have to be defined.')
- else:
- magmoms = [Magmom(m) for m in site_properties['magmom']]
+
+ magmoms = [Magmom(m) for m in site_properties['magmom']]
if not isinstance(msg, MagneticSpaceGroup):
msg = MagneticSpaceGroup(msg) # type: ignore
@@ -856,8 +847,7 @@ Source code for pymatgen.core.structure
if not msg.is_compatible(latt):
raise ValueError(
"Supplied lattice with parameters %s is incompatible with "
- "supplied spacegroup %s!" % (latt.lengths_and_angles,
- msg.sg_symbol)
+ "supplied spacegroup %s!" % (latt.parameters, msg.sg_symbol)
)
if len(species) != len(coords):
@@ -899,8 +889,7 @@ Source code for pymatgen.core.structure
"""
if self._charge is None:
return super().charge
- else:
- return self._charge
+ return self._charge
@property
def distance_matrix(self):
@@ -970,8 +959,7 @@ Source code for pymatgen.core.structure
m = StructureMatcher(**kwargs)
if not anonymous:
return m.fit(self, other)
- else:
- return m.fit_anonymous(self, other)
+ return m.fit_anonymous(self, other)
def __eq__(self, other):
if other is self:
@@ -1219,82 +1207,25 @@ Source code for pymatgen.core.structure
(site, distance, index, image).
"""
- latt = self.lattice
if sites is None:
sites = self.sites
site_coords = np.array([site.coords for site in sites])
- recp_len = np.array(latt.reciprocal_lattice.abc)
- maxr = np.ceil((r + 0.15) * recp_len / (2 * math.pi))
- frac_coords = latt.get_fractional_coords(site_coords)
- nmin = np.floor(np.min(frac_coords, axis=0)) - maxr
- nmax = np.ceil(np.max(frac_coords, axis=0)) + maxr
- all_ranges = [np.arange(x, y) for x, y in zip(nmin, nmax)]
- matrix = latt.matrix
- all_fcoords = np.mod(self.frac_coords, 1)
- coords_in_cell = np.dot(all_fcoords, matrix)
- coords_min = np.min(site_coords, axis=0)
- coords_max = np.max(site_coords, axis=0)
- # The lower bound of all considered atom coords
- global_min = coords_min - r - numerical_tol
- global_max = coords_max + r + numerical_tol
-
- # Filter out those beyond max range
- valid_coords = []
- valid_images = []
- valid_indices = []
- for image in itertools.product(*all_ranges):
- coords = np.dot(image, matrix) + coords_in_cell
- valid_index_bool = np.all(np.bitwise_and(coords > global_min[None, :], coords < global_max[None, :]),
- axis=1)
- ind = np.arange(len(self))
- if np.any(valid_index_bool):
- valid_coords.append(coords[valid_index_bool])
- valid_images.extend([list(image)] * np.sum(valid_index_bool))
- valid_indices.extend([k for k in ind if valid_index_bool[k]])
- valid_coords = np.concatenate(valid_coords, axis=0)
- # Divide the valid 3D space into cubes and compute the cube ids
- all_cube_index = _compute_cube_index(valid_coords, global_min, r)
- nx, ny, nz = _compute_cube_index(global_max, global_min, r) + 1
- all_cube_index = _three_to_one(all_cube_index, ny, nz)
- site_cube_index = _three_to_one(_compute_cube_index(site_coords, global_min, r), ny, nz)
- # create cube index to coordinates, images, and indices map
- cube_to_coords = collections.defaultdict(list) # type: Dict[int, List]
- cube_to_images = collections.defaultdict(list) # type: Dict[int, List]
- cube_to_indices = collections.defaultdict(list) # type: Dict[int, List]
- for i, j, k, l in zip(all_cube_index.ravel(), valid_coords,
- valid_images, valid_indices):
- cube_to_coords[i].append(j)
- cube_to_images[i].append(k)
- cube_to_indices[i].append(l)
-
- # find all neighboring cubes for each atom in the lattice cell
- site_neighbors = find_neighbors(site_cube_index, nx, ny, nz)
- neighbors = [] # type: List[List[Neighbor]]
- for sp, i, j, site in zip(self.species_and_occu, site_coords, site_neighbors, sites):
- l1 = np.array(_three_to_one(j, ny, nz), dtype=int).ravel()
- # use the cube index map to find the all the neighboring
- # coords, images, and indices
- ks = [k for k in l1 if k in cube_to_coords]
- if not ks:
+ point_neighbors = get_points_in_spheres(self.cart_coords, site_coords, r=r, pbc=True,
+ numerical_tol=numerical_tol, lattice=self.lattice)
+ neighbors: List[List[Neighbor]] = []
+ for point_neighbor, site in zip(point_neighbors, sites):
+ nns: List[Neighbor] = []
+ if len(point_neighbor) < 1:
neighbors.append([])
continue
- nn_coords = np.concatenate([cube_to_coords[k] for k in ks], axis=0)
- nn_images = itertools.chain(*[cube_to_images[k] for k in ks])
- nn_indices = itertools.chain(*[cube_to_indices[k] for k in ks])
- dist = np.linalg.norm(nn_coords - i[None, :], axis=1)
- nns = []
- for coord, index, image, d in zip(nn_coords, nn_indices, nn_images, dist):
- # filtering out all sites that are beyond the cutoff and
- # those that are identical to center site
- if d < r + numerical_tol and (d > numerical_tol or
- self[index] != site):
- nnsite = PeriodicSite(self[index].species, coord, latt,
- properties=self[index].properties,
- coords_are_cartesian=True)
- nn = Neighbor(site=nnsite, distance=d,
- index=index, image=tuple(image))
- nns.append(nn)
-
+ for n in point_neighbor:
+ coord, d, index, image = n
+ if (d > numerical_tol) or (self[index] != site):
+ nn_site = PeriodicSite(self[index].species, coord, self.lattice,
+ properties=self[index].properties,
+ coords_are_cartesian=True)
+ neighbor = Neighbor(site=nn_site, distance=d, index=index, image=tuple(image))
+ nns.append(neighbor)
neighbors.append(nns)
return neighbors
@@ -1438,8 +1369,7 @@ Source code for pymatgen.core.structure
to_unit_cell=True,
site_properties=self.site_properties,
charge=self._charge)
- else:
- return self.copy()
+ return self.copy()
[docs] def copy(self, site_properties=None, sanitize=False):
"""
@@ -1472,20 +1402,19 @@ Source code for pymatgen.core.structure
self.frac_coords,
charge=self._charge,
site_properties=props)
- else:
- reduced_latt = self._lattice.get_lll_reduced_lattice()
- new_sites = []
- for i, site in enumerate(self):
- frac_coords = reduced_latt.get_fractional_coords(site.coords)
- site_props = {}
- for p in props:
- site_props[p] = props[p][i]
- new_sites.append(PeriodicSite(site.species,
- frac_coords, reduced_latt,
- to_unit_cell=True,
- properties=site_props))
- new_sites = sorted(new_sites)
- return self.__class__.from_sites(new_sites, charge=self._charge)
+ reduced_latt = self._lattice.get_lll_reduced_lattice()
+ new_sites = []
+ for i, site in enumerate(self):
+ frac_coords = reduced_latt.get_fractional_coords(site.coords)
+ site_props = {}
+ for p in props:
+ site_props[p] = props[p][i]
+ new_sites.append(PeriodicSite(site.species,
+ frac_coords, reduced_latt,
+ to_unit_cell=True,
+ properties=site_props))
+ new_sites = sorted(new_sites)
+ return self.__class__.from_sites(new_sites, charge=self._charge)
[docs] def interpolate(self, end_structure,
nimages: Union[int, Iterable] = 10,
@@ -1530,8 +1459,8 @@ Source code for pymatgen.core.structure
images = nimages
# Check that both structures have the same species
- for i in range(len(self)):
- if self[i].species != end_structure[i].species:
+ for i, site in enumerate(self):
+ if site.species != end_structure[i].species:
raise ValueError("Different species!\nStructure 1:\n" +
str(self) + "\nStructure 2\n" +
str(end_structure))
@@ -1654,11 +1583,10 @@ Source code for pymatgen.core.structure
def site_label(site):
if not use_site_props:
return site.species_string
- else:
- d = [site.species_string]
- for k in sorted(site.properties.keys()):
- d.append(k + "=" + str(site.properties[k]))
- return ", ".join(d)
+ d = [site.species_string]
+ for k in sorted(site.properties.keys()):
+ d.append(k + "=" + str(site.properties[k]))
+ return ", ".join(d)
# group sites by species string
sites = sorted(self._sites, key=site_label)
@@ -1737,7 +1665,7 @@ Source code for pymatgen.core.structure
np.fill_diagonal(non_nbrs, True)
grouped_non_nbrs.append(non_nbrs)
- num_fu = functools.reduce(gcd, map(len, grouped_sites))
+ num_fu = functools.reduce(math.gcd, map(len, grouped_sites))
for size, ms in get_hnf(num_fu):
inv_ms = np.linalg.inv(ms)
@@ -1994,14 +1922,13 @@ Source code for pymatgen.core.structure
if filename:
with zopen(filename, "wt") as f:
yaml.safe_dump(self.as_dict(), f)
- return
- else:
- return yaml.safe_dump(self.as_dict())
+ return None
+ return yaml.safe_dump(self.as_dict())
if filename:
writer.write_file(filename)
- else:
- return writer.__str__()
+ return None
+ return writer.__str__()
[docs] @classmethod
def from_str(cls, input_string, fmt, primitive=False, sort=False,
@@ -2090,7 +2017,6 @@ Source code for pymatgen.core.structure
from pymatgen.io.lmto import LMTOCtrl
from pymatgen.io.vasp import Vasprun, Chgcar
from pymatgen.io.exciting import ExcitingInput
- from monty.io import zopen
fname = os.path.basename(filename)
with zopen(filename, "rt") as f:
contents = f.read()
@@ -2098,7 +2024,7 @@ Source code for pymatgen.core.structure
return cls.from_str(contents, fmt="cif",
primitive=primitive, sort=sort,
merge_tol=merge_tol)
- elif fnmatch(fname, "*POSCAR*") or fnmatch(fname, "*CONTCAR*") or fnmatch(fname, "*.vasp"):
+ if fnmatch(fname, "*POSCAR*") or fnmatch(fname, "*CONTCAR*") or fnmatch(fname, "*.vasp"):
s = cls.from_str(contents, fmt="poscar",
primitive=primitive, sort=sort,
merge_tol=merge_tol)
@@ -2206,7 +2132,7 @@ Source code for pymatgen.core.structure
for site in sites:
for sp, amt in site.species.items():
if not isinstance(sp, DummySpecie):
- nelectrons += sp.Z * amt
+ nelectrons += sp.Z * amt # type: ignore
nelectrons -= charge
self._nelectrons = nelectrons
if spin_multiplicity:
@@ -2643,8 +2569,7 @@ Source code for pymatgen.core.structure
if filename:
writer.write_file(filename)
- else:
- return str(writer)
+ return str(writer)
[docs] @classmethod
def from_str(cls, input_string, fmt):
@@ -2703,27 +2628,25 @@ Source code for pymatgen.core.structure
fname = filename.lower()
if fnmatch(fname, "*.xyz*"):
return cls.from_str(contents, fmt="xyz")
- elif any([fnmatch(fname.lower(), "*.{}*".format(r))
- for r in ["gjf", "g03", "g09", "com", "inp"]]):
+ if any([fnmatch(fname.lower(), "*.{}*".format(r))
+ for r in ["gjf", "g03", "g09", "com", "inp"]]):
return cls.from_str(contents, fmt="g09")
- elif any([fnmatch(fname.lower(), "*.{}*".format(r))
- for r in ["out", "lis", "log"]]):
+ if any([fnmatch(fname.lower(), "*.{}*".format(r))
+ for r in ["out", "lis", "log"]]):
return GaussianOutput(filename).final_structure
- elif fnmatch(fname, "*.json*") or fnmatch(fname, "*.mson*"):
+ if fnmatch(fname, "*.json*") or fnmatch(fname, "*.mson*"):
return cls.from_str(contents, fmt="json")
- elif fnmatch(fname, "*.yaml*"):
+ if fnmatch(fname, "*.yaml*"):
return cls.from_str(contents, fmt="yaml")
- else:
- from pymatgen.io.babel import BabelMolAdaptor
- m = re.search(r"\.(pdb|mol|mdl|sdf|sd|ml2|sy2|mol2|cml|mrv)",
- filename.lower())
- if m:
- new = BabelMolAdaptor.from_file(filename,
- m.group(1)).pymatgen_mol
- new.__class__ = cls
- return new
-
- raise ValueError("Unrecognized file extension!")
+ from pymatgen.io.babel import BabelMolAdaptor
+ m = re.search(r"\.(pdb|mol|mdl|sdf|sd|ml2|sy2|mol2|cml|mrv)",
+ filename.lower())
+ if m:
+ new = BabelMolAdaptor.from_file(filename,
+ m.group(1)).pymatgen_mol
+ new.__class__ = cls
+ return new
+ raise ValueError("Cannot determine file type.")
[docs]class Structure(IStructure, collections.abc.MutableSequence):
@@ -2838,7 +2761,7 @@ Source code for pymatgen.core.structure
if site.lattice != self._lattice:
raise ValueError("PeriodicSite added must have same lattice "
"as Structure!")
- elif len(indices) != 1:
+ if len(indices) != 1:
raise ValueError("Site assignments makes sense only for "
"single int indices!")
self._sites[ii] = site
@@ -3008,8 +2931,7 @@ Source code for pymatgen.core.structure
if func_grp not in FunctionalGroups:
raise RuntimeError("Can't find functional group in list. "
"Provide explicit coordinate instead")
- else:
- func_grp = FunctionalGroups[func_grp]
+ func_grp = FunctionalGroups[func_grp]
# If a bond length can be found, modify func_grp so that the X-group
# bond length is equal to the bond length.
@@ -3045,9 +2967,8 @@ Source code for pymatgen.core.structure
elif abs(abs(angle) - 180) < 1:
# We have a 180 degree angle. Simply do an inversion about the
# origin
- for i in range(len(func_grp)):
- func_grp[i] = (func_grp[i].species,
- origin - (func_grp[i].coords - origin))
+ for i, fg in enumerate(func_grp):
+ func_grp[i] = (fg.species, origin - (fg.coords - origin))
# Remove the atom to be replaced, and add the rest of the functional
# group.
@@ -3700,8 +3621,7 @@ Source code for pymatgen.core.structure
if func_grp not in FunctionalGroups:
raise RuntimeError("Can't find functional group in list. "
"Provide explicit coordinate instead")
- else:
- func_grp = FunctionalGroups[func_grp]
+ func_grp = FunctionalGroups[func_grp]
# If a bond length can be found, modify func_grp so that the X-group
# bond length is equal to the bond length.
@@ -3732,9 +3652,8 @@ Source code for pymatgen.core.structure
elif abs(abs(angle) - 180) < 1:
# We have a 180 degree angle. Simply do an inversion about the
# origin
- for i in range(len(func_grp)):
- func_grp[i] = (func_grp[i].species,
- origin - (func_grp[i].coords - origin))
+ for i, fg in enumerate(func_grp):
+ func_grp[i] = (fg.species, origin - (fg.coords - origin))
# Remove the atom to be replaced, and add the rest of the functional
# group.
@@ -3743,69 +3662,6 @@ Source code for pymatgen.core.structure
self._sites.append(site)
-# The following internal methods are used in the get_all_neighbors method.
-
-
-def _compute_cube_index(coords, global_min, radius):
- """
- Compute the cube index from coordinates
-
- :param coords: (nx3 array) atom coordinates
- :param global_min: (float) lower boundary of coordinates
- :param radius: (float) cutoff radius
- :return: (nx3 array) int indices
- """
- return np.array(np.floor((coords - global_min) / radius), dtype=int)
-
-
-def _one_to_three(label1d, ny, nz):
- """
- Convert a 1D index array to 3D index array
-
- :param label1d: (array) 1D index array
- :param ny: (int) number of cells in y direction
- :param nz: (int) number of cells in z direction
- :return: (nx3) int array of index
- """
- last = np.mod(label1d, nz)
- second = np.mod((label1d - last) / nz, ny)
- first = (label1d - last - second * nz) / (ny * nz)
- return np.concatenate([first, second, last], axis=1)
-
-
-def _three_to_one(label3d, ny, nz):
- """
- The reverse of one_to_three
- """
- return np.array(label3d[:, 0] * ny * nz +
- label3d[:, 1] * nz + label3d[:, 2]).reshape((-1, 1))
-
-
-[docs]def find_neighbors(label, nx, ny, nz):
- """
- Given a cube index, find the neighbor cube indices
- :param label: (array) (n,) or (n x 3) indice array
- :param nx: (int) number of cells in y direction
- :param ny: (int) number of cells in y direction
- :param nz: (int) number of cells in z direction
- :return: neighbor cell indices
- """
- array = [[-1, 0, 1]] * 3
- neighbor_vectors = np.array(list(itertools.product(*array)),
- dtype=int)
- if np.shape(label)[1] == 1:
- label3d = _one_to_three(label, ny, nz)
- else:
- label3d = label
- all_labels = label3d[:, None, :] - neighbor_vectors[None, :, :]
- filtered_labels = []
- # filter out out-of-bound labels i.e., label < 0
- for labels in all_labels:
- ind = (labels[:, 0] < nx) * (labels[:, 1] < ny) * (labels[:, 2] < nz) * np.all(labels > -1e-5, axis=1)
- filtered_labels.append(labels[ind])
- return filtered_labels
-
-
[docs]class StructureError(Exception):
"""
Exception class for Structure.
@@ -3856,7 +3712,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/core/surface.html b/docs/_modules/pymatgen/core/surface.html
index 7c6737ac5a1..d31743bd0f1 100644
--- a/docs/_modules/pymatgen/core/surface.html
+++ b/docs/_modules/pymatgen/core/surface.html
@@ -13,7 +13,6 @@
-
@@ -571,7 +570,7 @@ Source code for pymatgen.core.surface
surf_sites_dict, properties = {"top": [], "bottom": []}, []
for i, site in enumerate(self):
# Determine if site is closer to the top or bottom of the slab
- top = True if site.frac_coords[2] > self.center_of_mass[2] else False
+ top = site.frac_coords[2] > self.center_of_mass[2]
try:
# A site is a surface site, if its environment does
@@ -2032,7 +2031,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/core/tensors.html b/docs/_modules/pymatgen/core/tensors.html
index ffb1a764953..5bd8860515a 100644
--- a/docs/_modules/pymatgen/core/tensors.html
+++ b/docs/_modules/pymatgen/core/tensors.html
@@ -13,7 +13,6 @@
-
@@ -55,13 +54,16 @@ Source code for pymatgen.core.tensors
that provides basic methods for creating and manipulating rank 2 tensors
"""
-from scipy.linalg import polar
-import numpy as np
import itertools
import warnings
import collections
import string
import os
+
+import numpy as np
+
+from scipy.linalg import polar
+
from monty.json import MSONable
from monty.serialization import loadfn
@@ -144,8 +146,7 @@ Source code for pymatgen.core.tensors
if len(obj.shape) == 0:
return obj[()]
- else:
- return np.ndarray.__array_wrap__(self, obj)
+ return np.ndarray.__array_wrap__(self, obj)
def __hash__(self):
"""
@@ -703,7 +704,7 @@ Source code for pymatgen.core.tensors
# in the guess in the guess
merge(guess, rot)
if verbose:
- print("Preconditioning for voigt symmetry".format(len(sops)))
+ print("Preconditioning for voigt symmetry")
if vsym:
v = guess.voigt
perms = list(itertools.permutations(range(len(v.shape))))
@@ -762,8 +763,7 @@ Source code for pymatgen.core.tensors
voigt = d.get('voigt')
if voigt:
return cls.from_voigt(d["input_array"])
- else:
- return cls(d["input_array"])
+ return cls(d["input_array"])
[docs]class TensorCollection(collections.abc.Sequence, MSONable):
@@ -935,8 +935,7 @@ Source code for pymatgen.core.tensors
voigt = d.get('voigt')
if voigt:
return cls.from_voigt(d["tensor_list"])
- else:
- return cls(d["tensor_list"])
+ return cls(d["tensor_list"])
[docs]class SquareTensor(Tensor):
@@ -1173,7 +1172,7 @@ Source code for pymatgen.core.tensors
indices = np.where(mask)[0]
if len(indices) > 1:
raise ValueError("Tensor key collision.")
- elif len(indices) == 0:
+ if len(indices) == 0:
return None
return indices[0]
@@ -1214,7 +1213,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/core/trajectory.html b/docs/_modules/pymatgen/core/trajectory.html
index c1ff9158997..350f9452dc6 100644
--- a/docs/_modules/pymatgen/core/trajectory.html
+++ b/docs/_modules/pymatgen/core/trajectory.html
@@ -13,7 +13,6 @@
-
@@ -57,13 +56,14 @@ Source code for pymatgen.core.trajectory
import os
import warnings
from fnmatch import fnmatch
+from typing import List, Union, Sequence
import numpy as np
from monty.io import zopen
from monty.json import MSONable
from pymatgen.core.structure import Structure, Lattice, Element, Specie, DummySpecie, Composition
from pymatgen.io.vasp.outputs import Xdatcar, Vasprun
-from typing import List, Union, Sequence
+
__author__ = "Eric Sivonxay, Shyam Dwaraknath"
__version__ = "0.0"
@@ -164,8 +164,7 @@ Source code for pymatgen.core.trajectory
cumulative_displacements = np.cumsum(self.frac_coords, axis=0)
positions = self.base_positions + cumulative_displacements
self.frac_coords = positions
- self.coords_are_displacement = False
- return
+ self.coords_are_displacement = False
[docs] def to_displacements(self):
"""
@@ -178,8 +177,7 @@ Source code for pymatgen.core.trajectory
displacements = [np.subtract(item, np.round(item)) for item in displacements]
self.frac_coords = displacements
- self.coords_are_displacement = True
- return
+ self.coords_are_displacement = True
[docs] def extend(self, trajectory):
"""
@@ -231,74 +229,71 @@ Source code for pymatgen.core.trajectory
raise ValueError('Selected frame exceeds trajectory length')
# For integer input, return the displacements at that timestep
return self.frac_coords[frames]
- elif isinstance(frames, slice):
+ if isinstance(frames, slice):
# For slice input, return a list of the displacements
start, stop, step = frames.indices(len(self))
return [self.frac_coords[i] for i in range(start, stop, step)]
- elif isinstance(frames, list) or isinstance(frames, np.ndarray):
+ if isinstance(frames, (list, np.ndarray)):
# For list input, return a list of the displacements
pruned_frames = [i for i in frames if i < len(self)] # Get rid of frames that exceed trajectory length
if len(pruned_frames) < len(frames):
warnings.warn('Some or all selected frames exceed trajectory length')
return [self.frac_coords[i] for i in pruned_frames]
- else:
- raise Exception('Given accessor is not of type int, slice, list, or array')
+ raise Exception('Given accessor is not of type int, slice, list, or array')
# If trajectory is in positions mode, return a structure for the given frame or trajectory for the given frames
- elif not self.coords_are_displacement:
- if isinstance(frames, int):
- if frames >= np.shape(self.frac_coords)[0]:
- raise ValueError('Selected frame exceeds trajectory length')
- # For integer input, return the structure at that timestep
- lattice = self.lattice if self.constant_lattice else self.lattice[frames]
- site_properties = self.site_properties[frames] if self.site_properties else None
- site_properties = self.site_properties[frames] if self.site_properties else None
- return Structure(Lattice(lattice), self.species, self.frac_coords[frames],
- site_properties=site_properties,
- to_unit_cell=True)
- elif isinstance(frames, slice):
- # For slice input, return a trajectory of the sliced time
- start, stop, step = frames.indices(len(self))
- pruned_frames = range(start, stop, step)
- lattice = self.lattice if self.constant_lattice else [self.lattice[i] for i in pruned_frames]
- frac_coords = [self.frac_coords[i] for i in pruned_frames]
- if self.site_properties is not None:
- site_properties = [self.site_properties[i] for i in pruned_frames]
- else:
- site_properties = None
- if self.frame_properties is not None:
- frame_properties = {}
- for key, item in self.frame_properties.items():
- frame_properties[key] = [item[i] for i in pruned_frames]
- else:
- frame_properties = None
- return Trajectory(lattice, self.species, frac_coords, time_step=self.time_step,
- site_properties=site_properties, frame_properties=frame_properties,
- constant_lattice=self.constant_lattice, coords_are_displacement=False,
- base_positions=self.base_positions)
- elif isinstance(frames, list) or isinstance(frames, np.ndarray):
- # For list input, return a trajectory of the specified times
- pruned_frames = [i for i in frames if i < len(self)] # Get rid of frames that exceed trajectory length
- if len(pruned_frames) < len(frames):
- warnings.warn('Some or all selected frames exceed trajectory length')
- lattice = self.lattice if self.constant_lattice else [self.lattice[i] for i in pruned_frames]
- frac_coords = [self.frac_coords[i] for i in pruned_frames]
- if self.site_properties is not None:
- site_properties = [self.site_properties[i] for i in pruned_frames]
- else:
- site_properties = None
- if self.frame_properties is not None:
- frame_properties = {}
- for key, item in self.frame_properties.items():
- frame_properties[key] = [item[i] for i in pruned_frames]
- else:
- frame_properties = None
- return Trajectory(lattice, self.species, frac_coords, time_step=self.time_step,
- site_properties=site_properties, frame_properties=frame_properties,
- constant_lattice=self.constant_lattice, coords_are_displacement=False,
- base_positions=self.base_positions)
+ if isinstance(frames, int):
+ if frames >= np.shape(self.frac_coords)[0]:
+ raise ValueError('Selected frame exceeds trajectory length')
+ # For integer input, return the structure at that timestep
+ lattice = self.lattice if self.constant_lattice else self.lattice[frames]
+ site_properties = self.site_properties[frames] if self.site_properties else None
+ site_properties = self.site_properties[frames] if self.site_properties else None
+ return Structure(Lattice(lattice), self.species, self.frac_coords[frames],
+ site_properties=site_properties,
+ to_unit_cell=True)
+ if isinstance(frames, slice):
+ # For slice input, return a trajectory of the sliced time
+ start, stop, step = frames.indices(len(self))
+ pruned_frames = range(start, stop, step)
+ lattice = self.lattice if self.constant_lattice else [self.lattice[i] for i in pruned_frames]
+ frac_coords = [self.frac_coords[i] for i in pruned_frames]
+ if self.site_properties is not None:
+ site_properties = [self.site_properties[i] for i in pruned_frames]
else:
- raise Exception('Given accessor is not of type int, slice, tuple, list, or array')
+ site_properties = None
+ if self.frame_properties is not None:
+ frame_properties = {}
+ for key, item in self.frame_properties.items():
+ frame_properties[key] = [item[i] for i in pruned_frames]
+ else:
+ frame_properties = None
+ return Trajectory(lattice, self.species, frac_coords, time_step=self.time_step,
+ site_properties=site_properties, frame_properties=frame_properties,
+ constant_lattice=self.constant_lattice, coords_are_displacement=False,
+ base_positions=self.base_positions)
+ if isinstance(frames, (list, np.ndarray)):
+ # For list input, return a trajectory of the specified times
+ pruned_frames = [i for i in frames if i < len(self)] # Get rid of frames that exceed trajectory length
+ if len(pruned_frames) < len(frames):
+ warnings.warn('Some or all selected frames exceed trajectory length')
+ lattice = self.lattice if self.constant_lattice else [self.lattice[i] for i in pruned_frames]
+ frac_coords = [self.frac_coords[i] for i in pruned_frames]
+ if self.site_properties is not None:
+ site_properties = [self.site_properties[i] for i in pruned_frames]
+ else:
+ site_properties = None
+ if self.frame_properties is not None:
+ frame_properties = {}
+ for key, item in self.frame_properties.items():
+ frame_properties[key] = [item[i] for i in pruned_frames]
+ else:
+ frame_properties = None
+ return Trajectory(lattice, self.species, frac_coords, time_step=self.time_step,
+ site_properties=site_properties, frame_properties=frame_properties,
+ constant_lattice=self.constant_lattice, coords_are_displacement=False,
+ base_positions=self.base_positions)
+ raise Exception('Given accessor is not of type int, slice, tuple, list, or array')
[docs] def copy(self):
"""
@@ -385,8 +380,8 @@ Source code for pymatgen.core.trajectory
attribute = np.concatenate((attr_1, attr_2), axis=0)
attribute_constant = False
else:
- attribute = [attr_1.copy()] * len_1 if type(attr_1) != list else attr_1.copy()
- attribute.extend([attr_2.copy()] * len_2 if type(attr_2 != list) else attr_2.copy())
+ attribute = [attr_1.copy()] * len_1 if isinstance(attr_1, list) else attr_1.copy()
+ attribute.extend([attr_2.copy()] * len_2 if isinstance(attr_2, list) else attr_2.copy())
attribute_constant = False
return attribute, attribute_constant
@@ -397,7 +392,7 @@ Source code for pymatgen.core.trajectory
"""
if attr_1 is None and attr_2 is None:
return None
- elif attr_1 is None or attr_2 is None:
+ if attr_1 is None or attr_2 is None:
new_site_properties = []
if attr_1 is None:
new_site_properties.extend([None for i in range(len_1)])
@@ -414,35 +409,34 @@ Source code for pymatgen.core.trajectory
new_site_properties.extend(attr_2)
return new_site_properties
- elif len(attr_1) == 1 and len(attr_2) == 1:
+ if len(attr_1) == 1 and len(attr_2) == 1:
# If both properties lists are do not change within their respective trajectory
if attr_1 == attr_2:
# If both site_properties are the same, only store one
return attr_1
- else:
- new_site_properties = [attr_1[0] for i in range(len_1)]
- new_site_properties.extend([attr_2[0] for i in range(len_2)])
- return new_site_properties
- elif len(attr_1) > 1 and len(attr_2) > 1:
+ new_site_properties = [attr_1[0] for i in range(len_1)]
+ new_site_properties.extend([attr_2[0] for i in range(len_2)])
+ return new_site_properties
+ if len(attr_1) > 1 and len(attr_2) > 1:
# Both properties have site properties that change within the trajectory, concat both together
return [*attr_1, *attr_2]
- else:
- new_site_properties = []
- if attr_1 is None:
- new_site_properties.extend([None for i in range(len_1)])
- elif len(attr_1) == 1:
- new_site_properties.extend([attr_1[0] for i in range(len_1)])
- elif len(attr_1) > 1:
- new_site_properties.extend(attr_1)
- if attr_2 is None:
- new_site_properties.extend([None for i in range(len_2)])
- elif len(attr_2) == 1:
- new_site_properties.extend([attr_2[0] for i in range(len_2)])
- elif len(attr_2) > 1:
- new_site_properties.extend(attr_2)
+ new_site_properties = []
+ if attr_1 is None:
+ new_site_properties.extend([None for i in range(len_1)])
+ elif len(attr_1) == 1:
+ new_site_properties.extend([attr_1[0] for i in range(len_1)])
+ elif len(attr_1) > 1:
+ new_site_properties.extend(attr_1)
- return new_site_properties
+ if attr_2 is None:
+ new_site_properties.extend([None for i in range(len_2)])
+ elif len(attr_2) == 1:
+ new_site_properties.extend([attr_2[0] for i in range(len_2)])
+ elif len(attr_2) > 1:
+ new_site_properties.extend(attr_2)
+
+ return new_site_properties
@staticmethod
def _combine_frame_props(attr_1, attr_2, len_1, len_2):
@@ -562,7 +556,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/core/units.html b/docs/_modules/pymatgen/core/units.html
index 9daafa11f11..444e685488f 100644
--- a/docs/_modules/pymatgen/core/units.html
+++ b/docs/_modules/pymatgen/core/units.html
@@ -13,7 +13,6 @@
-
@@ -57,12 +56,13 @@ Source code for pymatgen.core.units
units are detected. An ArrayWithUnit is also implemented, which is a subclass
of numpy's ndarray with similar unit features.
"""
-import numpy as np
+
import collections
-from numbers import Number
import numbers
from functools import partial
+import numpy as np
+
import scipy.constants as const
__author__ = "Shyue Ping Ong, Matteo Giantomassi"
@@ -320,7 +320,7 @@ Source code for pymatgen.core.units
for d in DERIVED_UNITS.values():
if k in d:
for k2, v2 in d[k].items():
- if isinstance(k2, Number):
+ if isinstance(k2, numbers.Number):
factor *= k2 ** (v2 * v)
else:
b[k2] += v2 * v
@@ -474,14 +474,6 @@ Source code for pymatgen.core.units
return FloatWithUnit(float(self) ** i, unit_type=None,
unit=self._unit ** i)
- def __div__(self, other):
- val = super().__div__(other)
- if not isinstance(other, FloatWithUnit):
- return FloatWithUnit(val, unit_type=self._unit_type,
- unit=self._unit)
- return FloatWithUnit(val, unit_type=None,
- unit=self._unit / other._unit)
-
def __truediv__(self, other):
val = super().__truediv__(other)
if not isinstance(other, FloatWithUnit):
@@ -687,39 +679,35 @@ Source code for pymatgen.core.units
if not hasattr(other, "unit_type"):
return self.__class__(np.array(self).__mul__(np.array(other)),
unit_type=self._unit_type, unit=self._unit)
- else:
- # Cannot use super since it returns an instance of self.__class__
- # while here we want a bare numpy array.
- return self.__class__(
- np.array(self).__mul__(np.array(other)),
- unit=self.unit * other.unit)
+ # Cannot use super since it returns an instance of self.__class__
+ # while here we want a bare numpy array.
+ return self.__class__(
+ np.array(self).__mul__(np.array(other)),
+ unit=self.unit * other.unit)
def __rmul__(self, other):
if not hasattr(other, "unit_type"):
return self.__class__(np.array(self).__rmul__(np.array(other)),
unit_type=self._unit_type, unit=self._unit)
- else:
- return self.__class__(
- np.array(self).__rmul__(np.array(other)),
- unit=self.unit * other.unit)
+ return self.__class__(
+ np.array(self).__rmul__(np.array(other)),
+ unit=self.unit * other.unit)
def __div__(self, other):
if not hasattr(other, "unit_type"):
return self.__class__(np.array(self).__div__(np.array(other)),
unit_type=self._unit_type, unit=self._unit)
- else:
- return self.__class__(
- np.array(self).__div__(np.array(other)),
- unit=self.unit / other.unit)
+ return self.__class__(
+ np.array(self).__div__(np.array(other)),
+ unit=self.unit / other.unit)
def __truediv__(self, other):
if not hasattr(other, "unit_type"):
return self.__class__(np.array(self).__truediv__(np.array(other)),
unit_type=self._unit_type, unit=self._unit)
- else:
- return self.__class__(
- np.array(self).__truediv__(np.array(other)),
- unit=self.unit / other.unit)
+ return self.__class__(
+ np.array(self).__truediv__(np.array(other)),
+ unit=self.unit / other.unit)
def __neg__(self):
return self.__class__(np.array(self).__neg__(),
@@ -872,10 +860,9 @@ Source code for pymatgen.core.units
if isinstance(obj, numbers.Number):
return FloatWithUnit(obj, unit=unit, unit_type=unit_type)
- elif isinstance(obj, collections.Mapping):
+ if isinstance(obj, collections.Mapping):
return {k: obj_with_unit(v, unit) for k, v in obj.items()}
- else:
- return ArrayWithUnit(obj, unit=unit, unit_type=unit_type)
+ return ArrayWithUnit(obj, unit=unit, unit_type=unit_type)
[docs]def unitized(unit):
@@ -903,16 +890,16 @@ Source code for pymatgen.core.units
val = f(*args, **kwargs)
unit_type = _UNAME2UTYPE[unit]
- if isinstance(val, FloatWithUnit) or isinstance(val, ArrayWithUnit):
+ if isinstance(val, (FloatWithUnit, ArrayWithUnit)):
return val.to(unit)
- elif isinstance(val, collections.abc.Sequence):
+ if isinstance(val, collections.abc.Sequence):
# TODO: why don't we return a ArrayWithUnit?
# This complicated way is to ensure the sequence type is
# preserved (list or tuple).
return val.__class__([FloatWithUnit(i, unit_type=unit_type,
unit=unit) for i in val])
- elif isinstance(val, collections.abc.Mapping):
+ if isinstance(val, collections.abc.Mapping):
for k, v in val.items():
val[k] = FloatWithUnit(v, unit_type=unit_type, unit=unit)
elif isinstance(val, numbers.Number):
@@ -970,7 +957,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/core/xcfunc.html b/docs/_modules/pymatgen/core/xcfunc.html
index a6556425bc3..58f1a007335 100644
--- a/docs/_modules/pymatgen/core/xcfunc.html
+++ b/docs/_modules/pymatgen/core/xcfunc.html
@@ -13,7 +13,6 @@
-
@@ -178,19 +177,19 @@ Source code for pymatgen.core.xcfunc
return None
if ixc > 0:
return cls(**cls.abinitixc_to_libxc[ixc])
- else:
- # libxc notation employed in Abinit: a six-digit number in the form XXXCCC or CCCXXX
- # ixc = str(ixc)
- # assert len(ixc[1:]) == 6
- # first, last = ixc[1:4], ixc[4:]
- ixc = abs(ixc)
- first = ixc // 1000
- last = ixc - first * 1000
- x, c = LibxcFunc(int(first)), LibxcFunc(int(last))
- if not x.is_x_kind:
- x, c = c, x # Swap
- assert x.is_x_kind and c.is_c_kind
- return cls(x=x, c=c)
+
+ # libxc notation employed in Abinit: a six-digit number in the form XXXCCC or CCCXXX
+ # ixc = str(ixc)
+ # assert len(ixc[1:]) == 6
+ # first, last = ixc[1:4], ixc[4:]
+ ixc = abs(ixc)
+ first = ixc // 1000
+ last = ixc - first * 1000
+ x, c = LibxcFunc(int(first)), LibxcFunc(int(last))
+ if not x.is_x_kind:
+ x, c = c, x # Swap
+ assert x.is_x_kind and c.is_c_kind
+ return cls(x=x, c=c)
[docs] @classmethod
def from_name(cls, name):
@@ -219,15 +218,9 @@ Source code for pymatgen.core.xcfunc
x, c = (s.strip() for s in name.split("+"))
x, c = LibxcFunc[x], LibxcFunc[c]
return cls(x=x, c=c)
- else:
- # if typ is not None: raise ValueError("typ: `%s` but name: `%s`" % (typ, name))
- xc = LibxcFunc[name]
- return cls(xc=xc)
-
- if typ is None:
- raise ValueError("Cannot find name=%s in defined_aliases" % name)
- else:
- raise ValueError("Cannot find type=%s, name=%s in defined_aliases" % (typ, name))
+ # if typ is not None: raise ValueError("typ: `%s` but name: `%s`" % (typ, name))
+ xc = LibxcFunc[name]
+ return cls(xc=xc)
[docs] @classmethod
def from_dict(cls, d):
@@ -365,7 +358,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/electronic_structure/bandstructure.html b/docs/_modules/pymatgen/electronic_structure/bandstructure.html
index d95a11e4ffa..405627c546f 100644
--- a/docs/_modules/pymatgen/electronic_structure/bandstructure.html
+++ b/docs/_modules/pymatgen/electronic_structure/bandstructure.html
@@ -13,7 +13,6 @@
-
@@ -1343,7 +1342,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/electronic_structure/boltztrap.html b/docs/_modules/pymatgen/electronic_structure/boltztrap.html
index d74c00d8025..e5a42faa7d4 100644
--- a/docs/_modules/pymatgen/electronic_structure/boltztrap.html
+++ b/docs/_modules/pymatgen/electronic_structure/boltztrap.html
@@ -13,7 +13,6 @@
-
@@ -2468,7 +2467,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/electronic_structure/boltztrap2.html b/docs/_modules/pymatgen/electronic_structure/boltztrap2.html
index da11630e945..205f40f54af 100644
--- a/docs/_modules/pymatgen/electronic_structure/boltztrap2.html
+++ b/docs/_modules/pymatgen/electronic_structure/boltztrap2.html
@@ -13,7 +13,6 @@
-
@@ -872,7 +871,7 @@ Navigation
© Copyright 2011, Pymatgen Development Team.
- Created using Sphinx 2.1.2.
+ Created using Sphinx 2.2.0.
This page uses
Google Analytics to collect statistics. You can disable it by blocking
diff --git a/docs/_modules/pymatgen/electronic_structure/cohp.html b/docs/_modules/pymatgen/electronic_structure/cohp.html
index 684111b05ee..868576b4596 100644
--- a/docs/_modules/pymatgen/electronic_structure/cohp.html
+++ b/docs/_modules/pymatgen/electronic_structure/cohp.html
@@ -13,7 +13,6 @@
-
@@ -49,12 +48,20 @@ Source code for pymatgen.electronic_structure.cohp
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
+"""
+This module defines classes to represent crystal orbital Hamilton
+populations (COHP) and integrated COHP (ICOHP), but can also be used
+for crystal orbital overlap populations (COOP).
+"""
+
import warnings
-import numpy as np
import re
import sys
+import numpy as np
+
from monty.json import MSONable
+
from pymatgen.electronic_structure.core import Spin, Orbital
from pymatgen.core.sites import PeriodicSite
from pymatgen.core.structure import Structure
@@ -63,12 +70,6 @@ Source code for pymatgen.electronic_structure.cohp
from pymatgen.util.num import round_to_sigfigs
from pymatgen.util.coord import get_linear_interpolated_value
-"""
-This module defines classes to represent crystal orbital Hamilton
-populations (COHP) and integrated COHP (ICOHP), but can also be used
-for crystal orbital overlap populations (COOP).
-"""
-
__author__ = "Marco Esters, Janine George"
__copyright__ = "Copyright 2017, The Materials Project"
__version__ = "0.2"
@@ -80,20 +81,17 @@ Source code for pymatgen.electronic_structure.cohp
[docs]class Cohp(MSONable):
"""
Basic COHP object.
-
- Args/attributes:
- are_coops: Indicates whether this object describes COHPs or COOPs.
-
- efermi: Fermi energy.
-
- energies: A sequence of energies.
-
- cohp ({Spin: np.array}): representing the COHP for each spin.
-
- icohp ({Spin: np.array}): representing the ICOHP for each spin.
"""
def __init__(self, efermi, energies, cohp, are_coops=False, icohp=None):
+ """
+ Args:
+ are_coops: Indicates whether this object describes COHPs or COOPs.
+ efermi: Fermi energy.
+ energies: A sequence of energies.
+ cohp ({Spin: np.array}): representing the COHP for each spin.
+ icohp ({Spin: np.array}): representing the ICOHP for each spin.
+ """
self.are_coops = are_coops
self.efermi = efermi
self.energies = np.array(energies)
@@ -190,15 +188,14 @@ Source code for pymatgen.electronic_structure.cohp
if populations is None:
return None
- elif spin is None:
+ if spin is None:
return populations
- else:
- if isinstance(spin, int):
- spin = Spin(spin)
- elif isinstance(spin, str):
- s = {"up": 1, "down": -1}[spin.lower()]
- spin = Spin(s)
- return {spin: populations[spin]}
+ if isinstance(spin, int):
+ spin = Spin(spin)
+ elif isinstance(spin, str):
+ s = {"up": 1, "down": -1}[spin.lower()]
+ spin = Spin(s)
+ return {spin: populations[spin]}
[docs] def get_icohp(self, spin=None):
"""
@@ -241,13 +238,13 @@ Source code for pymatgen.electronic_structure.cohp
if populations is None:
return None
- elif spin is None:
+ if spin is None:
dict_to_return = {}
- for spin, cohpvalues in populations.items():
+ for sp, cohpvalues in populations.items():
if (max(cohpvalues[0:number_energies_below_efermi])) > limit:
- dict_to_return[spin] = True
+ dict_to_return[sp] = True
else:
- dict_to_return[spin] = False
+ dict_to_return[sp] = False
else:
dict_to_return = {}
if isinstance(spin, int):
@@ -283,26 +280,6 @@ Source code for pymatgen.electronic_structure.cohp
"""
A wrapper class that defines an average COHP, and individual COHPs.
- Args:
- structure: Structure assosciated with this COHP.
-
- avg_cohp: The average cohp as a COHP object.
-
- cohps: A dict of COHP objects for individual bonds of the form
- {label: COHP}
-
- bonds: A dict containing information on the bonds of the form
- {label: {key: val}}. The key-val pair can be any information
- the user wants to put in, but typically contains the sites,
- the bond length, and the number of bonds. If nothing is
- supplied, it will default to an empty dict.
-
- are_coops: indicates whether the Cohp objects are COHPs or COOPs.
- Defauls to False for COHPs.
-
- orb_res_cohp: Orbital-resolved COHPs.
-
-
.. attribute: are_coops
Indicates whether the object is of COOPs or COHPs.
@@ -334,6 +311,21 @@ Source code for pymatgen.electronic_structure.cohp
def __init__(self, structure, avg_cohp, cohp_dict, bonds=None,
are_coops=False, orb_res_cohp=None):
+ """
+ Args:
+ structure: Structure assosciated with this COHP.
+ avg_cohp: The average cohp as a COHP object.
+ cohps: A dict of COHP objects for individual bonds of the form
+ {label: COHP}
+ bonds: A dict containing information on the bonds of the form
+ {label: {key: val}}. The key-val pair can be any information
+ the user wants to put in, but typically contains the sites,
+ the bond length, and the number of bonds. If nothing is
+ supplied, it will default to an empty dict.
+ are_coops: indicates whether the Cohp objects are COHPs or COOPs.
+ Defauls to False for COHPs.
+ orb_res_cohp: Orbital-resolved COHPs.
+ """
super().__init__(avg_cohp.efermi, avg_cohp.energies, avg_cohp.cohp,
are_coops=are_coops, icohp=avg_cohp.icohp)
self.structure = structure
@@ -348,8 +340,7 @@ Source code for pymatgen.electronic_structure.cohp
def