pub struct MaterialsProjectClient { /* private fields */ }Expand description
Client for Materials Project
Provides access to:
- Computational materials science database
- Crystal structures and properties
- Band gaps, formation energies
- Electronic and mechanical properties
Note: Requires API key from https://materialsproject.org
§Example
ⓘ
use ruvector_data_framework::MaterialsProjectClient;
let client = MaterialsProjectClient::new("YOUR_API_KEY".to_string())?;
let silicon = client.search_materials("Si").await?;
let material = client.get_material("mp-149").await?;
let semiconductors = client.search_by_property("band_gap", 1.0, 3.0).await?;Implementations§
Source§impl MaterialsProjectClient
impl MaterialsProjectClient
Sourcepub fn new(api_key: String) -> Result<Self>
pub fn new(api_key: String) -> Result<Self>
Create a new Materials Project client
§Arguments
api_key- Materials Project API key (get from https://materialsproject.org)
Sourcepub async fn search_materials(
&self,
formula: &str,
) -> Result<Vec<SemanticVector>>
pub async fn search_materials( &self, formula: &str, ) -> Result<Vec<SemanticVector>>
Sourcepub async fn get_material(
&self,
material_id: &str,
) -> Result<Vec<SemanticVector>>
pub async fn get_material( &self, material_id: &str, ) -> Result<Vec<SemanticVector>>
Sourcepub async fn search_by_property(
&self,
property: &str,
min: f64,
max: f64,
) -> Result<Vec<SemanticVector>>
pub async fn search_by_property( &self, property: &str, min: f64, max: f64, ) -> Result<Vec<SemanticVector>>
Auto Trait Implementations§
impl Freeze for MaterialsProjectClient
impl !RefUnwindSafe for MaterialsProjectClient
impl Send for MaterialsProjectClient
impl Sync for MaterialsProjectClient
impl Unpin for MaterialsProjectClient
impl !UnwindSafe for MaterialsProjectClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more