module Chem

Defined in:

chem.cr
chem/core/atom.cr
chem/core/atom_view.cr
chem/core/bias.cr
chem/core/bond.cr
chem/core/bond_array.cr
chem/core/chain.cr
chem/core/chain_view.cr
chem/core/residue_view.cr
chem/core/structure.cr
chem/core/structure/builder.cr
chem/pull_parser.cr
chem/register_format.cr
chem/version.cr

Constant Summary

Log = ::Log.for("chem")
VERSION = "0.1.0"

Class Method Summary

Class Method Detail

def self.guess_format(path : Path | String, type : Chem::Spatial::Grid.class) : Chem::Cube.class | Chem::DX.class | Chem::GOpenMol.class | Chem::VASP::Chgcar.class | Chem::VASP::Locpot.class #

Returns the format compatible with Chem::Spatial::Grid based on path. Raises ArgumentError if the format does not support type or cannot be determined.

This method effectively narrows down the union of available formats to those compatible with type. See .guess_format?(path) for more details.


[View source]
def self.guess_format(path : Path | String, type : Chem::Spatial::Grid::Info.class) : Chem::Cube.class | Chem::DX.class | Chem::GOpenMol.class | Chem::VASP::Chgcar.class | Chem::VASP::Locpot.class #

Returns the format compatible with Chem::Spatial::Grid::Info based on path. Raises ArgumentError if the format does not support type or cannot be determined.

This method effectively narrows down the union of available formats to those compatible with type. See .guess_format?(path) for more details.


[View source]
def self.guess_format(path : Path | String, type : Chem::Structure.class) : Chem::Cube.class | Chem::Gen.class | Chem::JDFTx.class | Chem::Maestro.class | Chem::Mol.class | Chem::Mol2.class | Chem::PDB.class | Chem::PSF.class | Chem::Protein::Stride.class | Chem::PyMOL.class | Chem::SDF.class | Chem::VASP::Chgcar.class | Chem::VASP::Locpot.class | Chem::VASP::Poscar.class | Chem::VMD.class | Chem::XYZ.class #

Returns the format compatible with Chem::Structure based on path. Raises ArgumentError if the format does not support type or cannot be determined.

This method effectively narrows down the union of available formats to those compatible with type. See .guess_format?(path) for more details.


[View source]
def self.guess_format(path : Path | String, type : Enumerable(Chem::Structure).class) : Chem::Maestro.class | Chem::Mol2.class | Chem::PDB.class | Chem::SDF.class | Chem::XYZ.class #

Returns the format compatible with Enumerable(Chem::Structure) based on path. Raises ArgumentError if the format does not support type or cannot be determined.

This method effectively narrows down the union of available formats to those compatible with type. See .guess_format?(path) for more details.


[View source]
def self.guess_format(path : Path | String, type : Chem::Spatial::Positions3.class) : Chem::DCD.class #

Returns the format compatible with Chem::Spatial::Positions3 based on path. Raises ArgumentError if the format does not support type or cannot be determined.

This method effectively narrows down the union of available formats to those compatible with type. See .guess_format?(path) for more details.


[View source]
def self.guess_format(path : Path | String, type : Enumerable(Chem::Spatial::Positions3).class) : Chem::DCD.class #

Returns the format compatible with Enumerable(Chem::Spatial::Positions3) based on path. Raises ArgumentError if the format does not support type or cannot be determined.

This method effectively narrows down the union of available formats to those compatible with type. See .guess_format?(path) for more details.


[View source]
def self.guess_format(path : Path | String, type : Chem::DCD::Info.class) : Chem::DCD.class #

Returns the format compatible with Chem::DCD::Info based on path. Raises ArgumentError if the format does not support type or cannot be determined.

This method effectively narrows down the union of available formats to those compatible with type. See .guess_format?(path) for more details.


[View source]
def self.guess_format(path : Path | String, type : Chem::AtomView.class) : Chem::Gen.class | Chem::Mol.class | Chem::Mol2.class | Chem::PDB.class | Chem::XYZ.class #

Returns the format compatible with Chem::AtomView based on path. Raises ArgumentError if the format does not support type or cannot be determined.

This method effectively narrows down the union of available formats to those compatible with type. See .guess_format?(path) for more details.


[View source]
def self.guess_format(path : Path | String, type : Chem::PDB::Info.class) : Chem::PDB.class #

Returns the format compatible with Chem::PDB::Info based on path. Raises ArgumentError if the format does not support type or cannot be determined.

This method effectively narrows down the union of available formats to those compatible with type. See .guess_format?(path) for more details.


[View source]
def self.guess_format(path : Path | String, type : Chem::Structure::Experiment.class) : Chem::PDB.class #

Returns the format compatible with Chem::Structure::Experiment based on path. Raises ArgumentError if the format does not support type or cannot be determined.

This method effectively narrows down the union of available formats to those compatible with type. See .guess_format?(path) for more details.


[View source]
def self.guess_format(path : Path | String) #

Returns the format module for path based on its filename. See .guess_format? for matching rules. Raises ArgumentError if the format cannot be determined.


[View source]
def self.guess_format?(path : Path | String, type : Chem::Spatial::Grid.class) : Chem::Cube.class | Chem::DX.class | Chem::GOpenMol.class | Chem::VASP::Chgcar.class | Chem::VASP::Locpot.class | Nil #

