<commit_before>/*
 * general_test.go
 * 
 * Copyright 2012 <NAME> <rmera{at}chemDOThelsinkiDOTfi>
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 * 
 * 
 */



package chem
//import "github.com/skelterjohn/go.matrix"
//import "fmt"
import "testing"
import "strings"
import "strconv"

func TestGeo(Te *testing.T) {
	pulled_atoms:=[7]int{43,41,42,40,85,86,87}
	pulling_vector:=[2]int{40,88}
	var mol Molecule
	a,b,err:=XyzRead("test/sample.xyz")
	if err!=nil{
		Te.Error(err)
		}
	mol.Atoms=a
	mol.Coords=b
	pulled_res,err:=mol.GetCoords(pulled_atoms[:], 0)
	if err!=nil{
		Te.Error(err)
		}
	at1:=mol.Coord(pulling_vector[0],0)
	vector:=mol.Coord(pulling_vector[1],0)
	vector=vector.Copy()
	err=vector.SubtractDense(at1)
	if err!=nil{
		Te.Error(err)
		}
	vector=Unitarize(vector)
	var scale_factors = [12]float64{-1.0, -2.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0}
	for _,scaling:=range(scale_factors){
		vec:=vector.Copy()
		pulled:=pulled_res.Copy()<commit_msg>playing with tests<commit_after>/*
 * general_test.go
 * 
 * Copyright 2012 <NAME> <rmera{at}chemDOThelsinkiDOTfi>
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 * 
 * 
 */



package chem
import "github.com/skelterjohn/go.matrix"
import "fmt"
import "testing"
import "strings"
import "strconv"

func TestChangeAxis(Te *testing.T){
	var mol Molecule
	ats,coords,bfac,err:=PdbRead("test/2c9v.pdb",true)
	if err!=nil{
		Te.Error(err)
		}
	mol.Atoms=ats
	mol.Coords=coords
	mol.Bfactors=bfac
	orient_atoms:=[2]int{0,0}
	for index, atom:= range(mol.Atoms){
		if atom.Chain=='A' && atom.Molid==124{
			if atom.Name=="CA"{
				orient_atoms[1]=index
				}else if atom.Name=="CB"{
				orient_atoms[1]=index	
				}
			}
		}
	ov1:=mol.Coord(orient_atoms[0], 0)
	ov2:=mol.Coord(orient_atoms[1], 0)
	//now we center the thing in the beta carbon of D124
	newcenter:=ov2.Copy()
	newcenter.Scale(-1)
	err=AddRow(mol.Coords[0],newcenter)
	//Now the rotation
	ov1=mol.Coord(orient_atoms[0], 0) //make sure we have the correct versions
	ov2=mol.Coord(orient_atoms[1], 0)  //same
	orient:=ov2.Copy()
	orient.SubtractDense(ov1)
	rotation,err:=GetSwitchZ(mol.Coords[0],orient)
	if err!= nil {
		Te.Error(err)
		}
	mol.Coords[0]=matrix.ParallelProduct(mol.Coords[0],rotation)
	fmt.Println(orient_atoms[1], mol.Atoms[orient_atoms[1]])//, mol.Coords[0][orient_atoms[1]])
	if err!=nil{
		Te.Error(err)
		}
	PdbWrite(&mol,"test/2c9v-aligned.pdb")
	}



func TestGeo(Te *testing.T) {
	pulled_atoms:=[7]int{43,41,42,40,85,86,87}
	pulling_vector:=[2]int{40,88}
	var mol Molecule
	a,b,err:=XyzRead("test/sample.xyz")
	if err!=nil{
		Te.Error(err)
		}
	mol.Atoms=a
	mol.Coords=b
	pulled_res,err:=mol.GetCoords(pulled_atoms[:], 0)
	if err!=nil{
		Te.Error(err)
		}
	at1:=mol.Coord(pulling_vector[0],0)
	vector:=mol.Coord(pulling_vector[1],0)
	vector=vector.Copy()
	err=vector.SubtractDense(at1)
	if err!=nil{
		Te.Error(err)
		}
	vector=Unitarize(vector)
	var scale_factors = [12]float64{-1.0, -2.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0}
	for _,scaling:=range(scale_factors){
		vec:=vector.Copy()
		pulled:=pulled_res.Copy()
{'fraction_non_alphanumeric': 0.14256756756756755, 'fraction_numerical': 0.04121621621621622, 'mean_word_length': 4.396111786148238, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1724709', 'n_tokens_mistral': 1887, 'n_tokens_neox': 1687, 'n_words': 429}