Chem::Structure
Inherits Chem::ResidueCollection / Chem::ChainCollection / Chem::AtomCollection / Reference / Object
Constructors
Returns the structure encoded in input using the
Chem::VASP::Chgcar file format. Arguments are forwarded to
Chem::VASP::Chgcar::Reader.open.
Returns the structure encoded in input using the
Chem::Cube file format. Arguments are forwarded to
Chem::Cube::Reader.open.
Returns the structure encoded in input using the
Chem::Gen file format. Arguments are forwarded to
Chem::Gen::Reader.open.
Returns the structure encoded in input using the
Chem::VASP::Locpot file format. Arguments are forwarded to
Chem::VASP::Locpot::Reader.open.
Returns the structure encoded in input using the
Chem::Mol file format. Arguments are forwarded to
Chem::Mol::Reader.open.
Returns the structure encoded in input using the
Chem::Mol2 file format. Arguments are forwarded to
Chem::Mol2::Reader.open.
If input contains multiple entries, this method returns
the first one only. Use Array#from_mol2 or
Chem::Mol2::Reader#each to get multiple entries instead.
Returns the structure encoded in input using the
Chem::PDB file format. Arguments are forwarded to
Chem::PDB::Reader.open.
If input contains multiple entries, this method returns
the first one only. Use Array#from_pdb or
Chem::PDB::Reader#each to get multiple entries instead.
Returns the structure encoded in input using the
Chem::VASP::Poscar file format. Arguments are forwarded to
Chem::VASP::Poscar::Reader.open.
Returns the structure encoded in input using the
Chem::PSF file format. Arguments are forwarded to
Chem::PSF::Reader.open.
Returns the structure encoded in input using the
Chem::SDF file format. Arguments are forwarded to
Chem::SDF::Reader.open.
If input contains multiple entries, this method returns
the first one only. Use Array#from_sdf or
Chem::SDF::Reader#each to get multiple entries instead.
Returns the structure encoded in input using the
Chem::XYZ file format. Arguments are forwarded to
Chem::XYZ::Reader.open.
If input contains multiple entries, this method returns
the first one only. Use Array#from_xyz or
Chem::XYZ::Reader#each to get multiple entries instead.
Returns the structure encoded in the specified file
using format. Raises ArgumentError if format has
required arguments or cannot read Chem::Structure.
If input contains multiple entries, this method returns
the first one only. Use Array.read or
Chem::FormatReader::MultiEntry#each (reader can be
obtained via Chem::Format.reader) to get multiple entries
instead.
The supported file formats are Chem::Cube, Chem::Gen, Chem::Mol2, Chem::Mol, Chem::PDB, Chem::PSF, Chem::SDF, Chem::VASP::Chgcar, Chem::VASP::Locpot, Chem::VASP::Poscar, Chem::XYZ. Use the
.from_* methods to customize how the object is decoded in
the corresponding file format if possible.
Returns the structure encoded in the specified file.
The file format is chosen based on the filename (see
Chem::Format#from_filename). Raises ArgumentError if the
file format cannot be determined.
If the file contains multiple entries, this method returns
the first one only. Use Array.read to get multiple entries
instead.
The supported file formats are the following:
Chem::Gen(.gen)Chem::Mol(.mol)Chem::Mol2(.mol2)Chem::PDB(.ent, .pdb)Chem::PSF(.psf)Chem::SDF(.sdf)Chem::XYZ(.xyz)Chem::VASP::Poscar(.poscar, POSCAR, CONTCAR)Chem::Cube(.cube)Chem::VASP::Chgcar(CHGCAR)Chem::VASP::Locpot(LOCPOT)
Use the .from_* methods to customize how the object is
decoded in the corresponding file format if possible.
Instance methods
Returns a deep copy of self, that is, every chain/residue/atom is copied.
Unlike array-like classes in the language, #dup (shallow copy) is not possible.
structure = Structure.new "/path/to/file.pdb"
other = structure.clone
other == structure # => true
other.same?(structure) # => false
structure.dig('A', 23, "OG").partial_charge # => 0.0
other.dig('A', 23, "OG").partial_charge # => 0.0
structure.dig('A', 23, "OG").partial_charge = 0.635 # => 0.635
other.dig('A', 23, "OG").partial_charge # => 0.0
Returns a new structure containing the selected atoms by the given block.
Structure properties such as biases, unit cell, title, etc. are
copied only if copy_properties is true.
Hash-like container that stores the structure's properties as key
(string)-value pairs. A property's value can be any of the
primitive types (string, integer, float, or bool), and so it's
internally stored as Metadata::Any. Use the cast methods
(#as_*) to convert to the desired type.
structure.metadata["foo"] = 123
structure.metadata["foo"] # => Metadata::Any(123)
structure.metadata["foo"].as_i # => 123
structure.metadata["foo"].as_f # => 123.0
structure.metadata["foo"].as_s # raises TypeCastError
Returns a string representation of the structure using
the Chem::Gen file format. Arguments are fowarded to
Chem::Gen::Writer.open.
Writes the structure to output using the Chem::Gen
file format. Arguments are fowarded to Chem::Gen::Writer.open.
Writes the structure to output using the Chem::Mol2
file format. Arguments are fowarded to Chem::Mol2::Writer.open.
Returns a string representation of the structure using
the Chem::Mol2 file format. Arguments are fowarded to
Chem::Mol2::Writer.open.
Returns a string representation of the structure using
the Chem::PDB file format. Arguments are fowarded to
Chem::PDB::Writer.open.
Writes the structure to output using the Chem::PDB
file format. Arguments are fowarded to Chem::PDB::Writer.open.
Returns a string representation of the structure using
the Chem::VASP::Poscar file format. Arguments are fowarded to
Chem::VASP::Poscar::Writer.open.
Writes the structure to output using the Chem::VASP::Poscar
file format. Arguments are fowarded to Chem::VASP::Poscar::Writer.open.
Writes the structure to output using the Chem::PyMOL
file format. Arguments are fowarded to Chem::PyMOL::Writer.open.
Returns a string representation of the structure using
the Chem::PyMOL file format. Arguments are fowarded to
Chem::PyMOL::Writer.open.
Appends a short String representation of this object which includes its class name and its object address.
class Person
def initialize(@name : String, @age : Int32)
end
end
Person.new("John", 32).to_s # => #<Person:0x10a199f20>
Writes the structure to output using the Chem::Protein::Stride
file format. Arguments are fowarded to Chem::Protein::Stride::Writer.open.
Returns a string representation of the structure using
the Chem::Protein::Stride file format. Arguments are fowarded to
Chem::Protein::Stride::Writer.open.
Writes the structure to output using the Chem::VMD
file format. Arguments are fowarded to Chem::VMD::Writer.open.
Returns a string representation of the structure using
the Chem::VMD file format. Arguments are fowarded to
Chem::VMD::Writer.open.
Returns a string representation of the structure using
the Chem::XYZ file format. Arguments are fowarded to
Chem::XYZ::Writer.open.
Writes the structure to output using the Chem::XYZ
file format. Arguments are fowarded to Chem::XYZ::Writer.open.
Writes the structure to output using format. Raises
ArgumentError if format has required arguments or cannot
write Chem::Structure.
The supported file formats are Chem::Gen, Chem::Mol2, Chem::PDB, Chem::Protein::Stride, Chem::PyMOL, Chem::VASP::Poscar, Chem::VMD, Chem::XYZ. Use the
#to_* methods to customize how the object is written in the
corresponding file format if possible.
Writes the structure to the specified file. The file
format is chosen based on the filename (see
Chem::Format#from_filename). Raises ArgumentError if the
file format cannot be determined.
The supported file formats are the following:
Chem::Gen(.gen)Chem::Mol2(.mol2)Chem::PDB(.ent, .pdb)Chem::PyMOL(.pml)Chem::VMD(.vmd)Chem::XYZ(.xyz)Chem::Protein::Stride(.stride)Chem::VASP::Poscar(.poscar, POSCAR, CONTCAR)
Use the #to_* methods to customize how the object is written
in the corresponding file format if possible.