Returns the format compatible with Chem::Spatial::Grid based on path or nil if the format does not support type or cannot be determined.

This method effectively narrows down the union of available formats to those compatible with type. See .guess_format?(path) for more details.


[View source]
def self.guess_format?(path : Path | String, type : Chem::Spatial::Grid::Info.class) : Chem::Cube.class | Chem::DX.class | Chem::GOpenMol.class | Chem::VASP::Chgcar.class | Chem::VASP::Locpot.class | Nil #

Returns the format compatible with Chem::Spatial::Grid::Info based on path or nil if the format does not support type or cannot be determined.

This method effectively narrows down the union of available formats to those compatible with type. See .guess_format?(path) for more details.


[View source]
def self.guess_format?(path : Path | String, type : Chem::Structure.class) : Chem::Cube.class | Chem::Gen.class | Chem::JDFTx.class | Chem::Maestro.class | Chem::Mol.class | Chem::Mol2.class | Chem::PDB.class | Chem::PSF.class | Chem::Protein::Stride.class | Chem::PyMOL.class | Chem::SDF.class | Chem::VASP::Chgcar.class | Chem::VASP::Locpot.class | Chem::VASP::Poscar.class | Chem::VMD.class | Chem::XYZ.class | Nil #

Returns the format compatible with Chem::Structure based on path or nil if the format does not support type or cannot be determined.

This method effectively narrows down the union of available formats to those compatible with type. See .guess_format?(path) for more details.


[View source]
def self.guess_format?(path : Path | String, type : Enumerable(Chem::Structure).class) : Chem::Maestro.class | Chem::Mol2.class | Chem::PDB.class | Chem::SDF.class | Chem::XYZ.class | Nil #

Returns the format compatible with Enumerable(Chem::Structure) based on path or nil if the format does not support type or cannot be determined.

This method effectively narrows down the union of available formats to those compatible with type. See .guess_format?(path) for more details.


[View source]
def self.guess_format?(path : Path | String, type : Chem::Spatial::Positions3.class) : Chem::DCD.class | Nil #

Returns the format compatible with Chem::Spatial::Positions3 based on path or nil if the format does not support type or cannot be determined.

This method effectively narrows down the union of available formats to those compatible with type. See .guess_format?(path) for more details.


[View source]
def self.guess_format?(path : Path | String, type : Enumerable(Chem::Spatial::Positions3).class) : Chem::DCD.class | Nil #

Returns the format compatible with Enumerable(Chem::Spatial::Positions3) based on path or nil if the format does not support type or cannot be determined.

This method effectively narrows down the union of available formats to those compatible with type. See .guess_format?(path) for more details.


[View source]
def self.guess_format?(path : Path | String, type : Chem::DCD::Info.class) : Chem::DCD.class | Nil #

Returns the format compatible with Chem::DCD::Info based on path or nil if the format does not support type or cannot be determined.

This method effectively narrows down the union of available formats to those compatible with type. See .guess_format?(path) for more details.


[View source]
def self.guess_format?(path : Path | String, type : Chem::AtomView.class) : Chem::Gen.class | Chem::Mol.class | Chem::Mol2.class | Chem::PDB.class | Chem::XYZ.class | Nil #

Returns the format compatible with Chem::AtomView based on path or nil if the format does not support type or cannot be determined.

This method effectively narrows down the union of available formats to those compatible with type. See .guess_format?(path) for more details.


[View source]
def self.guess_format?(path : Path | String, type : Chem::PDB::Info.class) : Chem::PDB.class | Nil #

Returns the format compatible with Chem::PDB::Info based on path or nil if the format does not support type or cannot be determined.

This method effectively narrows down the union of available formats to those compatible with type. See .guess_format?(path) for more details.


[View source]
def self.guess_format?(path : Path | String, type : Chem::Structure::Experiment.class) : Chem::PDB.class | Nil #

Returns the format compatible with Chem::Structure::Experiment based on path or nil if the format does not support type or cannot be determined.

This method effectively narrows down the union of available formats to those compatible with type. See .guess_format?(path) for more details.


[View source]
def self.guess_format?(path : Path | String) #

Returns the format module for path based on its filename, or nil if unknown. Extensions are matched as a case-insensitive suffix of the basename, so multi-part extensions such as .mae.gz work. Longer extensions take precedence over shorter ones. File stem matching via File.match? is case-sensitive and is used only if no extension matches.


[View source]
def self.kekulize(bonds : Enumerable(Bond)) : Nil #

Kekulizes bonds marked as aromatic. Raises an exception when bonds could not be kekulized.

Kekulization is the process of assigning double bonds to fill the Lewis structure of the aromatic atoms. Different bond orderings may produce distinct but valid Kekule forms. This procedure requires that all atoms have explicit hydrogens such that unfilled valence is due to missing double bonds only, otherwise it will produce incorrect chemical structures or even fail.

This method first groups aromatic bonds by their connectivity. Then, each bond subset (ring) is kekulized independently. Alternating double bonds starting from a root bond are assigned based on the connectivity tree, which is traversed using the iterative breadth-first search (BFS) algorithm. Different root bonds are tested until a valid Kekule form is found. Otherwise, an exception is raised.


[View source]