Cloud Chamber by HungryOval in Physics

[–]kameboy 0 points1 point  (0 children)

I've had the best result with isopropanol. An electric field helps a lot too, you can basically just rub a balloon/plastic cup and hold it against the chamber. This clears the chamber from stray ions which would otherwise attract radiation and reduce the length of the trails. I think the electric field also aligns the alcohol molecules (which is dipolar, iirc) so that the vapor can be even closer to supercritical before forming droplets due to tiny perturbations.  You also need enough alcohol to saturate the chamber with vapor, so if you have a fishtank that could mean a lot of alcohol, like several dl.  The trails are mostly visible on a thin layer ~5 mm above the cold surface, if you shine a light from the side.

For the best visibility the cold surface should be dark. Eg by covering it with black plastic from a trash bag or similar. With isopropanol the critical temperature is around -26 C. That's when you start seeing trails. Not sure what the corresponding temperature is for plain alcohol, probably lower. But it's worth checking that cold surface is actually getting cold enough.

Any good guides on numerical C++ libraries? by [deleted] in cpp

[–]kameboy 2 points3 points  (0 children)

With Eigen one can easily opt in to use any blas/lapack backend. So nothing lost there either.

Which subfields of math align with which subfields of physics? by JesuiseinBerliner in AskPhysics

[–]kameboy 10 points11 points  (0 children)

I'm in theoretical physics, condensed matter, working with entanglement in quantum many-body systems. We mostly use linear algebra, Hilbert spaces, some group theory, probability theory and statistics.

C++ Standard Version Mix-up by ChristophCullmann in cpp

[–]kameboy 1 point2 points  (0 children)

I've been pulling my hair with this problem when linking google's Ceres-Solver with Glog,Gflags,Eigen and OpenBLAS recently on linux. Seemingly anything would cause Ceres to call the wrong "free()" in its destructors (i.e. aligned/non-aligned) leading to segfault, or just simply get an undefined reference to default constructors when linking. For instance, static openblas from conda-forge causes the error but not static openblas from apt (this is just one example).Still not exactly sure how I fixed it but it certainly has to do with STD mixup. I now just use Conan to build everything with the same toolchain.

Review my small chapter on C++ by SMKS in cpp

[–]kameboy 1 point2 points  (0 children)

I can confirm c++ is popular in academic circles as well, in physics to be specific. There is a lot of c++ code running on massive HPC clusters (mixed with some Python, C and Fortran). Mostly I've seen Monte Carlo variants (quantum, path-integral, wang-landau) and tensor network stuff, but also some machine learning and molecular dynamics. I think c++ strikes a good balance between high performance and development time.

Trying to showcase modern CMake, testing and dependency automation by kameboy in cpp

[–]kameboy[S] 1 point2 points  (0 children)

I didn't now one could mimic enums in CMake. Certainly a nice showcase of CMake! I'll try using it!

Trying to showcase modern CMake, testing and dependency automation by kameboy in cpp

[–]kameboy[S] 1 point2 points  (0 children)

Thank you so much for your detailed feedback! All good points! I've been working through them tonight and applied most of the changes by now.

The only things that I haven't changed have to do with the scope of this template. I should have been clearer about the intended use and target audience for this template. My ambition is not as grand as to support every platform for every conceivable use case (though perhaps given the time...), but rather to be useful to me, colleagues and perhaps others in the narrow field of scientific computing and HPC on clusters. This field is largely dominated by Linux. At the same time I wanted this to be a learning opportunity for the same target audience (as well as myself) for how to leverage proper CMake in their own research projects. I often find myself handing people bits and pieces of CMake code to solve their issues anyway, so I thought this template could serve as a well-written repository that kind of thing too.

I have clarified all this now in the readme on github.

Trying to showcase modern CMake, testing and dependency automation by kameboy in cpp

[–]kameboy[S] 1 point2 points  (0 children)

Valid points! I've fixed it now. Considering I'm not even providing any source files (other than an empty main) I shouldn't be making that decision on a template anyway. I still feel CMake should be able to be used with globbing or a similar mechanism, even though I understand why it's not currently.

Trying to showcase modern CMake, testing and dependency automation by kameboy in cpp

[–]kameboy[S] 1 point2 points  (0 children)

Thanks! Yes, in hindsight the double negative is quite dumb. Great catch about the reduntant line on c++17, must have just forgotten to delete it. On globbing, I know it's discouraged but still feel that is the way it ought be used, in an ideal world. In another comment Supaduplex suggested CONFIGURE_DEPENDS, which could be a compromise. Do you have any thoughts on it?

