move SWIG support to tools/swig folder

This commit is contained in:
Axel Kohlmeyer
2020-10-18 08:19:20 -04:00
parent 0f71c02059
commit eab5d68a09
10 changed files with 2 additions and 1 deletions

32
tools/swig/run_java_example.sh Executable file
View File

@ -0,0 +1,32 @@
#!/bin/sh
cat > example.java <<EOF
public class example {
static {
System.loadLibrary("javalammps");
}
public static void main(String argv[]) {
SWIGTYPE_p_void lmp = javalammps.lammps_open_no_mpi(0, null, null);
int ver = javalammps.lammps_version(lmp);
javalammps.lammps_command(lmp, "units real");
javalammps.lammps_command(lmp, "lattice fcc 2.5");
javalammps.lammps_command(lmp, "region box block -5 5 -5 5 -5 5");
javalammps.lammps_command(lmp, "create_box 1 box");
javalammps.lammps_command(lmp, "create_atoms 1 box");
System.out.println("LAMMPS version " + ver);
System.out.println("Number of created atoms: " + javalammps.lammps_get_natoms(lmp));
javalammps.lammps_close(lmp);
}
}
EOF
CLASSPATH=$PWD:${CLASSPATH-${PWD}}
LD_LIBRARY_PATH=$PWD:${LD_LIBARARY_PATH-${PWD}}
export CLASSPATH LD_LIBRARY_PATH
javac *.java
java example