Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

charges #18

Closed
Nick-Mul opened this issue Mar 2, 2024 · 1 comment
Closed

charges #18

Nick-Mul opened this issue Mar 2, 2024 · 1 comment

Comments

@Nick-Mul
Copy link

Nick-Mul commented Mar 2, 2024

Hello agin,
I've been looking at calculating partial charges for the atoms on the pdb. I do this in with an external QM package which generates a list of charges.

At the moment I am creating a new struct as not that sure how to update the charge field. It would be nice to have an example on how to update the charge field in Atom. Also if you knew of any good Julia ways of calculating partial charges, QM is a bit expensive on big systems.

struct extendATOM
atom::atom
partialCharge::Float64
end
@lmiq
Copy link
Member

lmiq commented Mar 2, 2024

The PDB format has a charge field, but unfortunately it is a String, so it is not very useful to store actual partial charges.

You probably want to use custom fields.

For instance, you can do:

julia> using PDBTools

julia> pdb = wget("1BSX", "protein");

julia> charges = rand(length(pdb));

julia> for (i, atom) in enumerate(pdb)
           atom.custom[:charge] = charges[i]
       end

julia> pdb[1].custom[:charge]
0.09441681249467149

julia> custom_field(pdb[1], :charge) # alternative getter function
0.09441681249467149

julia> custom_field.(pdb, :charge) # broadcast to get all charges (with the dot syntax)
3994-element Vector{Float64}:
 0.09441681249467149
 0.17811534472805368
 
 0.8254040639975442
 0.6153943592336552

Concerning computing the charges, I don't know the details of your problem, but generally QM calculations are used to do so. It depends on your goals. Alternatives are using semi-empirical methods, or using classical force-fields.

You can get better advice in general, when the issue is not specific to this package, by asking on the Julia Discourse, or in the JuliaMolSim channel on slack or Zulip.

I'll add this partial charge assignment as an example in the docs. Thanks again for the feedback.

@lmiq lmiq closed this as completed Mar 2, 2024
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

No branches or pull requests

2 participants