biotite 1.5.0__cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of biotite might be problematic. Click here for more details.
- biotite/__init__.py +18 -0
- biotite/application/__init__.py +69 -0
- biotite/application/application.py +276 -0
- biotite/application/autodock/__init__.py +12 -0
- biotite/application/autodock/app.py +500 -0
- biotite/application/blast/__init__.py +14 -0
- biotite/application/blast/alignment.py +92 -0
- biotite/application/blast/webapp.py +428 -0
- biotite/application/clustalo/__init__.py +12 -0
- biotite/application/clustalo/app.py +223 -0
- biotite/application/dssp/__init__.py +12 -0
- biotite/application/dssp/app.py +216 -0
- biotite/application/localapp.py +342 -0
- biotite/application/mafft/__init__.py +12 -0
- biotite/application/mafft/app.py +116 -0
- biotite/application/msaapp.py +363 -0
- biotite/application/muscle/__init__.py +13 -0
- biotite/application/muscle/app3.py +227 -0
- biotite/application/muscle/app5.py +163 -0
- biotite/application/sra/__init__.py +18 -0
- biotite/application/sra/app.py +447 -0
- biotite/application/tantan/__init__.py +12 -0
- biotite/application/tantan/app.py +199 -0
- biotite/application/util.py +77 -0
- biotite/application/viennarna/__init__.py +18 -0
- biotite/application/viennarna/rnaalifold.py +310 -0
- biotite/application/viennarna/rnafold.py +254 -0
- biotite/application/viennarna/rnaplot.py +208 -0
- biotite/application/viennarna/util.py +77 -0
- biotite/application/webapp.py +76 -0
- biotite/copyable.py +71 -0
- biotite/database/__init__.py +23 -0
- biotite/database/afdb/__init__.py +12 -0
- biotite/database/afdb/download.py +197 -0
- biotite/database/entrez/__init__.py +15 -0
- biotite/database/entrez/check.py +60 -0
- biotite/database/entrez/dbnames.py +101 -0
- biotite/database/entrez/download.py +228 -0
- biotite/database/entrez/key.py +44 -0
- biotite/database/entrez/query.py +263 -0
- biotite/database/error.py +16 -0
- biotite/database/pubchem/__init__.py +21 -0
- biotite/database/pubchem/download.py +258 -0
- biotite/database/pubchem/error.py +30 -0
- biotite/database/pubchem/query.py +819 -0
- biotite/database/pubchem/throttle.py +98 -0
- biotite/database/rcsb/__init__.py +13 -0
- biotite/database/rcsb/download.py +161 -0
- biotite/database/rcsb/query.py +963 -0
- biotite/database/uniprot/__init__.py +13 -0
- biotite/database/uniprot/check.py +40 -0
- biotite/database/uniprot/download.py +126 -0
- biotite/database/uniprot/query.py +292 -0
- biotite/file.py +244 -0
- biotite/interface/__init__.py +19 -0
- biotite/interface/openmm/__init__.py +20 -0
- biotite/interface/openmm/state.py +93 -0
- biotite/interface/openmm/system.py +227 -0
- biotite/interface/pymol/__init__.py +201 -0
- biotite/interface/pymol/cgo.py +346 -0
- biotite/interface/pymol/convert.py +185 -0
- biotite/interface/pymol/display.py +267 -0
- biotite/interface/pymol/object.py +1228 -0
- biotite/interface/pymol/shapes.py +178 -0
- biotite/interface/pymol/startup.py +169 -0
- biotite/interface/rdkit/__init__.py +19 -0
- biotite/interface/rdkit/mol.py +490 -0
- biotite/interface/version.py +94 -0
- biotite/interface/warning.py +19 -0
- biotite/sequence/__init__.py +84 -0
- biotite/sequence/align/__init__.py +199 -0
- biotite/sequence/align/alignment.py +702 -0
- biotite/sequence/align/banded.cpython-314-x86_64-linux-gnu.so +0 -0
- biotite/sequence/align/banded.pyx +652 -0
- biotite/sequence/align/buckets.py +71 -0
- biotite/sequence/align/cigar.py +425 -0
- biotite/sequence/align/kmeralphabet.cpython-314-x86_64-linux-gnu.so +0 -0
- biotite/sequence/align/kmeralphabet.pyx +595 -0
- biotite/sequence/align/kmersimilarity.cpython-314-x86_64-linux-gnu.so +0 -0
- biotite/sequence/align/kmersimilarity.pyx +233 -0
- biotite/sequence/align/kmertable.cpython-314-x86_64-linux-gnu.so +0 -0
- biotite/sequence/align/kmertable.pyx +3411 -0
- biotite/sequence/align/localgapped.cpython-314-x86_64-linux-gnu.so +0 -0
- biotite/sequence/align/localgapped.pyx +892 -0
- biotite/sequence/align/localungapped.cpython-314-x86_64-linux-gnu.so +0 -0
- biotite/sequence/align/localungapped.pyx +279 -0
- biotite/sequence/align/matrix.py +631 -0
- biotite/sequence/align/matrix_data/3Di.mat +24 -0
- biotite/sequence/align/matrix_data/BLOSUM100.mat +31 -0
- biotite/sequence/align/matrix_data/BLOSUM30.mat +31 -0
- biotite/sequence/align/matrix_data/BLOSUM35.mat +31 -0
- biotite/sequence/align/matrix_data/BLOSUM40.mat +31 -0
- biotite/sequence/align/matrix_data/BLOSUM45.mat +31 -0
- biotite/sequence/align/matrix_data/BLOSUM50.mat +31 -0
- biotite/sequence/align/matrix_data/BLOSUM50_13p.mat +25 -0
- biotite/sequence/align/matrix_data/BLOSUM50_14.3.mat +25 -0
- biotite/sequence/align/matrix_data/BLOSUM50_5.0.mat +25 -0
- biotite/sequence/align/matrix_data/BLOSUM55.mat +31 -0
- biotite/sequence/align/matrix_data/BLOSUM60.mat +31 -0
- biotite/sequence/align/matrix_data/BLOSUM62.mat +31 -0
- biotite/sequence/align/matrix_data/BLOSUM62_13p.mat +25 -0
- biotite/sequence/align/matrix_data/BLOSUM62_14.3.mat +25 -0
- biotite/sequence/align/matrix_data/BLOSUM62_5.0.mat +25 -0
- biotite/sequence/align/matrix_data/BLOSUM65.mat +31 -0
- biotite/sequence/align/matrix_data/BLOSUM70.mat +31 -0
- biotite/sequence/align/matrix_data/BLOSUM75.mat +31 -0
- biotite/sequence/align/matrix_data/BLOSUM80.mat +31 -0
- biotite/sequence/align/matrix_data/BLOSUM85.mat +31 -0
- biotite/sequence/align/matrix_data/BLOSUM90.mat +31 -0
- biotite/sequence/align/matrix_data/BLOSUMN.mat +31 -0
- biotite/sequence/align/matrix_data/CorBLOSUM49_5.0.mat +25 -0
- biotite/sequence/align/matrix_data/CorBLOSUM57_13p.mat +25 -0
- biotite/sequence/align/matrix_data/CorBLOSUM57_14.3.mat +25 -0
- biotite/sequence/align/matrix_data/CorBLOSUM61_5.0.mat +25 -0
- biotite/sequence/align/matrix_data/CorBLOSUM66_13p.mat +25 -0
- biotite/sequence/align/matrix_data/CorBLOSUM67_14.3.mat +25 -0
- biotite/sequence/align/matrix_data/DAYHOFF.mat +32 -0
- biotite/sequence/align/matrix_data/GONNET.mat +26 -0
- biotite/sequence/align/matrix_data/IDENTITY.mat +25 -0
- biotite/sequence/align/matrix_data/MATCH.mat +25 -0
- biotite/sequence/align/matrix_data/NUC.mat +25 -0
- biotite/sequence/align/matrix_data/PAM10.mat +34 -0
- biotite/sequence/align/matrix_data/PAM100.mat +34 -0
- biotite/sequence/align/matrix_data/PAM110.mat +34 -0
- biotite/sequence/align/matrix_data/PAM120.mat +34 -0
- biotite/sequence/align/matrix_data/PAM130.mat +34 -0
- biotite/sequence/align/matrix_data/PAM140.mat +34 -0
- biotite/sequence/align/matrix_data/PAM150.mat +34 -0
- biotite/sequence/align/matrix_data/PAM160.mat +34 -0
- biotite/sequence/align/matrix_data/PAM170.mat +34 -0
- biotite/sequence/align/matrix_data/PAM180.mat +34 -0
- biotite/sequence/align/matrix_data/PAM190.mat +34 -0
- biotite/sequence/align/matrix_data/PAM20.mat +34 -0
- biotite/sequence/align/matrix_data/PAM200.mat +34 -0
- biotite/sequence/align/matrix_data/PAM210.mat +34 -0
- biotite/sequence/align/matrix_data/PAM220.mat +34 -0
- biotite/sequence/align/matrix_data/PAM230.mat +34 -0
- biotite/sequence/align/matrix_data/PAM240.mat +34 -0
- biotite/sequence/align/matrix_data/PAM250.mat +34 -0
- biotite/sequence/align/matrix_data/PAM260.mat +34 -0
- biotite/sequence/align/matrix_data/PAM270.mat +34 -0
- biotite/sequence/align/matrix_data/PAM280.mat +34 -0
- biotite/sequence/align/matrix_data/PAM290.mat +34 -0
- biotite/sequence/align/matrix_data/PAM30.mat +34 -0
- biotite/sequence/align/matrix_data/PAM300.mat +34 -0
- biotite/sequence/align/matrix_data/PAM310.mat +34 -0
- biotite/sequence/align/matrix_data/PAM320.mat +34 -0
- biotite/sequence/align/matrix_data/PAM330.mat +34 -0
- biotite/sequence/align/matrix_data/PAM340.mat +34 -0
- biotite/sequence/align/matrix_data/PAM350.mat +34 -0
- biotite/sequence/align/matrix_data/PAM360.mat +34 -0
- biotite/sequence/align/matrix_data/PAM370.mat +34 -0
- biotite/sequence/align/matrix_data/PAM380.mat +34 -0
- biotite/sequence/align/matrix_data/PAM390.mat +34 -0
- biotite/sequence/align/matrix_data/PAM40.mat +34 -0
- biotite/sequence/align/matrix_data/PAM400.mat +34 -0
- biotite/sequence/align/matrix_data/PAM410.mat +34 -0
- biotite/sequence/align/matrix_data/PAM420.mat +34 -0
- biotite/sequence/align/matrix_data/PAM430.mat +34 -0
- biotite/sequence/align/matrix_data/PAM440.mat +34 -0
- biotite/sequence/align/matrix_data/PAM450.mat +34 -0
- biotite/sequence/align/matrix_data/PAM460.mat +34 -0
- biotite/sequence/align/matrix_data/PAM470.mat +34 -0
- biotite/sequence/align/matrix_data/PAM480.mat +34 -0
- biotite/sequence/align/matrix_data/PAM490.mat +34 -0
- biotite/sequence/align/matrix_data/PAM50.mat +34 -0
- biotite/sequence/align/matrix_data/PAM500.mat +34 -0
- biotite/sequence/align/matrix_data/PAM60.mat +34 -0
- biotite/sequence/align/matrix_data/PAM70.mat +34 -0
- biotite/sequence/align/matrix_data/PAM80.mat +34 -0
- biotite/sequence/align/matrix_data/PAM90.mat +34 -0
- biotite/sequence/align/matrix_data/PB.license +21 -0
- biotite/sequence/align/matrix_data/PB.mat +18 -0
- biotite/sequence/align/matrix_data/RBLOSUM52_5.0.mat +25 -0
- biotite/sequence/align/matrix_data/RBLOSUM59_13p.mat +25 -0
- biotite/sequence/align/matrix_data/RBLOSUM59_14.3.mat +25 -0
- biotite/sequence/align/matrix_data/RBLOSUM64_5.0.mat +25 -0
- biotite/sequence/align/matrix_data/RBLOSUM69_13p.mat +25 -0
- biotite/sequence/align/matrix_data/RBLOSUM69_14.3.mat +25 -0
- biotite/sequence/align/multiple.cpython-314-x86_64-linux-gnu.so +0 -0
- biotite/sequence/align/multiple.pyx +619 -0
- biotite/sequence/align/pairwise.cpython-314-x86_64-linux-gnu.so +0 -0
- biotite/sequence/align/pairwise.pyx +585 -0
- biotite/sequence/align/permutation.cpython-314-x86_64-linux-gnu.so +0 -0
- biotite/sequence/align/permutation.pyx +313 -0
- biotite/sequence/align/primes.txt +821 -0
- biotite/sequence/align/selector.cpython-314-x86_64-linux-gnu.so +0 -0
- biotite/sequence/align/selector.pyx +954 -0
- biotite/sequence/align/statistics.py +264 -0
- biotite/sequence/align/tracetable.cpython-314-x86_64-linux-gnu.so +0 -0
- biotite/sequence/align/tracetable.pxd +64 -0
- biotite/sequence/align/tracetable.pyx +370 -0
- biotite/sequence/alphabet.py +555 -0
- biotite/sequence/annotation.py +836 -0
- biotite/sequence/codec.cpython-314-x86_64-linux-gnu.so +0 -0
- biotite/sequence/codec.pyx +155 -0
- biotite/sequence/codon.py +476 -0
- biotite/sequence/codon_tables.txt +202 -0
- biotite/sequence/graphics/__init__.py +33 -0
- biotite/sequence/graphics/alignment.py +1101 -0
- biotite/sequence/graphics/color_schemes/3di_flower.json +48 -0
- biotite/sequence/graphics/color_schemes/autumn.json +51 -0
- biotite/sequence/graphics/color_schemes/blossom.json +51 -0
- biotite/sequence/graphics/color_schemes/clustalx_dna.json +11 -0
- biotite/sequence/graphics/color_schemes/clustalx_protein.json +28 -0
- biotite/sequence/graphics/color_schemes/flower.json +51 -0
- biotite/sequence/graphics/color_schemes/jalview_buried.json +31 -0
- biotite/sequence/graphics/color_schemes/jalview_hydrophobicity.json +31 -0
- biotite/sequence/graphics/color_schemes/jalview_prop_helix.json +31 -0
- biotite/sequence/graphics/color_schemes/jalview_prop_strand.json +31 -0
- biotite/sequence/graphics/color_schemes/jalview_prop_turn.json +31 -0
- biotite/sequence/graphics/color_schemes/jalview_taylor.json +28 -0
- biotite/sequence/graphics/color_schemes/jalview_zappo.json +28 -0
- biotite/sequence/graphics/color_schemes/ocean.json +51 -0
- biotite/sequence/graphics/color_schemes/pb_flower.json +40 -0
- biotite/sequence/graphics/color_schemes/rainbow_dna.json +11 -0
- biotite/sequence/graphics/color_schemes/rainbow_protein.json +30 -0
- biotite/sequence/graphics/color_schemes/spring.json +51 -0
- biotite/sequence/graphics/color_schemes/sunset.json +51 -0
- biotite/sequence/graphics/color_schemes/wither.json +51 -0
- biotite/sequence/graphics/colorschemes.py +170 -0
- biotite/sequence/graphics/dendrogram.py +231 -0
- biotite/sequence/graphics/features.py +544 -0
- biotite/sequence/graphics/logo.py +102 -0
- biotite/sequence/graphics/plasmid.py +712 -0
- biotite/sequence/io/__init__.py +12 -0
- biotite/sequence/io/fasta/__init__.py +22 -0
- biotite/sequence/io/fasta/convert.py +283 -0
- biotite/sequence/io/fasta/file.py +265 -0
- biotite/sequence/io/fastq/__init__.py +19 -0
- biotite/sequence/io/fastq/convert.py +117 -0
- biotite/sequence/io/fastq/file.py +507 -0
- biotite/sequence/io/genbank/__init__.py +17 -0
- biotite/sequence/io/genbank/annotation.py +269 -0
- biotite/sequence/io/genbank/file.py +573 -0
- biotite/sequence/io/genbank/metadata.py +336 -0
- biotite/sequence/io/genbank/sequence.py +173 -0
- biotite/sequence/io/general.py +201 -0
- biotite/sequence/io/gff/__init__.py +26 -0
- biotite/sequence/io/gff/convert.py +128 -0
- biotite/sequence/io/gff/file.py +449 -0
- biotite/sequence/phylo/__init__.py +36 -0
- biotite/sequence/phylo/nj.cpython-314-x86_64-linux-gnu.so +0 -0
- biotite/sequence/phylo/nj.pyx +221 -0
- biotite/sequence/phylo/tree.cpython-314-x86_64-linux-gnu.so +0 -0
- biotite/sequence/phylo/tree.pyx +1169 -0
- biotite/sequence/phylo/upgma.cpython-314-x86_64-linux-gnu.so +0 -0
- biotite/sequence/phylo/upgma.pyx +164 -0
- biotite/sequence/profile.py +561 -0
- biotite/sequence/search.py +117 -0
- biotite/sequence/seqtypes.py +720 -0
- biotite/sequence/sequence.py +373 -0
- biotite/setup_ccd.py +197 -0
- biotite/structure/__init__.py +135 -0
- biotite/structure/alphabet/__init__.py +25 -0
- biotite/structure/alphabet/encoder.py +332 -0
- biotite/structure/alphabet/encoder_weights_3di.kerasify +0 -0
- biotite/structure/alphabet/i3d.py +109 -0
- biotite/structure/alphabet/layers.py +86 -0
- biotite/structure/alphabet/pb.license +21 -0
- biotite/structure/alphabet/pb.py +170 -0
- biotite/structure/alphabet/unkerasify.py +128 -0
- biotite/structure/atoms.py +1562 -0
- biotite/structure/basepairs.py +1403 -0
- biotite/structure/bonds.cpython-314-x86_64-linux-gnu.so +0 -0
- biotite/structure/bonds.pyx +2036 -0
- biotite/structure/box.py +724 -0
- biotite/structure/celllist.cpython-314-x86_64-linux-gnu.so +0 -0
- biotite/structure/celllist.pyx +864 -0
- biotite/structure/chains.py +310 -0
- biotite/structure/charges.cpython-314-x86_64-linux-gnu.so +0 -0
- biotite/structure/charges.pyx +520 -0
- biotite/structure/compare.py +683 -0
- biotite/structure/density.py +109 -0
- biotite/structure/dotbracket.py +213 -0
- biotite/structure/error.py +39 -0
- biotite/structure/filter.py +591 -0
- biotite/structure/geometry.py +817 -0
- biotite/structure/graphics/__init__.py +13 -0
- biotite/structure/graphics/atoms.py +243 -0
- biotite/structure/graphics/rna.py +298 -0
- biotite/structure/hbond.py +425 -0
- biotite/structure/info/__init__.py +24 -0
- biotite/structure/info/atom_masses.json +121 -0
- biotite/structure/info/atoms.py +98 -0
- biotite/structure/info/bonds.py +149 -0
- biotite/structure/info/ccd.py +200 -0
- biotite/structure/info/components.bcif +0 -0
- biotite/structure/info/groups.py +128 -0
- biotite/structure/info/masses.py +121 -0
- biotite/structure/info/misc.py +137 -0
- biotite/structure/info/radii.py +267 -0
- biotite/structure/info/standardize.py +185 -0
- biotite/structure/integrity.py +213 -0
- biotite/structure/io/__init__.py +29 -0
- biotite/structure/io/dcd/__init__.py +13 -0
- biotite/structure/io/dcd/file.py +67 -0
- biotite/structure/io/general.py +243 -0
- biotite/structure/io/gro/__init__.py +14 -0
- biotite/structure/io/gro/file.py +343 -0
- biotite/structure/io/mol/__init__.py +20 -0
- biotite/structure/io/mol/convert.py +112 -0
- biotite/structure/io/mol/ctab.py +420 -0
- biotite/structure/io/mol/header.py +120 -0
- biotite/structure/io/mol/mol.py +149 -0
- biotite/structure/io/mol/sdf.py +940 -0
- biotite/structure/io/netcdf/__init__.py +13 -0
- biotite/structure/io/netcdf/file.py +64 -0
- biotite/structure/io/pdb/__init__.py +20 -0
- biotite/structure/io/pdb/convert.py +389 -0
- biotite/structure/io/pdb/file.py +1380 -0
- biotite/structure/io/pdb/hybrid36.cpython-314-x86_64-linux-gnu.so +0 -0
- biotite/structure/io/pdb/hybrid36.pyx +242 -0
- biotite/structure/io/pdbqt/__init__.py +15 -0
- biotite/structure/io/pdbqt/convert.py +113 -0
- biotite/structure/io/pdbqt/file.py +688 -0
- biotite/structure/io/pdbx/__init__.py +23 -0
- biotite/structure/io/pdbx/bcif.py +674 -0
- biotite/structure/io/pdbx/cif.py +1091 -0
- biotite/structure/io/pdbx/component.py +251 -0
- biotite/structure/io/pdbx/compress.py +362 -0
- biotite/structure/io/pdbx/convert.py +2113 -0
- biotite/structure/io/pdbx/encoding.cpython-314-x86_64-linux-gnu.so +0 -0
- biotite/structure/io/pdbx/encoding.pyx +1078 -0
- biotite/structure/io/trajfile.py +696 -0
- biotite/structure/io/trr/__init__.py +13 -0
- biotite/structure/io/trr/file.py +43 -0
- biotite/structure/io/util.py +38 -0
- biotite/structure/io/xtc/__init__.py +13 -0
- biotite/structure/io/xtc/file.py +43 -0
- biotite/structure/mechanics.py +72 -0
- biotite/structure/molecules.py +337 -0
- biotite/structure/pseudoknots.py +622 -0
- biotite/structure/rdf.py +245 -0
- biotite/structure/repair.py +302 -0
- biotite/structure/residues.py +716 -0
- biotite/structure/rings.py +451 -0
- biotite/structure/sasa.cpython-314-x86_64-linux-gnu.so +0 -0
- biotite/structure/sasa.pyx +322 -0
- biotite/structure/segments.py +328 -0
- biotite/structure/sequence.py +110 -0
- biotite/structure/spacegroups.json +1567 -0
- biotite/structure/spacegroups.license +26 -0
- biotite/structure/sse.py +306 -0
- biotite/structure/superimpose.py +511 -0
- biotite/structure/tm.py +581 -0
- biotite/structure/transform.py +736 -0
- biotite/structure/util.py +160 -0
- biotite/version.py +34 -0
- biotite/visualize.py +375 -0
- biotite-1.5.0.dist-info/METADATA +162 -0
- biotite-1.5.0.dist-info/RECORD +354 -0
- biotite-1.5.0.dist-info/WHEEL +6 -0
- biotite-1.5.0.dist-info/licenses/LICENSE.rst +30 -0
biotite/structure/rdf.py
ADDED
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
# This source code is part of the Biotite package and is distributed
|
|
2
|
+
# under the 3-Clause BSD License. Please see 'LICENSE.rst' for further
|
|
3
|
+
# information.
|
|
4
|
+
|
|
5
|
+
"""
|
|
6
|
+
This module provides functions to calculate the radial distribution function.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
__name__ = "biotite.structure"
|
|
10
|
+
__author__ = "Daniel Bauer, Patrick Kunzmann"
|
|
11
|
+
__all__ = ["rdf"]
|
|
12
|
+
|
|
13
|
+
from numbers import Integral
|
|
14
|
+
import numpy as np
|
|
15
|
+
from biotite.structure.atoms import AtomArray, coord, stack
|
|
16
|
+
from biotite.structure.box import box_volume
|
|
17
|
+
from biotite.structure.celllist import CellList
|
|
18
|
+
from biotite.structure.geometry import displacement
|
|
19
|
+
from biotite.structure.util import vector_dot
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def rdf(
|
|
23
|
+
center, atoms, selection=None, interval=(0, 10), bins=100, box=None, periodic=False
|
|
24
|
+
):
|
|
25
|
+
r"""
|
|
26
|
+
Compute the radial distribution function *g(r)* (RDF) for one or
|
|
27
|
+
multiple given central positions based on a given system of
|
|
28
|
+
particles.
|
|
29
|
+
|
|
30
|
+
Parameters
|
|
31
|
+
----------
|
|
32
|
+
center : Atom or AtomArray or AtomArrayStack or ndarray, dtype=float
|
|
33
|
+
Coordinates or atoms(s) to use as origin(s) for RDF calculation.
|
|
34
|
+
|
|
35
|
+
- If a single :class:`Atom` or a :class:`ndarray` with shape
|
|
36
|
+
*(3,)* is given, the RDF is only calculated for this position.
|
|
37
|
+
- If an :class:`AtomArray` or a :class:`ndarray` with shape
|
|
38
|
+
*(n,3)* is given, the calculated RDF histogram is an average
|
|
39
|
+
over *n* postions.
|
|
40
|
+
- If an :class:`AtomArrayStack` or a :class:`ndarray` with shape
|
|
41
|
+
*(m,n,3)* is given, different centers are used for each model
|
|
42
|
+
*m*.
|
|
43
|
+
The calculated RDF histogram is an average over *m*
|
|
44
|
+
models and *n* positions.
|
|
45
|
+
This requires `atoms` to be an :class:`AtomArrayStack`.
|
|
46
|
+
|
|
47
|
+
atoms : AtomArray or AtomArrayStack
|
|
48
|
+
The distribution is calculated based on these atoms.
|
|
49
|
+
When an an :class:`AtomArrayStack` is provided, the RDF
|
|
50
|
+
histogram is averaged over all models.
|
|
51
|
+
Please not that `atoms` must have an associated box,
|
|
52
|
+
unless `box` is set.
|
|
53
|
+
selection : ndarray, dtype=bool, shape=(n,), optional
|
|
54
|
+
Boolean mask for `atoms` to limit the RDF calculation to
|
|
55
|
+
specific atoms.
|
|
56
|
+
interval : tuple, optional
|
|
57
|
+
The range in which the RDF is calculated.
|
|
58
|
+
bins : int or sequence of scalars or str, optional
|
|
59
|
+
Bins for the RDF.
|
|
60
|
+
|
|
61
|
+
- If `bins` is an `int`, it defines the number of bins for the
|
|
62
|
+
given `interval`.
|
|
63
|
+
- If `bins` is a sequence, it defines the bin edges, ignoring
|
|
64
|
+
the `interval` parameter. The output `bins` has the length
|
|
65
|
+
of this input parameter reduced by one.
|
|
66
|
+
- If `bins` is a string, it defines the function used to
|
|
67
|
+
calculate the bins.
|
|
68
|
+
|
|
69
|
+
See `numpy.histogram()` for further details.
|
|
70
|
+
box : ndarray, shape=(3,3) or shape=(m,3,3), optional
|
|
71
|
+
If this parameter is set, the given box is used instead of the
|
|
72
|
+
`box` attribute of `atoms`.
|
|
73
|
+
Must have shape *(3,3)* if atoms is an :class:`AtomArray` or
|
|
74
|
+
*(m,3,3)* if atoms is an :class:`AtomArrayStack`, respectively.
|
|
75
|
+
periodic : bool, optional
|
|
76
|
+
Defines if periodic boundary conditions are taken into account.
|
|
77
|
+
|
|
78
|
+
Returns
|
|
79
|
+
-------
|
|
80
|
+
bins : ndarray, dtype=float, shape=n
|
|
81
|
+
The centers of the histogram bins.
|
|
82
|
+
The length of the array is given by the `bins` input parameter.
|
|
83
|
+
rdf : ndarry, dtype=float, shape=n
|
|
84
|
+
RDF values for every bin.
|
|
85
|
+
|
|
86
|
+
Notes
|
|
87
|
+
-----
|
|
88
|
+
Since the RDF depends on the average particle density of the system,
|
|
89
|
+
this function strictly requires an box.
|
|
90
|
+
|
|
91
|
+
Examples
|
|
92
|
+
--------
|
|
93
|
+
Calculate the oxygen-oxygen radial distribution function of water.
|
|
94
|
+
The range of the histogram starts at 0.2 Å, in order to
|
|
95
|
+
ignore the counts for the density for each oxygen to itself.
|
|
96
|
+
|
|
97
|
+
>>> from os.path import join
|
|
98
|
+
>>> waterbox = load_structure(join(path_to_structures, "waterbox.gro"))
|
|
99
|
+
>>> oxygens = waterbox[:, waterbox.atom_name == 'OW']
|
|
100
|
+
>>> bins, g_r = rdf(oxygens, oxygens, bins=49, interval=(0.2, 10), periodic=True)
|
|
101
|
+
|
|
102
|
+
Print the RDF depending on the radius. Bins are in Å.
|
|
103
|
+
|
|
104
|
+
>>> for x, y in zip(bins, g_r):
|
|
105
|
+
... print(f"{x:.2f} {y:.2f}")
|
|
106
|
+
0.30 0.00
|
|
107
|
+
0.50 0.00
|
|
108
|
+
0.70 0.04
|
|
109
|
+
0.90 0.02
|
|
110
|
+
1.10 0.03
|
|
111
|
+
1.30 0.06
|
|
112
|
+
1.50 0.03
|
|
113
|
+
1.70 0.04
|
|
114
|
+
1.90 0.04
|
|
115
|
+
2.10 0.04
|
|
116
|
+
2.30 0.04
|
|
117
|
+
2.50 0.16
|
|
118
|
+
2.70 1.99
|
|
119
|
+
2.90 2.22
|
|
120
|
+
3.10 1.34
|
|
121
|
+
3.30 1.04
|
|
122
|
+
3.50 0.97
|
|
123
|
+
3.70 0.94
|
|
124
|
+
3.90 0.97
|
|
125
|
+
4.10 0.94
|
|
126
|
+
4.30 0.98
|
|
127
|
+
4.50 0.97
|
|
128
|
+
4.70 0.96
|
|
129
|
+
4.90 0.99
|
|
130
|
+
5.10 0.99
|
|
131
|
+
5.30 1.02
|
|
132
|
+
5.50 1.02
|
|
133
|
+
5.70 0.99
|
|
134
|
+
5.90 0.98
|
|
135
|
+
6.10 0.98
|
|
136
|
+
6.30 0.99
|
|
137
|
+
6.50 1.02
|
|
138
|
+
6.70 1.02
|
|
139
|
+
6.90 1.00
|
|
140
|
+
7.10 1.01
|
|
141
|
+
7.30 1.01
|
|
142
|
+
7.50 1.00
|
|
143
|
+
7.70 1.01
|
|
144
|
+
7.90 0.99
|
|
145
|
+
8.10 0.99
|
|
146
|
+
8.30 0.99
|
|
147
|
+
8.50 0.99
|
|
148
|
+
8.70 0.99
|
|
149
|
+
8.90 1.00
|
|
150
|
+
9.10 1.01
|
|
151
|
+
9.30 1.01
|
|
152
|
+
9.50 1.00
|
|
153
|
+
9.70 1.00
|
|
154
|
+
9.90 0.99
|
|
155
|
+
|
|
156
|
+
Find the radius for the first solvation shell.
|
|
157
|
+
In this simple case, the density peak is identified by finding
|
|
158
|
+
the maximum of the function.
|
|
159
|
+
|
|
160
|
+
>>> peak_position = np.argmax(g_r)
|
|
161
|
+
>>> print(f"{bins[peak_position]/10:.2f} nm")
|
|
162
|
+
0.29 nm
|
|
163
|
+
"""
|
|
164
|
+
if isinstance(atoms, AtomArray):
|
|
165
|
+
# Reshape always to a stack for easier calculation
|
|
166
|
+
atoms = stack([atoms])
|
|
167
|
+
if selection is not None:
|
|
168
|
+
atoms = atoms[..., selection]
|
|
169
|
+
|
|
170
|
+
atom_coord = atoms.coord
|
|
171
|
+
|
|
172
|
+
if box is None:
|
|
173
|
+
if atoms.box is None:
|
|
174
|
+
raise ValueError("A box must be supplied")
|
|
175
|
+
else:
|
|
176
|
+
box = atoms.box
|
|
177
|
+
elif box.ndim == 2 and atoms.stack_depth() == 1:
|
|
178
|
+
box = box[np.newaxis, :, :]
|
|
179
|
+
|
|
180
|
+
center = coord(center)
|
|
181
|
+
if center.ndim == 1:
|
|
182
|
+
center = center.reshape((1, 1) + center.shape)
|
|
183
|
+
elif center.ndim == 2:
|
|
184
|
+
center = center.reshape((1,) + center.shape)
|
|
185
|
+
|
|
186
|
+
if box.shape[0] != center.shape[0] or box.shape[0] != atom_coord.shape[0]:
|
|
187
|
+
raise ValueError("Center, box, and atoms must have the same model count")
|
|
188
|
+
|
|
189
|
+
# Calculate distance histogram
|
|
190
|
+
edges = _calculate_edges(interval, bins)
|
|
191
|
+
# Make histogram of quared distances to save computation time
|
|
192
|
+
# of sqrt calculation
|
|
193
|
+
sq_edges = edges**2
|
|
194
|
+
threshold_dist = edges[-1]
|
|
195
|
+
cell_size = threshold_dist
|
|
196
|
+
disp = []
|
|
197
|
+
for i in range(atoms.stack_depth()):
|
|
198
|
+
# Use cell list to efficiently preselect atoms that are in range
|
|
199
|
+
# of the desired bin range
|
|
200
|
+
cell_list = CellList(atom_coord[i], cell_size, periodic, box[i])
|
|
201
|
+
# 'cell_radius=1' is used in 'get_atoms_in_cells()'
|
|
202
|
+
# This is enough to find all atoms that are in the given
|
|
203
|
+
# interval (and more), since the size of each cell is as large
|
|
204
|
+
# as the last edge of the bins
|
|
205
|
+
near_atom_mask = cell_list.get_atoms_in_cells(center[i], as_mask=True)
|
|
206
|
+
# Calculate distances of each center to preselected atoms
|
|
207
|
+
# for each center
|
|
208
|
+
for j in range(center.shape[1]):
|
|
209
|
+
dist_box = box[i] if periodic else None
|
|
210
|
+
# Calculate squared distances
|
|
211
|
+
disp.append(
|
|
212
|
+
displacement(
|
|
213
|
+
center[i, j], atom_coord[i, near_atom_mask[j]], box=dist_box
|
|
214
|
+
)
|
|
215
|
+
)
|
|
216
|
+
# Make one array from multiple arrays with different length
|
|
217
|
+
disp = np.concatenate(disp)
|
|
218
|
+
sq_distances = vector_dot(disp, disp)
|
|
219
|
+
hist, _ = np.histogram(sq_distances, bins=sq_edges)
|
|
220
|
+
|
|
221
|
+
# Normalize with average particle density (N/V) in each bin
|
|
222
|
+
bin_volume = (4 / 3 * np.pi * np.power(edges[1:], 3)) - (
|
|
223
|
+
4 / 3 * np.pi * np.power(edges[:-1], 3)
|
|
224
|
+
)
|
|
225
|
+
n_frames = len(atoms)
|
|
226
|
+
volume = box_volume(box).mean()
|
|
227
|
+
density = atoms.array_length() / volume
|
|
228
|
+
g_r = hist / (bin_volume * density * n_frames)
|
|
229
|
+
|
|
230
|
+
# Normalize with number of centers
|
|
231
|
+
g_r /= center.shape[1]
|
|
232
|
+
|
|
233
|
+
bin_centers = (edges[:-1] + edges[1:]) * 0.5
|
|
234
|
+
|
|
235
|
+
return bin_centers, g_r
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
def _calculate_edges(interval, bins):
|
|
239
|
+
if isinstance(bins, Integral):
|
|
240
|
+
if bins < 1:
|
|
241
|
+
raise ValueError("At least one bin is required")
|
|
242
|
+
return np.linspace(*interval, bins + 1)
|
|
243
|
+
else:
|
|
244
|
+
# 'bins' contains edges
|
|
245
|
+
return np.array(bins, dtype=float)
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
# This source code is part of the Biotite package and is distributed
|
|
2
|
+
# under the 3-Clause BSD License. Please see 'LICENSE.rst' for further
|
|
3
|
+
# information.
|
|
4
|
+
|
|
5
|
+
"""
|
|
6
|
+
This module contains functionalities for repairing malformed structures.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
__name__ = "biotite.structure"
|
|
10
|
+
__author__ = "Patrick Kunzmann, Daniel Bauer"
|
|
11
|
+
__all__ = ["create_continuous_res_ids", "infer_elements", "create_atom_names"]
|
|
12
|
+
|
|
13
|
+
import warnings
|
|
14
|
+
from collections import Counter
|
|
15
|
+
import numpy as np
|
|
16
|
+
from biotite.structure.atoms import AtomArray, AtomArrayStack
|
|
17
|
+
from biotite.structure.chains import get_chain_starts
|
|
18
|
+
from biotite.structure.residues import get_residue_starts
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def create_continuous_res_ids(atoms, restart_each_chain=True):
|
|
22
|
+
"""
|
|
23
|
+
Create an array of continuous residue IDs for a given structure.
|
|
24
|
+
|
|
25
|
+
This means that residue IDs are incremented by 1 for each residue.
|
|
26
|
+
|
|
27
|
+
Parameters
|
|
28
|
+
----------
|
|
29
|
+
atoms : AtomArray or AtomArrayStack
|
|
30
|
+
The atoms for which the continuous residue IDs should be created.
|
|
31
|
+
restart_each_chain : bool, optional
|
|
32
|
+
If true, the residue IDs are reset to 1 for each chain.
|
|
33
|
+
|
|
34
|
+
Returns
|
|
35
|
+
-------
|
|
36
|
+
res_ids : ndarray, dtype=int
|
|
37
|
+
The continuous residue IDs.
|
|
38
|
+
|
|
39
|
+
Examples
|
|
40
|
+
--------
|
|
41
|
+
|
|
42
|
+
>>> # Remove a residue to make the residue IDs discontinuous
|
|
43
|
+
>>> atom_array = atom_array[atom_array.res_id != 5]
|
|
44
|
+
>>> res_ids, _ = get_residues(atom_array)
|
|
45
|
+
>>> print(res_ids)
|
|
46
|
+
[ 1 2 3 4 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20]
|
|
47
|
+
>>> atom_array.res_id = create_continuous_res_ids(atom_array)
|
|
48
|
+
>>> res_ids, _ = get_residues(atom_array)
|
|
49
|
+
>>> print(res_ids)
|
|
50
|
+
[ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19]
|
|
51
|
+
"""
|
|
52
|
+
res_ids_diff = np.zeros(atoms.array_length(), dtype=int)
|
|
53
|
+
res_starts = get_residue_starts(atoms)
|
|
54
|
+
res_ids_diff[res_starts] = 1
|
|
55
|
+
res_ids = np.cumsum(res_ids_diff)
|
|
56
|
+
|
|
57
|
+
if restart_each_chain:
|
|
58
|
+
chain_starts = get_chain_starts(atoms)
|
|
59
|
+
for start in chain_starts:
|
|
60
|
+
res_ids[start:] -= res_ids[start] - 1
|
|
61
|
+
|
|
62
|
+
return res_ids
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def infer_elements(atoms):
|
|
66
|
+
"""
|
|
67
|
+
Infer the elements of atoms based on their atom name.
|
|
68
|
+
|
|
69
|
+
Parameters
|
|
70
|
+
----------
|
|
71
|
+
atoms : AtomArray or AtomArrayStack or array-like of str
|
|
72
|
+
The atoms for which the elements should be inferred.
|
|
73
|
+
Alternatively the atom names can be passed directly.
|
|
74
|
+
|
|
75
|
+
Returns
|
|
76
|
+
-------
|
|
77
|
+
elements : ndarray, dtype=str
|
|
78
|
+
The inferred elements.
|
|
79
|
+
|
|
80
|
+
See Also
|
|
81
|
+
--------
|
|
82
|
+
create_atoms_names : The opposite of this function.
|
|
83
|
+
|
|
84
|
+
Examples
|
|
85
|
+
--------
|
|
86
|
+
|
|
87
|
+
>>> print(infer_elements(atom_array)[:10])
|
|
88
|
+
['N' 'C' 'C' 'O' 'C' 'C' 'O' 'N' 'H' 'H']
|
|
89
|
+
>>> print(infer_elements(["CA", "C", "C1", "OD1", "HD21", "1H", "FE"]))
|
|
90
|
+
['C' 'C' 'C' 'O' 'H' 'H' 'FE']
|
|
91
|
+
"""
|
|
92
|
+
if isinstance(atoms, (AtomArray, AtomArrayStack)):
|
|
93
|
+
atom_names = atoms.atom_name
|
|
94
|
+
else:
|
|
95
|
+
atom_names = atoms
|
|
96
|
+
return np.array([_guess_element(name) for name in atom_names])
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def create_atom_names(atoms):
|
|
100
|
+
"""
|
|
101
|
+
Create atom names for a single residue based on elements.
|
|
102
|
+
|
|
103
|
+
The atom names are simply enumerated separately for each element.
|
|
104
|
+
|
|
105
|
+
Parameters
|
|
106
|
+
----------
|
|
107
|
+
atoms : AtomArray or AtomArrayStack or array-like of str
|
|
108
|
+
The atoms for which the atom names should be created.
|
|
109
|
+
Alternatively the elements can be passed directly.
|
|
110
|
+
|
|
111
|
+
Returns
|
|
112
|
+
-------
|
|
113
|
+
atom_names : ndarray, dtype=str
|
|
114
|
+
The atom names.
|
|
115
|
+
|
|
116
|
+
See Also
|
|
117
|
+
--------
|
|
118
|
+
infer_elements : The opposite of this function.
|
|
119
|
+
|
|
120
|
+
Notes
|
|
121
|
+
-----
|
|
122
|
+
The atom names created this way may differ from the ones in the
|
|
123
|
+
original source, as different schemes for atom naming exist.
|
|
124
|
+
This function only ensures that the created atom names are unique.
|
|
125
|
+
This is e.g. necessary for writing bonds to PDBx files.
|
|
126
|
+
|
|
127
|
+
Note that this function should be used only on single residues,
|
|
128
|
+
otherwise enumeration would continue in the next residue.
|
|
129
|
+
|
|
130
|
+
Examples
|
|
131
|
+
--------
|
|
132
|
+
|
|
133
|
+
>>> atoms = residue("URA") # Uracil
|
|
134
|
+
>>> print(atoms.element)
|
|
135
|
+
['N' 'C' 'O' 'N' 'C' 'O' 'C' 'C' 'H' 'H' 'H' 'H']
|
|
136
|
+
>>> print(create_atom_names(atoms))
|
|
137
|
+
['N1' 'C1' 'O1' 'N2' 'C2' 'O2' 'C3' 'C4' 'H1' 'H2' 'H3' 'H4']
|
|
138
|
+
"""
|
|
139
|
+
if isinstance(atoms, (AtomArray, AtomArrayStack)):
|
|
140
|
+
elements = atoms.element
|
|
141
|
+
else:
|
|
142
|
+
elements = atoms
|
|
143
|
+
|
|
144
|
+
atom_names = np.zeros(len(elements), dtype="U6")
|
|
145
|
+
element_counter = Counter()
|
|
146
|
+
for i, elem in enumerate(elements):
|
|
147
|
+
element_counter[elem] += 1
|
|
148
|
+
atom_names[i] = f"{elem}{element_counter[elem]}"
|
|
149
|
+
return atom_names
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
_elements = [
|
|
153
|
+
elem.upper()
|
|
154
|
+
for elem in [
|
|
155
|
+
"H",
|
|
156
|
+
"He",
|
|
157
|
+
"Li",
|
|
158
|
+
"Be",
|
|
159
|
+
"B",
|
|
160
|
+
"C",
|
|
161
|
+
"N",
|
|
162
|
+
"O",
|
|
163
|
+
"F",
|
|
164
|
+
"Ne",
|
|
165
|
+
"Na",
|
|
166
|
+
"Mg",
|
|
167
|
+
"Al",
|
|
168
|
+
"Si",
|
|
169
|
+
"P",
|
|
170
|
+
"S",
|
|
171
|
+
"Cl",
|
|
172
|
+
"Ar",
|
|
173
|
+
"K",
|
|
174
|
+
"Ca",
|
|
175
|
+
"Sc",
|
|
176
|
+
"Ti",
|
|
177
|
+
"V",
|
|
178
|
+
"Cr",
|
|
179
|
+
"Mn",
|
|
180
|
+
"Fe",
|
|
181
|
+
"Co",
|
|
182
|
+
"Ni",
|
|
183
|
+
"Cu",
|
|
184
|
+
"Zn",
|
|
185
|
+
"Ga",
|
|
186
|
+
"Ge",
|
|
187
|
+
"As",
|
|
188
|
+
"Se",
|
|
189
|
+
"Br",
|
|
190
|
+
"Kr",
|
|
191
|
+
"Rb",
|
|
192
|
+
"Sr",
|
|
193
|
+
"Y",
|
|
194
|
+
"Zr",
|
|
195
|
+
"Nb",
|
|
196
|
+
"Mo",
|
|
197
|
+
"Tc",
|
|
198
|
+
"Ru",
|
|
199
|
+
"Rh",
|
|
200
|
+
"Pd",
|
|
201
|
+
"Ag",
|
|
202
|
+
"Cd",
|
|
203
|
+
"In",
|
|
204
|
+
"Sn",
|
|
205
|
+
"Sb",
|
|
206
|
+
"Te",
|
|
207
|
+
"I",
|
|
208
|
+
"Xe",
|
|
209
|
+
"Cs",
|
|
210
|
+
"Ba",
|
|
211
|
+
"La",
|
|
212
|
+
"Ce",
|
|
213
|
+
"Pr",
|
|
214
|
+
"Nd",
|
|
215
|
+
"Pm",
|
|
216
|
+
"Sm",
|
|
217
|
+
"Eu",
|
|
218
|
+
"Gd",
|
|
219
|
+
"Tb",
|
|
220
|
+
"Dy",
|
|
221
|
+
"Ho",
|
|
222
|
+
"Er",
|
|
223
|
+
"Tm",
|
|
224
|
+
"Yb",
|
|
225
|
+
"Lu",
|
|
226
|
+
"Hf",
|
|
227
|
+
"Ta",
|
|
228
|
+
"W",
|
|
229
|
+
"Re",
|
|
230
|
+
"Os",
|
|
231
|
+
"Ir",
|
|
232
|
+
"Pt",
|
|
233
|
+
"Au",
|
|
234
|
+
"Hg",
|
|
235
|
+
"Tl",
|
|
236
|
+
"Pb",
|
|
237
|
+
"Bi",
|
|
238
|
+
"Po",
|
|
239
|
+
"At",
|
|
240
|
+
"Rn",
|
|
241
|
+
"Fr",
|
|
242
|
+
"Ra",
|
|
243
|
+
"Ac",
|
|
244
|
+
"Th",
|
|
245
|
+
"Pa",
|
|
246
|
+
"U",
|
|
247
|
+
"Np",
|
|
248
|
+
"Pu",
|
|
249
|
+
"Am",
|
|
250
|
+
"Cm",
|
|
251
|
+
"Bk",
|
|
252
|
+
"Cf",
|
|
253
|
+
"Es",
|
|
254
|
+
"Fm",
|
|
255
|
+
"Md",
|
|
256
|
+
"No",
|
|
257
|
+
"Lr",
|
|
258
|
+
"Rf",
|
|
259
|
+
"Db",
|
|
260
|
+
"Sg",
|
|
261
|
+
"Bh",
|
|
262
|
+
"Hs",
|
|
263
|
+
"Mt",
|
|
264
|
+
"Ds",
|
|
265
|
+
"Rg",
|
|
266
|
+
"Cn",
|
|
267
|
+
"Nh",
|
|
268
|
+
"Fl",
|
|
269
|
+
"Mc",
|
|
270
|
+
"Lv",
|
|
271
|
+
"Ts",
|
|
272
|
+
"Og",
|
|
273
|
+
]
|
|
274
|
+
]
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
def _guess_element(atom_name):
|
|
278
|
+
# remove digits (1H -> H)
|
|
279
|
+
elem = "".join([i for i in atom_name if not i.isdigit()])
|
|
280
|
+
elem = elem.upper()
|
|
281
|
+
if len(elem) == 0:
|
|
282
|
+
return ""
|
|
283
|
+
|
|
284
|
+
# Some often used elements for biomolecules
|
|
285
|
+
if (
|
|
286
|
+
elem.startswith("C")
|
|
287
|
+
or elem.startswith("N")
|
|
288
|
+
or elem.startswith("O")
|
|
289
|
+
or elem.startswith("S")
|
|
290
|
+
or elem.startswith("H")
|
|
291
|
+
):
|
|
292
|
+
return elem[0]
|
|
293
|
+
|
|
294
|
+
# Exactly match element abbreviations
|
|
295
|
+
try:
|
|
296
|
+
return _elements[_elements.index(elem[:2])]
|
|
297
|
+
except ValueError:
|
|
298
|
+
try:
|
|
299
|
+
return _elements[_elements.index(elem[0])]
|
|
300
|
+
except ValueError:
|
|
301
|
+
warnings.warn(f"Could not infer element for '{atom_name}'")
|
|
302
|
+
return ""
|