|
faunus
|
Cell list class templates. More...
Namespaces | |
| analysis | |
| Adding a new analysis requires the following steps: | |
| ChemistryUnits | |
| Chemistry units. | |
| Energy | |
| Geometry | |
| Simulation geometries and related operations. | |
| pairpotential | |
| Namespace for particle pair-potentials. | |
| PhysicalConstants | |
| Physical constants. | |
| Region | |
| Subspaces around particles, molecules etc. | |
| Scatter | |
| Routines related to scattering. | |
| SpheroCylinder | |
| The algorithms found here are mainly direct conversions from Robert Vacha's spherocylinder C code (~2008-2010). | |
| Tabulate | |
| Class templates for tabulation of pair potentials. | |
Classes | |
| class | AminoAcidModelReader |
| class | AminoAcidModelWriter |
| class | AngularScan |
| Rotate and translate two molecules to explore all poses. More... | |
| class | Average |
| Class to collect averages. More... | |
| class | AverageObj |
| Simple class to average data contained in objects. More... | |
| class | AverageObjStdev |
| class | AverageStdev |
| Class to collect averages and standard deviation. More... | |
| struct | BasePointerVector |
| Helper class for storing vectors of base pointers. More... | |
| struct | Change |
| Specify changes made to a system. More... | |
| struct | Charge |
| Charge (monopole) property. More... | |
| class | Cigar |
| Patchy sphero cylinder a.k.a.Sphero-cylinder properties. More... | |
| class | CoarseGrainedFastaFileReader |
| Reads FASTA file and generate one particle per amino acid. More... | |
| struct | ConfigurationError |
| Exception to be thrown when parsing json configuration. More... | |
| struct | Conformation |
| Possible structure for molecular conformations. More... | |
| class | Decorrelation |
| "Decorrelation" class from https://dx.doi.org/10.1002/jcc.20746 More... | |
| struct | Dipole |
| Dipole properties. More... | |
| class | DynamicArray2D |
| class | DynamicArray3D |
| class | ElasticRange |
| Turns a pair of iterators into an elastic range. More... | |
| class | Electrolyte |
| Stores information about salts for calculation of Debye screening length etc. More... | |
| class | Equidistant2DTable |
| class | ExclusionsSimple |
| Determines if two particles within a group are excluded from mutual nonbonded interactions. More... | |
| class | ExclusionsVicinity |
| Determines if two particles within a group are excluded from mutual nonbonded interactions. More... | |
| struct | GenericError |
| Common ancestor of Faunus specific runtime errors. More... | |
| class | GromacsReader |
| class | GromacsWriter |
| class | Group |
| End of Group class. More... | |
| class | InsertMoleculesInSpace |
| Insert molecules into space. More... | |
| class | InteractionData |
| A stub to hold various parameters of interactions. More... | |
| struct | IOError |
| Exception to be thrown on IO errors. More... | |
| struct | IterRange |
| Turns a pair of iterators into a range. More... | |
| class | Legendre |
| Evaluate n'th degree Legendre polynomial. More... | |
| class | MetropolisMonteCarlo |
| Class to handle Monte Carlo moves. More... | |
| class | MoleculeBuilder |
| Constructs MoleculeData from JSON. More... | |
| class | MoleculeData |
| General properties for molecules. More... | |
| struct | MoleculeInserter |
| Random position and orientation - typical for rigid bodies. More... | |
| class | MoleculeStructureReader |
| Fills the particle vector from various sources, e.g., files or JSON array. More... | |
| class | NeighboursGenerator |
| Generate all possible atom pairs within a given bond distance. More... | |
| struct | ordered_pair |
Ordered pair where first<=second More... | |
| class | PairMatrix |
| Container for data between pairs. More... | |
| class | Particle |
| Particle class for storing positions, id, and other properties. More... | |
| struct | ParticlePropertyBase |
| Base class for particle properties. More... | |
| class | ParticleTemplate |
| Particle template. More... | |
| struct | Polarizable |
| class | PQRReader |
| class | PQRWriter |
| struct | Quadrupole |
| class | Quantize |
| Round and bin numbers for use with tables and histograms. More... | |
| class | QuaternionRotate |
| Rotation routine using the Eigen library. More... | |
| struct | Radius |
| Radius property. More... | |
| class | Random |
| Random number generator. More... | |
| class | RandomInserter |
| Inserts molecules into random positions in the container. More... | |
| class | ReactionData |
| General properties of reactionsEnd of class. More... | |
| struct | RowMajorOffset |
| memory offset for arbitrary dimensions, row-major layout More... | |
| struct | SingleUseJSON |
| Like json, but delete entries after access. More... | |
| class | Space |
| Placeholder for atoms and molecules. More... | |
| class | SparseHistogram |
| Histogram for an arbitrary set of values using a sparse memory layout (map) More... | |
| class | SpheroCylinderData |
| Static properties for patchy sphero cylinders (PSC) More... | |
| class | SpheroCylinderXYZReader |
| class | SpheroCylinderXYZWriter |
| Modified XYZ format that also saves spherocylinder direction and patch (ported from Faunus v1) More... | |
| class | Stopwatch |
| Simple struct to measure duration of code. More... | |
| class | StructureFileReader |
| Base class to load simple structure files such as XYZ, AAM, PQR etc. More... | |
| class | StructureFileWriter |
| Base class to writeKeyValuePairs simple structure files such as XYZ, AAM, PQR etc. More... | |
| struct | SystemAction |
| Performs a task or "action" on the system, typically before or after a simulation. More... | |
| class | Table |
| Dynamic table for 1d data. More... | |
| class | Table2D |
| General class for handling 2D tables - xy data, for example. More... | |
| struct | Tensor |
| Tensor class Tensor class. More... | |
| class | TimeRelativeOfTotal |
| Timer for measuring relative time consumption. More... | |
| class | TipFromTheManual |
| Class for showing help based on input errors. More... | |
| struct | TrajectoryFrame |
| Simple data structure to store a trajectory frame in native Faunus format. More... | |
| class | TranslationalEntropy |
| Entropy change due to particle fluctuations. More... | |
| struct | UnknownAtomError |
| An exception to indicate an unknown atom name in the input. More... | |
| struct | UnknownMoleculeError |
| An exception to indicate an unknown molecule name in the input. More... | |
| class | WeightedDistribution |
| Stores a series of elements with given weight. More... | |
| class | XTCReader |
| Reads frames from an XTC file (GROMACS compressed trajectory file format). More... | |
| struct | XTCTrajectoryFrame |
| Base data structure for native XTC format as used in Gromacs and supported by the C library. More... | |
| class | XTCWriter |
| Writes frames into an XTC file (GROMACS compressed trajectory file format). More... | |
| class | XYZReader |
| XYZ file loader. More... | |
| class | XYZWriter |
Typedefs | |
| using | Point = Eigen::Vector3d |
| 3D vector used for positions, velocities, forces etc. | |
| using | json = nlohmann::json |
| JSON object. | |
| using | PointVector = std::vector< Point > |
| Vector of 3D vectors. | |
| using | ParticleVector = std::vector< Particle > |
| Storage type for collections of particles. | |
| using | RandomNumberEngine = std::mt19937 |
Functions | |
| std::unique_ptr< SystemAction > | createAction (std::string_view name, const json &properties, Space &spc) |
| Create single action from JSON input. | |
| std::vector< std::unique_ptr< SystemAction > > | createActionList (const json &input, Space &spc) |
| Create vector of actions from JSON list input. | |
| void | from_json (const json &j, InteractionData &a) |
| void | from_single_use_json (SingleUseJSON &j, InteractionData &a) |
| void | to_json (json &j, const InteractionData &a) |
| void | to_json (json &j, const AtomData &a) |
| void | set_dp_and_dprot (const json &j, AtomData &atomdata) |
| Handles optional translational and rotational displacement. | |
| void | from_json (const json &j, AtomData &a) |
| void | from_json (const json &j, std::vector< Faunus::AtomData > &atom_vector) |
| TEST_SUITE_BEGIN ("AtomData") | |
| TEST_CASE ("[Faunus] AtomData") | |
| TEST_SUITE_END () | |
| AtomData & | findAtomByName (std::string_view name) |
| Finds an atom by its name in the global Faunus atoms lexicon. More... | |
| void | from_json (const json &j, SpheroCylinderData &psc) |
| void | to_json (json &j, const SpheroCylinderData &psc) |
| NLOHMANN_JSON_SERIALIZE_ENUM (SpheroCylinderData::PatchType, {{SpheroCylinderData::PatchType::Invalid, nullptr}, {SpheroCylinderData::PatchType::Full, "full"}, {SpheroCylinderData::PatchType::Capped, "capped"}, {SpheroCylinderData::PatchType::None, "none"}}) class AtomData | |
| General properties for atoms. More... | |
| void | from_json (const json &j, std::vector< AtomData > &atom_vector) |
| Construct vector of atoms from json array. More... | |
| auto | findName (RequireNamedElements auto &range, std::string_view name) |
Finds the first element with a member attribute name matching the input. More... | |
| auto | findName (const RequireNamedElements auto &range, std::string_view name) |
| template<RequireNamedElements T> | |
| auto | names2ids (const T &database, const std::vector< std::string > &names) |
Search for name in database and return id() More... | |
| template<typename T > | |
| constexpr auto | arange (const T start, const T stop, const T step) |
| Return evenly spaced values within a given interval. More... | |
| TEST_CASE ("[Faunus] arange") | |
| Point | xyz2rth (const Point &, const Point &origin={0, 0, 0}, const Point &dir={0, 0, 1}, const Point &dir2={1, 0, 0}) |
| Convert cartesian- to cylindrical-coordinates. More... | |
| Point | xyz2rtp (const Point &, const Point &origin={0, 0, 0}) |
| Convert cartesian- to spherical-coordinates. More... | |
| Point | rtp2xyz (const Point &rtp, const Point &origin={0, 0, 0}) |
| Convert spherical- to cartesian-coordinates. More... | |
| template<typename dbl = double, class iter , class memberptr > | |
| auto | asEigenMatrix (iter begin, iter end, memberptr m) |
| Eigen::Map facade to data members in STL container. More... | |
| template<typename dbl = double, class iter , class memberptr > | |
| auto | asEigenVector (iter begin, iter end, memberptr m) |
| TEST_CASE ("[Faunus] Equidistant2DTable") | |
| template<std::floating_point T> | |
| T | erfc_x (T x) |
| Approximation of erfc-function. More... | |
| TEST_CASE ("[Faunus] erfc_x") | |
| template<typename T > | |
| T | erf_x (T x) |
| Approximate 1 - erfc_x. More... | |
| template<class Tint = std::int32_t> | |
| double | exp_cawley (double y) |
| Approximate exp() function. More... | |
| double | exp_untested (double y) |
| TEST_CASE ("[Faunus] exp_cawley") | |
| TEST_CASE ("[Faunus] exp_untested") | |
| template<typename float_t = double, char iterations = 1> | |
| float_t | inv_sqrt (float_t x) |
| Fast inverse square-root approximation. More... | |
| template<class T1 , class T2 > | |
| auto | distance (T1 first, T2 last) |
| Distance between two arbitrary contiguous iterators. | |
| template<class Trange > | |
| size_t | range_size (Trange &rng) |
Size of a Ranges object using the cpp20::distance() | |
| json | loadJSON (const std::string &filename) |
| Read json filename into json object (w. syntax check) | |
| double | roundValue (double value, int number_of_digits=3) |
| Round to n number of significant digits. | |
| void | roundJSON (json &j, int number_of_digits=3) |
| Round float objects to n number of significant digits. | |
| double | getValueInfinity (const json &j, const std::string &key) |
| Extract floating point from json and allow for 'inf' and '-inf'. | |
| std::tuple< const std::string &, const json & > | jsonSingleItem (const json &j) |
| Returns a key-value pair from a JSON object which contains a single key. More... | |
| template<typename T > | |
| std::optional< T > | get_optional (const json &j, std::string_view key) |
Extract JSON value associated with key into std::optional More... | |
| template<typename SparseMatrixType > | |
| bool | streamMarket (const SparseMatrixType &mat, std::ostream &out, bool symmetric=false) |
| Save Matrix Market sparse matrix. More... | |
| TEST_CASE ("[Faunus] RowMajor3DMatrix") | |
| TEST_CASE ("[Faunus] PairMatrix") | |
| template<class T > | |
| constexpr T | powi (T x, unsigned int n) |
| n'th integer power of float More... | |
| TEST_CASE ("[Faunus] powi") | |
| template<class Tx , class Ty > | |
| Table2D< Tx, Ty > | operator- (Table2D< Tx, Ty > &a, Table2D< Tx, Ty > &b) |
| Subtract two tables. | |
| template<class Tx , class Ty > | |
| Table2D< Tx, Ty > | operator+ (Table2D< Tx, Ty > &a, Table2D< Tx, Ty > &b) |
| Addition two tables. | |
| TEST_SUITE_BEGIN ("Auxiliary") | |
| TEST_CASE ("[Faunus] for_each_pair") | |
| TEST_CASE ("[Faunus] ordered_pair") | |
| TEST_CASE ("[Faunus] Text manipulation") | |
| TEST_CASE ("numeric_cast") | |
| template<std::integral TOut, std::floating_point TIn> | |
| TOut | numeric_cast (const TIn number) |
| Convert floating point number to integral number. More... | |
| template<std::forward_iterator Titer, typename Tfunction , typename T = double, typename Taggregate_function > | |
| T | for_each_unique_pair (Titer begin, Titer end, Tfunction f, Taggregate_function aggregator=std::plus< T >()) |
| Iterate over pairs in container, call a function on the elements, and sum results. More... | |
| template<std::ranges::range T> | |
| T | erase_range (T target, const T &values) |
Erase from target range all values found in values range. | |
| template<std::floating_point T, std::integral Tint = int> | |
| Tint | to_bin (T x, T dx=1) |
| Round a floating point to integer for use with histogram binning. More... | |
| template<StringStreamable T> | |
| auto | splitConvert (const std::string &words) |
| Convert space separated words into vector of type T. More... | |
| template<std::ranges::range Range> | |
| std::string | joinToString (const Range &values) requires StringStreamable< std |
| Convert range of values into space separated string. More... | |
| template<typename T > | |
| void | to_json (nlohmann::json &j, const BasePointerVector< T > &b) |
| template<typename T > | |
| void | from_json (const nlohmann::json &j, BasePointerVector< T > &b) |
| TEST_CASE ("[Faunus] Average") | |
| TEST_CASE ("[Faunus] AverageStd") | |
| TEST_CASE ("[Faunus] AverageObj") | |
| void | displayError (spdlog::logger &logger, const std::exception &e, int level=0) |
| Nicely displays nested exceptions using a logger. More... | |
| void | to_json (json &j, const Electrolyte &electrolyte) |
| std::optional< Electrolyte > | makeElectrolyte (const json &j) |
| Create ionic salt object from json. | |
| void | to_json (json &j, const Group &group) |
| void | from_json (const json &j, Group &group) |
| TEST_SUITE_BEGIN ("Group") | |
| TEST_CASE ("[Faunus] swap_to_back") | |
| TEST_CASE ("[Faunus] ElasticRange") | |
| TEST_CASE ("[Faunus] Group") | |
| template<typename T > | |
| void | swap_to_back (T first, T last, T end) |
| Move range [first:last] to [end] by swapping elements. | |
| template<unsigned int mask> | |
| std::function< bool(const Group &)> | getGroupFilter () |
| Get lambda function matching given enum Select mask. | |
| TEST_CASE ("[Faunus] openCompressedOutputStream") | |
| TEST_CASE ("XTCFrame") | |
| ParticleVector | fastaToParticles (std::string_view fasta_sequence, double bond_length=7.0, const Point &origin={0, 0, 0}) |
| Create particle vector from FASTA sequence with equally spaced atoms. More... | |
| std::unique_ptr< StructureFileWriter > | createStructureFileWriter (const std::string &suffix) |
| Create structure writer. More... | |
| ParticleVector | loadStructure (std::string_view filename, bool prefer_charges_from_file=true) |
| Load structure file into particle vector. More... | |
| std::vector< AtomData::index_type > | fastaToAtomIds (std::string_view fasta_sequence) |
| Convert FASTA sequence to atom id sequence. More... | |
| TEST_CASE ("[Faunus] StructureFileReader and StructureFileWriter") | |
| TEST_CASE ("[Faunus] CoarseGrainedFastaFileReader") | |
| std::string | addGrowingSuffix (const std::string &) |
| Add growing suffix filename until non-existing name is found. | |
| TEST_SUITE_BEGIN ("Molecule") | |
| void | to_json (json &j, const MoleculeData &a) |
| TEST_CASE ("[Faunus] MoleculeData") | |
| TEST_CASE ("NeighboursGenerator") | |
| TEST_CASE ("[Faunus] MoleculeBuilder") | |
| void | from_json (const json &j, MoleculeData &a) |
| void | from_json (const json &j, std::vector< MoleculeData > &v) |
| TEST_CASE ("[Faunus] MoleculeStructureReader") | |
| void | from_json (const json &j, ExclusionsSimple &exclusions) |
| void | to_json (json &j, const ExclusionsSimple &exclusions) |
| void | to_json (json &j, const ExclusionsVicinity &exclusions) |
| TEST_CASE ("[Faunus] ExclusionsVicinity") | |
| void | from_json (const json &j, MoleculeInserter &inserter) |
| void | to_json (json &j, const MoleculeInserter &inserter) |
| TEST_CASE ("[Faunus] Conformation") | |
| void | from_json (const json &j, ReactionData &a) |
| void | to_json (json &j, const ReactionData &reaction) |
| TEST_CASE ("[Faunus] ReactionData") | |
| MoleculeData & | findMoleculeByName (std::string_view name) |
| Finds a molecule by its name in the global Faunus molecules lexicon. More... | |
| std::pair< std::vector< std::string >, std::vector< std::string > > | parseReactionString (const std::string &process_string) |
| This parses a string containing a reaction, e.g. More... | |
| std::vector< MoleculeData::index_type > | parseMolecules (const json &j) |
| void | from_json (const json &, MetropolisMonteCarlo::State &) |
| Build state from json object. | |
| void | to_json (json &j, const MetropolisMonteCarlo &monte_carlo) |
| template<class Tvec > | |
| double | q2mu (double QBxMuA, const Tvec &muA, double QAxMuB, const Tvec &muB, const Tvec &r) |
| Returns ion-dipole interaction. More... | |
| template<class Tvec > | |
| double | mu2mu (const Tvec &muA, const Tvec &muB, double muAxmuB, const Tvec &r, double a=1.0, double b=0.0) |
| Returns dipole-dipole interaction. More... | |
| template<class Tvec , class Tmat > | |
| double | q2quad (double qA, const Tmat &quadB, double qB, const Tmat &quadA, const Tvec &r) |
| Returns ion-quadrupole interaction. More... | |
| template<std::forward_iterator Titer> | |
| double | monopoleMoment (Titer begin, Titer end) |
| Returns the total charge for a set of particles. More... | |
| template<std::forward_iterator Titer, class BoundaryFunction = std::function<void(Point&)>> | |
| Point | dipoleMoment (Titer begin, Titer end, BoundaryFunction boundary=[](Point &) {}, const Point origin={0, 0, 0}, double cutoff=pc::infty) |
| Returns the total dipole-moment for a set of particles. More... | |
| TEST_CASE ("[Faunus] dipoleMoment") | |
| template<std::forward_iterator Titer, class BoundaryFunction > | |
| Tensor | quadrupoleMoment (Titer begin, Titer end, BoundaryFunction boundary=[](const Point &) {}, Point origin={0, 0, 0}, double cutoff=pc::infty) |
| Returns the total quadrupole-moment for a set of particles, note with trace! More... | |
| TEST_CASE ("[Faunus] quadrupoleMoment") | |
| template<class Tgroup , class BoundaryFunction > | |
| auto | toMultipole (const Tgroup &g, BoundaryFunction boundary=[](const Point &) {}, double cutoff=pc::infty) |
| Converts a group to a multipole-particle. More... | |
| void | from_json (const json &j, Particle &particle) |
| void | to_json (json &j, const Particle &particle) |
| TEST_SUITE_BEGIN ("Particle") | |
| TEST_CASE ("[Faunus] Particle") | |
| template<typename... Ts> | |
| auto | to_json (json &) -> typename std::enable_if< sizeof...(Ts)==0 > |
| Particle to JSON. | |
| template<typename... Ts> | |
| auto | from_json (const json &) -> typename std::enable_if< sizeof...(Ts)==0 > |
| template<typename... Properties> | |
| void | to_json (json &j, const ParticleTemplate< Properties... > &a) |
| template<typename... Properties> | |
| void | from_json (const json &j, ParticleTemplate< Properties... > &a) |
| template<RequireParticleIterator Iterator> | |
| void | applyAtomDataCharges (Iterator first, Iterator last, const double max_difference=1e-9) |
| Reset all charges in particle range to those found in Faunus::atoms. More... | |
| void | from_json (const nlohmann::json &, Random &) |
| json to Random conversion | |
| void | to_json (nlohmann::json &, const Random &) |
| Random to json conversion. | |
| Point | randomUnitVector (Random &rand, const Point &directions=Point::Ones()) |
| Random unit vector using Neuman's method ("sphere picking") | |
| Point | randomUnitVectorPolar (Random &rand) |
| Random unit vector using polar coordinates ("sphere picking") | |
| TEST_CASE ("[Faunus] SASA_CellList") | |
| void | to_json (json &j, const Change::GroupChange &group_change) |
| Serialize Change data to json. | |
| void | to_json (json &j, const Change &change) |
| Serialise Change object to json. | |
| TEST_CASE ("[Faunus] Change") | |
| TEST_CASE ("Space::numParticles") | |
| void | to_json (json &j, const Space &spc) |
| Serialize Space to json object. | |
| void | from_json (const json &j, Space &spc) |
| Deserialize json object to Space. | |
| TEST_SUITE_BEGIN ("Space") | |
| TEST_CASE ("[Faunus] Space") | |
| TEST_CASE ("[Faunus] Space::toIndices") | |
| TEST_CASE ("[Faunus] Space::updateParticles") | |
| TEST_CASE ("SpaceFactory") | |
| struct Faunus::Change | __attribute__ ((aligned(32))) |
| void | to_json (nlohmann::json &, const Tensor &) |
| Tensor -> Json. | |
| void | from_json (const nlohmann::json &, Tensor &) |
| Json -> Tensor. | |
| TEST_SUITE_BEGIN ("Tensor") | |
| TEST_CASE ("[Faunus] Tensor") | |
Variables | |
| std::vector< Faunus::AtomData > | atoms |
| Global instance of atom list. | |
| template<typename T > | |
| concept | RequireNamedElements |
| Concept for named database such as vector<AtomData>, vector<MoleculeData> etc. More... | |
| TipFromTheManual | usageTip |
| template<class T > | |
| concept | StringStreamable |
| template<class T > | |
| concept | Averageable |
Requirements for types used with AverageObj More... | |
| template<class T > | |
| concept | RequirePoints |
| Concept for a range of points. More... | |
| template<class T > | |
| concept | RequirePointIterator = std::is_convertible_v<std::iter_value_t<T>, Point> |
Concept for an iterator to a Point | |
| std::shared_ptr< spdlog::logger > | faunus_logger |
| std::shared_ptr< spdlog::logger > | mcloop_logger |
| template<typename T > | |
| concept | RequireGroups |
| Concept for a range of groups. More... | |
| std::vector< MoleculeData > | molecules |
| List of molecule types. | |
| std::vector< ReactionData > | reactions |
| List of reactions. | |
| template<class T > | |
| concept | RequireParticles |
| Concept for a range of particles. More... | |
| template<class T > | |
| concept | RequireParticleIterator = std::is_convertible_v<std::iter_value_t<T>, Particle> |
| Random | random |
| global instance of Random | |
| class Faunus::Space | __attribute__ |
Cell list class templates.
Faunus main namespace.
Minimal interface to be used in other header file to avoid number of class templates. Full class templates definitions are provided in "celllistimpl.h" file.
| void Faunus::applyAtomDataCharges | ( | Iterator | first, |
| Iterator | last, | ||
| const double | max_difference = 1e-9 |
||
| ) |
Reset all charges in particle range to those found in Faunus::atoms.
| first | Iterator to first particle |
| last | Iterator to end |
| max_difference | Apply only if charge mismatch is larger than this, then log |
Return evenly spaced values within a given interval.
Values are lazily generated within the half-open interval [start, stop) In other words, the interval including start but excluding stop. This function has the same behavior as Numpy's arange()
Examples:
arange(4.0, 10.0, 1.0); // --> 4 5 6 7 8 9 arange(4.0, 20.0, 3.0); // --> 4 7 10 13 16 19 arange(-1.0, 1.0, 0.5); // --> -1 -0.5 0 0.5
| T | Value type; must be floating point or integral |
| start | Start of interval (included) |
| stop | End of interval (excluded) |
| step | Spacing between values |
| auto Faunus::asEigenMatrix | ( | iter | begin, |
| iter | end, | ||
| memberptr | m | ||
| ) |
Eigen::Map facade to data members in STL container.
No data is copied and modifications of the Eigen object modifies the original container and vice versa.
Example:
std::vector<Tparticle> v(10); auto m1 = asEigenVector(v.begin, v.end(), &Tparticle::pos); –> 10x3 maxtrix view auto m2 = asEigenMatrix(v.begin, v.end(), &Tparticle::charge); –> 10x1 vector view
sizeof<double> | std::unique_ptr< StructureFileWriter > Faunus::createStructureFileWriter | ( | const std::string & | suffix | ) |
Create structure writer.
| suffix | Filename suffix (pqr, pdb, aam, xyz, gro) |
| Point Faunus::dipoleMoment | ( | Titer | begin, |
| Titer | end, | ||
| BoundaryFunction | boundary = [](Point&) {}, |
||
| const Point | origin = {0, 0, 0}, |
||
| double | cutoff = pc::infty |
||
| ) |
Returns the total dipole-moment for a set of particles.
| begin | First particle |
| end | Last particle |
| boundary | Function to use for applying periodic boundaries. Default: do nothing. |
| origin | Origin of dipole moment, default (0,0,0). |
| cutoff | Cut-off for included particles with regard to origin, default value is infinite |
If the particle has extended properties, point dipole moments will be added as wellCalculates dipole moment vector
| void Faunus::displayError | ( | spdlog::logger & | logger, |
| const std::exception & | e, | ||
| int | level = 0 |
||
| ) |
Nicely displays nested exceptions using a logger.
| logger | logger to display the exception with |
| e | exception to display (possibly nested) |
| level | internal counter for recursion |
Approximate 1 - erfc_x.
| x | Value for which erf should be calculated |
Approximation of erfc-function.
| x | Value for which erfc should be calculated |
Reference for this approximation is found in Abramowitz and Stegun, Handbook of mathematical functions, eq. 7.1.26
\[ \erf(x) = 1 - (a_1t + a_2t^2 + a_3t^3 + a_4t^4 + a_5t^5)e^{-x^2} + \epsilon(x) \]
\[ t = \frac{1}{1 + px} \]
\[ |\epsilon(x)| \le 1.5\times 10^{-7} \]
| double Faunus::exp_cawley | ( | double | y | ) |
Approximate exp() function.
Update 2019: http://www.federicoperini.info/wp-content/uploads/FastExp-Final.pdf
| std::vector< AtomData::index_type > Faunus::fastaToAtomIds | ( | std::string_view | fasta_sequence | ) |
Convert FASTA sequence to atom id sequence.
| fasta_sequence | FASTA sequence, capital letters. |
| ParticleVector Faunus::fastaToParticles | ( | std::string_view | fasta_sequence, |
| double | bond_length = 7.0, |
||
| const Point & | origin = {0, 0, 0} |
||
| ) |
Create particle vector from FASTA sequence with equally spaced atoms.
Particle positions are generated as a random walk, starting at origin, propagating in bond_length steps.
| AtomData & Faunus::findAtomByName | ( | std::string_view | name | ) |
Finds an atom by its name in the global Faunus atoms lexicon.
The first matching atom is returned, or an UnknownAtomError is thrown when not found.
| name | an atom name to look for |
| UnknownAtomError | when no atom found |
| MoleculeData & Faunus::findMoleculeByName | ( | std::string_view | name | ) |
Finds a molecule by its name in the global Faunus molecules lexicon.
| if | molecule not found |
The first matching molecule is returned, or an UnknownMoleculeError is thrown when not found.
| name | a molecule name to look for |
| UnknownMoleculeError | when no molecule found |
| auto Faunus::findName | ( | RequireNamedElements auto & | range, |
| std::string_view | name | ||
| ) |
Finds the first element with a member attribute name matching the input.
| range | a range of elements |
| name | a name to look for |
last if not found | T Faunus::for_each_unique_pair | ( | Titer | begin, |
| Titer | end, | ||
| Tfunction | f, | ||
| Taggregate_function | aggregator = std::plus<T>() |
||
| ) |
Iterate over pairs in container, call a function on the elements, and sum results.
| T | Floating point type. Default: double) |
| begin | Begin iterator |
| end | End iterator |
| f | Function to apply to the pair |
| aggregator | Function to aggregate the result from each pair. Default: std::plus<T> |
| void Faunus::from_json | ( | const json & | j, |
| std::vector< AtomData > & | atom_vector | ||
| ) |
Construct vector of atoms from json array.
Items are added to existing items while if an item already exists, it will be overwritten.
| std::optional<T> Faunus::get_optional | ( | const json & | j, |
| std::string_view | key | ||
| ) |
Extract JSON value associated with key into std::optional
If the value does not exist, return std::nullopt
| If | value exists but cannot be extracted as T. |
|
inline |
Fast inverse square-root approximation.
This is Carmack et al's "magic" inverse square root routine, modified to work with both double and float and with one (less precise) or two (more precise) iterations. Conditionals and sanity checks are evaluated at compile time.
| float_t | Floating point type (float or double) |
| iterations | Number of iterations (1 or 2) |
| x | value to operate on |
| std::string Faunus::joinToString | ( | const Range & | values | ) |
Convert range of values into space separated string.
| values | Range (vector, set, ...) of values to convert |
Returns a key-value pair from a JSON object which contains a single key.
JSON objects having a single key-value pair are a common pattern in JSON configuration used in Faunus. This function provides a convenient way to handle it.
| j | JSON object |
| std::runtime_error | when not a JSON object or the object is empty or the object contains more than a single value |
| ParticleVector Faunus::loadStructure | ( | std::string_view | filename, |
| bool | prefer_charges_from_file = true |
||
| ) |
Load structure file into particle vector.
| filename | filename to load (aam, pqr, xyz, gro) |
| prefer_charges_from_file | if true, ignore AtomData charges |
| Throws | exception if nothing was loaded or if unknown suffix |
| double Faunus::monopoleMoment | ( | Titer | begin, |
| Titer | end | ||
| ) |
Returns the total charge for a set of particles.
| begin | First particle |
| end | Last particleCalculates dipole moment vector for a set of particles |
| double Faunus::mu2mu | ( | const Tvec & | muA, |
| const Tvec & | muB, | ||
| double | muAxmuB, | ||
| const Tvec & | r, | ||
| double | a = 1.0, |
||
| double | b = 0.0 |
||
| ) |
Returns dipole-dipole interaction.
| muA | Unit dipole moment vector of particle A |
| muB | Unit dipole moment vector of particle B |
| muAxmuB | Product of dipole scalars |
| r | Direction \( r_A - r_B \) |
| auto Faunus::names2ids | ( | const T & | database, |
| const std::vector< std::string > & | names | ||
| ) |
Search for name in database and return id()
| T | Container of object having .name and .id() data members |
| database | Iterable range having .name and .id() members |
| names | Container with names to convert to id |
| if | names not found |
namesThis is typically used with Faunus::atoms or Faunus::molecules to lookup atom or molecule names and return them as id numbers. If the string * occurs in names, the returned vector will be a sequence containing all id's of the database, i.e. 0, ..., database.size()-1.
| Faunus::NLOHMANN_JSON_SERIALIZE_ENUM | ( | SpheroCylinderData::PatchType | , |
| {{SpheroCylinderData::PatchType::Invalid, nullptr}, {SpheroCylinderData::PatchType::Full, "full"}, {SpheroCylinderData::PatchType::Capped, "capped"}, {SpheroCylinderData::PatchType::None, "none"}} | |||
| ) |
General properties for atoms.
< Unsigned int used for atom id and atom indexing
< Name
< Particle charge [e]
< Weight
< Diameter for e.g Lennard-Jones etc. [angstrom] Do not set! Only a temporal class member during the refactorization
< Chemical activity [mol/l]
< Excess polarisability (unit-less)
< Translational displacement parameter [angstrom]
< Rotational displacement parameter [degrees]
< Surface tension [kT/Å^2]
< Transfer free energy [J/mol/angstrom^2/M]
< Dipole moment unit vector
< Dipole moment length
< Is the particle hydrophobic?
< Is the particle implicit (e.g. proton)?
< Atomic scattering form factor (q-independent)
< Arbitrary interaction parameters, e.g., epsilons in various potentials
< Data for patchy sphero cylinders (PSCs)
< Type id
< Type id
|
inline |
Convert floating point number to integral number.
Perform range check and rounding.
| TOut | integral type |
| TIn | floating point type |
| number | (floating point type) |
| std::overflow_error |
| std::vector< MoleculeData::index_type > Faunus::parseMolecules | ( | const json & | j | ) |
| j | Json object with a molecules list of strings |
| if | unknown molecule name or not a list of strings |
| std::pair< std::vector< std::string >, std::vector< std::string > > Faunus::parseReactionString | ( | const std::string & | process_string | ) |
This parses a string containing a reaction, e.g.
| process_string | Reaction such as "A + B = C" |
| std::runtime_error | if unknown atom or molecule, or syntax error |
"A = B + B" and returns a pair with (1) a vector of reactant names and (2) a vector of product names. Reactants and products are split by a = sign. All elements in the string must be separated by a white-space.
n'th integer power of float
On GCC/Clang this will use the fast __builtin_powi function.
See also:
| double Faunus::q2mu | ( | double | QBxMuA, |
| const Tvec & | muA, | ||
| double | QAxMuB, | ||
| const Tvec & | muB, | ||
| const Tvec & | r | ||
| ) |
Returns ion-dipole interaction.
| QBxMuA | Product of ion B:s charge and dipole A:s scalar |
| muA | Unit dipole moment vector of particel A |
| QAxMuB | Product of ion A:s charge and dipole B:s scalar |
| muB | Unit dipole moment vector of particel B |
| r | Direction \( r_A - r_B \) |
| double Faunus::q2quad | ( | double | qA, |
| const Tmat & | quadB, | ||
| double | qB, | ||
| const Tmat & | quadA, | ||
| const Tvec & | r | ||
| ) |
Returns ion-quadrupole interaction.
| qA | Charge of particle A |
| quadB | Quadrupole moment of particle B |
| qB | Charge of particle B |
| quadA | Quadrupole moment of particle A |
| r | Direction \( r_A - r_B \) |
| Tensor Faunus::quadrupoleMoment | ( | Titer | begin, |
| Titer | end, | ||
| BoundaryFunction | boundary = [](const Point&) {}, |
||
| Point | origin = {0, 0, 0}, |
||
| double | cutoff = pc::infty |
||
| ) |
Returns the total quadrupole-moment for a set of particles, note with trace!
| begin | First particle |
| end | Last particle |
| boundary | Function to use for boundary |
| origin | Origin for quadrupole-moment, default (0,0,0) |
| cutoff | Cut-off for included particles with regard to origin, default value is infiniteCalculates quadrupole moment tensor (with trace) |
Convert spherical- to cartesian-coordinates.
| origin | The origin to be added (optional) |
| auto Faunus::splitConvert | ( | const std::string & | words | ) |
Convert space separated words into vector of type T.
Example:
textio::splitConvert<double>("0.2 1 100"); // -> {0.2, 1.0, 100.0}
| bool Faunus::streamMarket | ( | const SparseMatrixType & | mat, |
| std::ostream & | out, | ||
| bool | symmetric = false |
||
| ) |
Save Matrix Market sparse matrix.
| mat | Sparse matrix |
| out | Output stream |
| symmetric | Set to true if symmetric matrix (half storage) |
Mainly copied from Eigen's unsupported SparseExtra/MarketIO.h
Round a floating point to integer for use with histogram binning.
This will round to nearest integer, assuming a certain resolution (default 1). This can be useful for binning floating point data into a histogram or table of resolution dx (second argument).
Example:
| mask | Bitmask based on enum Group::Selectors |
| auto Faunus::toMultipole | ( | const Tgroup & | g, |
| BoundaryFunction | boundary = [](const Point&) {}, |
||
| double | cutoff = pc::infty |
||
| ) |
Converts a group to a multipole-particle.
| g | Group |
| boundary | Function to use for boundary |
| cutoff | Cut-off for included particles with regard to origin, default value is infinite |
| Point Faunus::xyz2rth | ( | const Point & | , |
| const Point & | origin = {0, 0, 0}, |
||
| const Point & | dir = {0, 0, 1}, |
||
| const Point & | dir2 = {1, 0, 0} |
||
| ) |
Convert cartesian- to cylindrical-coordinates.
Convert cartesian- to spherical-coordinates.
| concept Faunus::Averageable |
Requirements for types used with AverageObj
| concept Faunus::RequireGroups |
Concept for a range of groups.
| concept Faunus::RequireNamedElements |
Concept for named database such as vector<AtomData>, vector<MoleculeData> etc.
| concept Faunus::RequireParticles |
Concept for a range of particles.
| concept Faunus::RequirePoints |
Concept for a range of points.
| concept Faunus::StringStreamable |
1.8.13