Skip to content

Conversation

@Technici4n
Copy link
Collaborator

See JuliaMolSim/DftFunctionals.jl#24.

Currently including the manifest such that I can run CI.

Copy link
Member

@mfherbst mfherbst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally less bad than what I expected. I wonder if we should somehow add a mechanism to conserve the functional symbols inside the xc term if we happen to know them ? Like the standard_models.jl functions (LDA(), PBE() and similar) could probably easily do that.

psp
end

# term types don't have a supertype, so we use a different function name
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That can be changed ...

Comment on lines +29 to +33
if f isa DispatchFunctional
string(f.inner.identifier)
else
string(f)
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this because it implies that when explicitly using DftFunctionals to make a standard functional such as LDA exchang (as opposed to a DispatchFunctional) a different string results, right? Moreover I'm not sure the default returned string(f) is super nice (especially when we have dual type parameters) ... but perhaps that we should fix inside DftFunctionals by providing good show functions for all functionals ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is an example:

Without duals:

PbeExchange{Float64, Float64}(0.804, 0.21951497276451704)

With duals:

PbeExchange{Float64, Dual{ForwardDiff.Tag{Main.var"##239".ForwardDiffWrappers.DerivativeTag, Float64}, Float64, 1}}(0.804, Dual{ForwardDiff.Tag{Main.var"##239".ForwardDiffWrappers.DerivativeTag, Float64}}(0.21951497276451704,0.0))

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Case in point, that's not super useful. But we can fix this with a custom show in DftFunctionals. In fact what we could do is actually re-introduce the identifier function, that employs knowledge of the parameter values to return the appropriate libxc symbol ? Or at the very least something like PbeExchange(β=0.804, γ=0.2195) (note rounding).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that for a custom functional, we would previously report something like pbe_x_custom, which I don't find super useful, and loses part of the info. My thought process was thus:

  • For exact reconstruction, JLD2 will be able to reconstruct the object exactly anyway, nothing special needs to be done.
  • The identifier was mostly used to give some info to users, e.g. when printing a model or basis. So for the standard DispatchFunctional you'd see the identifiers. But if the user is calling DftFunctionals directly I expect them to be an "expert" and thus be able to deal with the raw display.

that employs knowledge of the parameter values to return the appropriate libxc symbol

Could be done as well

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be done as well

Yes and should not be too hard :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could, but is it relevant if any non-standard parameter choice will just be printed as pbe_x_custom or similar?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we have only a print function that for those we could print the actual parameter values. So you have something more specific where possible (just e.g. gga_x_pbe) and something less specific for the rest PbeExchange(β=..., γ=....). I think that would be very useful.

Xc(functionals, ForwardDiff.value(x.scaling_factor), x.potential_threshold, x.use_nlcc)
end
# get the value of each field of the functional
@generated function construct_value(x::F) where {F <: DftFunctionals.Functional}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's not too heavy as a dependency and sufficiently stable as a package, I'm happy wtih it. But in my experience there is few worse things that commiting on too many, too brittle helper packages, that we need to undo or fix later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants