53 lines
1 KiB
C
53 lines
1 KiB
C
|
|
#pragma once
|
||
|
|
|
||
|
|
#include "CoreMinimal.h"
|
||
|
|
#include "Kismet/BlueprintFunctionLibrary.h"
|
||
|
|
#include "MoleculeFunctionLibrary.generated.h"
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Struct representing an atom
|
||
|
|
*/
|
||
|
|
USTRUCT(BlueprintType)
|
||
|
|
struct FAtom
|
||
|
|
{
|
||
|
|
GENERATED_BODY()
|
||
|
|
|
||
|
|
UPROPERTY(BlueprintReadWrite, Category="Molecule")
|
||
|
|
FString Element;
|
||
|
|
|
||
|
|
UPROPERTY(BlueprintReadWrite, Category="Molecule")
|
||
|
|
FVector Position; // Unreal coordinates
|
||
|
|
};
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Struct representing a bond
|
||
|
|
*/
|
||
|
|
USTRUCT(BlueprintType)
|
||
|
|
struct FBond
|
||
|
|
{
|
||
|
|
GENERATED_BODY()
|
||
|
|
|
||
|
|
UPROPERTY(BlueprintReadWrite, Category="Molecule")
|
||
|
|
int32 AtomIndex1;
|
||
|
|
|
||
|
|
UPROPERTY(BlueprintReadWrite, Category="Molecule")
|
||
|
|
int32 AtomIndex2;
|
||
|
|
};
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Blueprint Function Library to parse PDB strings
|
||
|
|
*/
|
||
|
|
UCLASS()
|
||
|
|
class UMoleculeFunctionLibrary : public UBlueprintFunctionLibrary
|
||
|
|
{
|
||
|
|
GENERATED_BODY()
|
||
|
|
|
||
|
|
public:
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Parses a PDB string and outputs arrays of atoms and bonds
|
||
|
|
*/
|
||
|
|
UFUNCTION(BlueprintCallable, Category="Molecule")
|
||
|
|
static bool ParsePDBFromString(const FString& PDBContent, TArray<FAtom>& OutAtoms, TArray<FBond>& OutBonds);
|
||
|
|
};
|