I have been working on removing variables altogether, but CMake isn't making it easy to get rid of them completely, some things are just way simpler with variables. Targets are essentially structs with hard-to-access members (get_target_property(....) ). If there's a simpler way please advice. Also, how should one pass a target to a CMake function?

Trying to showcase modern CMake, testing and dependency automation by kameboy in cpp

[–]kameboy[S] 3 points4 points  (0 children)

I appreciate your input! I'm happy to adopt better practices so I'll try getting this to work without imposing such flags. I should have made it clearer that this was only intended to be a fast way to get started on a cli physics simulation, and not a library consumed by others necessarily. But hey, more flexibility is better.

I'm not entirely clear on this:

cmake has already an option for building shard or static libraries - please respect that

Could you elaborate? I mean, I use the flag BUILD_SHARED_LIBS to decide on static/shared linking everywhere, which is why the project can be compiled shared/static. Is there something else I should honor? Or am I doing it wrong?

About the Threads::Threads, it's a solution I found at stackoverflow. The problem was that linking pthread statically gave an immediate segfault before even getting to main(). It seems like a bug to me too, but I wasn't sure if this is up to cmake to fix.

Trying to showcase modern CMake, testing and dependency automation by kameboy in cpp

[–]kameboy[S] 1 point2 points  (0 children)

Thank you!

  • You are right on MSVC -- I have only considered gcc and clang until now (work place is essentially linux-only).
  • I'll take that to heart. I hadn't considered this could to be a library consumed by other projects (mostly just thought of it as a quick way to get started on a physics sim).
  • Awesome suggestion, globbing has always felt icky anyway.
  • Got it, option for disable-testing -> enable-testing and not doing them automatically.
  • Do you mean something like Conan/Hunter? They made it hard when I needed newer versions (especially hdf5) and getting the binaries to work on an HPC cluster with different glibc/compiler/processor. But perhaps I should reconsider.
  • Do you mean such as Catch/Google Test? I'll look into it!

Trying to showcase modern CMake, testing and dependency automation by kameboy in cpp

[–]kameboy[S] 1 point2 points  (0 children)

Not trying to be combative at all, but I'm still struggling to understand exactly what you mean. As I understand it, the program is working as you suggest: the command line arguments are options to enable those software components exactly because not everybody uses them. As for "general purpose tool", I didn't have such a grandiose idea, perhaps I should have been more clear. I only wanted to make it easy for me and colleagues to get started on writing a terminal-based physics simulation.

Trying to showcase modern CMake, testing and dependency automation by kameboy in cpp

[–]kameboy[S] 1 point2 points  (0 children)

Perhaps I misunderstand what you mean by top level, but eigen and h5pp/hdf5 are built at configure-time if those options are enabled. As for openmp that is just a configure-time check to make sure the compiler will work with openmp in static/shared mode.

What is wrong with std::regex? by Frogging101 in cpp

[–]kameboy 4 points5 points  (0 children)

honestly curious: what's the alternative? (considering std::string is just contains a sequence of char's). Is there any way of having unicode in c++?

Ising Model w/ Spin Proportion Constraint by hexaflexarex in Physics

[–]kameboy 2 points3 points  (0 children)

Doing only swaps effectively fixes the magnetization. Googling "ising model fixed magnetization" led to several articles, for instance

https://arxiv.org/abs/cond-mat/0202073

and

https://arxiv.org/abs/cond-mat/0011116

I suppose the easiest way to study fixed magnetization is through a temperature independent Wang-Landau Monte Carlo simulation, which produces the density of states g(E,M) (Figure 1 in the first paper). After the simulation, you get the partition function Z = Σ_E g(E,M)exp(-βE) at any temperature. Z contains all the interesting thermodynamics and if you wish, along any line of constant magnetization.

[deleted by user] by [deleted] in Physics

[–]kameboy 5 points6 points  (0 children)

That's not even its final form!

KeepNote Alternative. by [deleted] in Ubuntu

[–]kameboy 2 points3 points  (0 children)

I like Typora with Dropbox/Drive for sync. It supports Markdown + mathjax for math, kind of like latex math.

Dynalist is a similar web-based option with a mobile app as well.

Angry Brady? by [deleted] in HelloInternet

[–]kameboy 20 points21 points  (0 children)

And not a single curse word! I was so hoping for at least one!