Skip to content

Instantly share code, notes, and snippets.

@HanatoK
HanatoK / Distance.in
Last active June 7, 2018 17:25
custom_potential
colvarsTrajFrequency 1000
colvarsRestartFrequency 10000
scriptedColvarForces off
colvar {
name distanceX
width 0.1
lowerboundary -10.0
:-) GROMACS - ssages, 2018.1 (-:
GROMACS is written by:
Emile Apol Rossen Apostolov Paul Bauer Herman J.C. Berendsen
Par Bjelkmar Aldert van Buuren Rudi van Drunen Anton Feenstra
Gerrit Groenhof Aleksei Iupinov Christoph Junghans Anca Hamuraru
Vincent Hindriksen Dimitrios Karkoulis Peter Kasson Jiri Kraus
Carsten Kutzner Per Larsson Justin A. Lemkul Viveca Lindahl
Magnus Lundborg Pieter Meulenhoff Erik Marklund Teemu Murtola
Szilard Pall Sander Pronk Roland Schulz Alexey Shvetsov
@HanatoK
HanatoK / input.json
Created December 25, 2018 02:39
input.json
{
"walkers" : 1,
"args" : ["-v", "-deffnm", "alad_600ns"],
"CVs" : [
{
"name" : "phi",
"type": "Torsional",
"periodic" : true,
"atom_ids" : [5, 7, 9, 15]
},
colvar {
name gs
width 0.01
lowerboundary 0.0
upperboundary 1.0
lowerwallconstant 10.0
upperwallconstant 10.0
extendedLagrangian on
@HanatoK
HanatoK / main.cpp
Created December 11, 2019 17:39
C++17 std::any with std::map
#include <map>
#include <string>
#include <any>
#include <iostream>
std::map<std::string, std::any> ParameterMap;
template <typename T>
bool set_params(const std::string& name, const T& var, bool add_new_key = false) {
if (ParameterMap.count(name) > 0 || add_new_key) {
double LogSumExp(const vector<double>& exponent) {
double max_exponent = *std::max_element(std::begin(exponent), std::end(exponent));
double sum = std::accumulate(std::begin(exponent), std::end(exponent), double(0.0), [max_exponent](double init, double x){return init + std::exp(x - max_exponent);});
double result = max_exponent + std::log(sum);
return result;
}
double LogSumExp(vector<double> exponent, const vector<double>& alpha) {
std::transform(std::begin(exponent), std::end(exponent), std::begin(alpha), std::begin(exponent), [](double x, double a){return x + std::log(a);});
return LogSumExp(exponent);
@HanatoK
HanatoK / main.cu
Last active June 11, 2020 23:28
cuda copy to symbol, device to device
#include <cstdio>
#define N 3
__device__ int d_array[N] = {1, 2, 3};
__device__ __constant__ int d_array_constant[N];
static const char *_cudaGetErrorEnum(cudaError_t error) {
return cudaGetErrorName(error);
}
@HanatoK
HanatoK / main.cpp
Created October 24, 2020 09:45
Test for ELU and ReLU with Lepton
#include <iostream>
#include <string>
#include "Lepton.h"
void testElu(const double x) {
const std::string expression{"elu(x, 2.0)"};
std::cout << "Test expression: " << expression << "\n";
Lepton::ParsedExpression parsed_expression;
parsed_expression = Lepton::Parser::parse(expression);
WARNING:tensorflow:AutoGraph could not transform <function WhileV2.__call__.<locals>.while_fn at 0x7f3eaa4711f0> and will run it as-is.
Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output.
Cause: module 'gast' has no attribute 'Index'
To silence this warning, decorate the function with @tf.autograph.experimental.do_not_convert
ERROR:tensorflow:Got error while pfor was converting op name: "custom_loss/loop_body/while"
op: "StatelessWhile"
input: "custom_loss/loop_body/while/loop_counter"
input: "custom_loss/loop_body/while/maximum_iterations"
input: "custom_loss/loop_body/GatherV2"
attr {
@HanatoK
HanatoK / main_boost.cpp
Created June 8, 2021 11:11
Read .xz file via boost
// main_boost.cpp
// g++ main_boost.cpp -o main_boost -lboost_iostreams
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/filter/lzma.hpp>
#include <iostream>
#include <fstream>
#include <string>
int main() {
const std::string filename("test.dat.xz");